API keys & webhooks
Drive gramatic from your own code.
gramatic has a REST API for generating images programmatically. This page covers the in-app setup — creating keys and registering webhooks. For the complete list of endpoints, request and response shapes, and live examples, see the API reference.
The API also covers prompt templates and batch generation — manage templates via /api/v1/templates and fan one template across many variants with /api/v1/batches. See Prompt templates & batch.
API keys
Create an API key from your settings page. Keys are prefixed gmtc_ and authenticate requests with a bearer token:
curl https://gramati.cc/api/v1/balance \
-H "Authorization: Bearer gmtc_your_key_here"Shown once
Revoke a key from the same panel at any time; requests using a revoked key stop working immediately. Spending through the API draws on the same credit balance as the studio — see Credits & billing.
Webhooks
Generations run asynchronously, so rather than polling you can have gramatic call you back. Register a webhook — from settings or via the API — with a URL to receive events:
generation.completed— fired with the generation details and image URLs when an image is ready.generation.failed— fired with the error when a generation doesn’t succeed.
When you register a webhook, gramatic returns a signing secret (shown once). Every delivery is signed so you can verify it genuinely came from gramatic.
Verify the signature
x-gramatic-signature header — an HMAC-SHA256 of the payload using your signing secret. Recompute it on your end and reject any request that doesn’t match. The exact scheme is documented in the API reference.You can list and revoke your webhook subscriptions from settings or the API.