Skip to content

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

#
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

#
CodeStatusWhen
INVALID_REQUEST400The 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_NOT_FOUND400The job was started before its file arrived. Upload it with the links you were given, then start it again.
UNAUTHORIZED401The key is missing, unknown or revoked. An unknown key and a revoked one get the same answer.
NO_VIDEOS_LEFT402Your plan has no videos left. Carries allowance.
NOT_ENOUGH_VIDEOS402The part to process would count more videos than your plan has left. Carries videos and remaining.
VIDEO_TOO_LONG402The part to process is longer than your plan covers. Carries maxSeconds.
API_NOT_IN_PLAN403Your plan does not include the API. Carries plan.
NOT_FOUND404No job with that id on this account.
IDEMPOTENCY_KEY_REUSED409The Idempotency-Key was already used for a different request.
FILE_TOO_LARGE413The file is larger than your plan takes: said before the upload, or at the start, which then fails the job. Carries maxBytes.
YOUTUBE_UNAVAILABLE422A YouTube link was sent while YouTube imports are off.
RATE_LIMITED429Too many requests in a minute. Carries retryAfter, the seconds to wait, as the Retry-After header does.
TOO_MANY_JOBS_IN_PROGRESS429Too many jobs made through the API are queued or processing at once. Carries limit.
INTERNAL_ERROR500Something failed on Snipri's side. Try again in a moment.
WEBHOOKS_UNAVAILABLE503A 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.kindWhat the Studio calls it
download-serviceLink importing is temporarily unavailable
no-audioThis video has no audio track
videosNo videos left on your plan
videos-shortNot enough videos left for this length
video-lengthThis video is longer than your plan covers
clip-settingsThose clip settings don't fit this video
rate-limitDownloads are temporarily limited
timeoutThis one timed out
uploadThe upload didn't finish
youtubeWe couldn't import that YouTube link
unavailableThat video couldn't be reached
liveLive streams can't be clipped
too-longThat video is bigger than we can fetch
no-speechWe couldn't find any speech
unsupportedWe couldn't read that video
downloadWe couldn't download that link
selectionChoosing moments failed
unknownSomething 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. After INTERNAL_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.