Errors and limits

What a failed call answers, and the rate limit.

A failed call answers with a status code and a body like this:

{ "code": "NOT_FOUND", "status": 404, "message": "Campaign not found" }

Use code in your own logic. The message is for people and may change.

Codes

StatusCodeWhat it means
400BAD_REQUESTA parameter isn't valid, or a video was already decided.
401UNAUTHORIZEDThe key is missing, unknown or deleted.
403FORBIDDENThis key is Read only, and the call needs Read & write.
404NOT_FOUNDNothing with this id in your business.
429RATE_LIMITEDToo many calls.

Something that belongs to another business answers 404, the same as something that doesn't exist.

Rate limit

Each key can make 60 calls a minute. Past that the API answers 429 with a Retry-After header, which says how many seconds to wait:

if (res.status === 429) {
  const seconds = Number(res.headers.get("Retry-After"));
  await new Promise((done) => setTimeout(done, seconds * 1000));
}

Need help? Email support@loopearn.com

On this page