API errors
What each status code from the Shotz API means, and what to do about it.
When a request doesn’t work, the API answers with a status code and a JSON body saying why, in a sentence you can show or log:
{"error": "That needs 140 credits and there aren't enough left. Top up or change plan, then try again."}
The codes
400: the request isn’t right. The body is missing, isn’t JSON or isn’t a JSON object (the message says to send a JSON object withContent-Type: application/json), a field is the wrong type or out of range (the message names the field), you sent neither apromptnor askill, theskillisn’t one of the skills, the model doesn’t exist or doesn’t make thekindyou asked for, the prompt is longer than the model takes (the message says by how much; shorten it or pick another model), the model is turned off in the workspace (an owner can turn it on in Settings → Generative models), the workspace’s Library is full (delete a few files or change plan), theIdempotency-Keyheader isn’t 1–200 visible ASCII characters, orbeforeonGET /api/v1/mediaisn’t an ISO 8601 timestamp. Fix the request; check model ids withGET /api/v1/models.401: the key is missing, wrong or revoked, or whoever made it isn’t an owner or editor of the workspace any more. Send it asAuthorization: Bearer sk_live_…, or make a new key in Settings → API.413: the request body is too large.POST /api/v1/generationstakes up to 64 KB of JSON. Send a shorter prompt, or fewer ids and fields, and try again.429: too many requests. A key can make 60 calls a minute, and calls with a missing or wrong key are limited too. The answer has aretry-afterheader; wait that long and try again.402: there aren’t enough credits for the generation, or it would take the key’s maker over their monthly credit limit. Nothing is spent. Buy more credits, or ask an owner to raise the limit.404: there’s no generation with that id in this key’s workspace, or theprojectIdisn’t in it.409: you sent anIdempotency-Keythat was already used for a different request. Use a new key for a new generation, or send the original body again.503: generating couldn’t start just then. Wait a moment and try again. If you sent anIdempotency-Key, send the same one again: the retry returns the original generation instead of making another. See Generate with the API.
Takes that fail later
A generation can start (202) and a take fail afterwards, for example when a model refuses the prompt. That isn’t an error code: the take’s status is failed, its error says why, and its credits come back. See What happens when a take fails.
If something keeps failing, write to us with the generation’s id.
Still stuck?
Contact supportA real person in Melbourne will write back, usually within one business day.