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
| Status | Code | What it means |
|---|---|---|
| 400 | BAD_REQUEST | A parameter isn't valid, or a video was already decided. |
| 401 | UNAUTHORIZED | The key is missing, unknown or deleted. |
| 403 | FORBIDDEN | This key is Read only, and the call needs Read & write. |
| 404 | NOT_FOUND | Nothing with this id in your business. |
| 429 | RATE_LIMITED | Too 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