API
API errors and limits
Every error the Snipri API answers with, what each one means and what to do, plus the rate limits, the cap on jobs in progress and why a job failed.
On this page
Every error comes back the same way: an HTTP status and a JSON body with a code to act on and a message to show or log. Act on the code: the message is written for a person and can be reworded.
The shape of an error
#{
"error": {
"code": "RATE_LIMITED",
"message": "Too many requests. Wait a moment and try again.",
"retryAfter": 12
}
}Some errors carry more fields beside the code and the message. The table names them.
Every error
#| Code | Status | When |
|---|---|---|
INVALID_ | 400 | The body, a header or a parameter can't be used. The message says which, in the Studio's own words where it has them. |
UPLOAD_ | 400 | The job was started before its file arrived. Upload it with the links you were given, then start it again. |
UNAUTHORIZED | 401 | The key is missing, unknown or revoked. An unknown key and a revoked one get the same answer. |
NO_ | 402 | Your plan has no videos left. Carries allowance. |
NOT_ | 402 | The part to process would count more videos than your plan has left. Carries videos and remaining. |
VIDEO_ | 402 | The part to process is longer than your plan covers. Carries maxSeconds. |
API_ | 403 | Your plan does not include the API. Carries plan. |
NOT_ | 404 | No job with that id on this account. |
IDEMPOTENCY_ | 409 | The Idempotency-Key was already used for a different request. |
FILE_ | 413 | The file is larger than your plan takes: said before the upload, or at the start, which then fails the job. Carries maxBytes. |
YOUTUBE_ | 422 | A YouTube link was sent while YouTube imports are off. |
RATE_ | 429 | Too many requests in a minute. Carries retryAfter, the seconds to wait, as the Retry-After header does. |
TOO_ | 429 | Too many jobs made through the API are queued or processing at once. Carries limit. |
INTERNAL_ | 500 | Something failed on Snipri's side. Try again in a moment. |
WEBHOOKS_ | 503 | A webhookUrl was sent while webhooks are unavailable. Leave it out and read the job instead. |
A plan refusal, when there are no videos left, too few for the length or the part is longer than the plan covers, carries the sentence the Studio shows for the same refusal. How videos are counted explains what a job uses, and Plans and limits what each plan includes.
Rate limits
#- 60 requests a minute for each account, all its keys together, for every request but creating a job.
- 5 new jobs a minute for each account, shared with the Studio: creating a job counts against this limit instead.
- Past either one, the answer is RATE_LIMITED, with a Retry-After header and a retryAfter field giving the seconds to wait.
Wait the seconds it gives before sending again. A client that retries at once only stays limited.
Jobs in progress
#At most 2 jobs made through the API can be queued or processing at once on one account. Sending a link, or starting a job made for a file, past that is refused with TOO_MANY_JOBS_IN_PROGRESS; send it again when one of them ends. A job still waiting for its file does not count, and nor do jobs started in the Studio.
The cap keeps one account from filling the queue every account shares. It limits the jobs under way, not how many an account makes: once one ends, the next can start.
Why a job failed
#A job that fails is not an error of the request. The request that made it succeeded, and the job's status turns to failed later, with its error. The error's kind names the failure, and its title and message are the ones the Studio shows:
| error.kind | What the Studio calls it |
|---|---|
download- | Link importing is temporarily unavailable |
no- | This video has no audio track |
videos | No videos left on your plan |
videos- | Not enough videos left for this length |
video- | This video is longer than your plan covers |
clip- | Those clip settings don't fit this video |
rate- | Downloads are temporarily limited |
timeout | This one timed out |
upload | The upload didn't finish |
youtube | We couldn't import that YouTube link |
unavailable | That video couldn't be reached |
live | Live streams can't be clipped |
too- | That video is bigger than we can fetch |
no- | We couldn't find any speech |
unsupported | We couldn't read that video |
download | We couldn't download that link |
selection | Choosing moments failed |
unknown | Something went wrong |
Why a job failed says what to do about each one. A failed job counts nothing.
Retry safely
#- Send a request that was refused again only once what its message names is fixed. The same request, unchanged, is refused the same way.
- After
RATE_LIMITED, wait the seconds it gives. AfterINTERNAL_ERROR, or an answer that never came, wait a moment and send it again. - Send a create again with the same Idempotency-Key, so a retry can never make a second job. Send a video through the API shows how.