TMDB API error codes and fixes
TMDB API error codes on amodb come in the TMDB body: success false, a numeric status_code and a status_message. The table lists 10 HTTP and status_code pairs, from 7 for an invalid key to 36 for an expired plan. Retry only 429, 500 and 504. OMDb calls return Response False and an Error string.
When an amodb call fails, read the HTTP status first and then status_code in the body. Every error on https:/ has the TMDB body, with success set to false. Only 429, 500 and 504 are worth a retry: the other 7 codes in the table below fail again until you change the request, the key or the plan.
What does a TMDB style error response look like?
Every error from https:/ has the same JSON shape as TMDB:
{
"success": false,
"status_code": 34,
"status_message": "The resource you requested could not be found."
}Which TMDB API error codes does amodb return?
| HTTP | status_code | status_message | Retry? | What to do |
|---|---|---|---|---|
| 400 | 22 | Invalid page: Pages start at 1 and max at 500. They are expected to be an integer. | No | Send page as an integer from 1 to 500. |
| 401 | 7 | Invalid API key: You must be granted a valid key. | No | Check the key and how you send it. |
| 401 | 10 | Suspended API key: Access to your account has been suspended, contact amodb. | No | Write to support@amodb.dev. |
| 402 | 36 | Your plan has expired. Renew at https://amodb.dev/pricing/ | No | Pay for a new period. |
| 403 | 3 | The all in one endpoint is available on the Pro+ plan. See https://amodb.dev/pricing/ | No | Move to Pro+, or call the standard endpoints. |
| 404 | 34 | The resource you requested could not be found. | No | Check the id or path. |
| 405 | 37 | This method is not offered by amodb. | No | Use a read endpoint. |
| 429 | 25 | Your request count (N) is over the allowed limit of (L). | Yes | Wait for Retry-After seconds. |
| 500 | 11 | Internal error: Something went wrong, contact amodb. | Yes | Retry after a few seconds. |
| 504 | 24 | Your request to the backend server timed out. Try again. | Yes | Retry after a few seconds. |
The 403 comes from GET /, the all in one endpoint that only Pro+ has. A bad parameter other than page also returns status_code 22, with a message that starts with Invalid parameters.
Why is my TMDB API key not working?
Work down this list. Most failures are one of the first three.
| What you see | Likely cause | Fix |
|---|---|---|
401, status_code 7, key from TMDB | A TMDB API key or read access token is not an amodb key | Create an amodb key under Account and API keys |
401, status_code 7, key from amodb | The key was cut short, has a stray character or was deleted | Paste all 32 hex characters; create a new key if you lost it |
401, status_code 7, key looks right | A second key in the request wins: api_key beats apikey, which beats the Bearer header | Remove the stale parameter |
401, status_code 10 | The key is suspended | Write to support@amodb.dev |
402, status_code 36 | The plan period ended; card payments are prepaid and do not renew | Pay for a new period on amodb pricing |
403, status_code 3 | The path needs Pro+ | Use Pro+ or the standard endpoints |
429, status_code 25 | The key is over its requests per minute | Wait for Retry-After seconds |
| No answer, or a timeout | Network or DNS problem on your side | Open https:/, which needs no key |
Two quick checks. If /plans loads but a keyed call fails, the problem is the key. If /plans does not load either, the problem is the network path, so see status. The authentication page explains the three ways to send a key.
Which errors should my client retry?
| Class | Examples | Retry? | Wait |
|---|---|---|---|
| Your request is wrong | 400, 404, 405 | No | Fix the request first |
| Your key or plan is wrong | 401, 402, 403 | No | Fix the key or the plan first |
| Rate limit | 429 | Yes | Retry-After seconds, the same number as X-RateLimit-Reset |
| Our side | 500, 504 | Yes | 1, 2 and 4 seconds, then stop |
Every keyed response carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset. The rate limits page has the plan numbers.
What does an OMDb style error look like?
The OMDb compatible endpoint keeps the OMDb shape and wording:
An OMDb call with r=xml returns HTTP 400. Use r=json or leave r out.
| HTTP | Error text | Cause |
|---|---|---|
| 401 | No API key provided. | No apikey in the request |
| 401 | Invalid API key! | The key is malformed or unknown |
| 402 | Your plan has expired. Renew at https://amodb.dev/pricing/ | The plan period ended |
| 429 | Request limit reached! | Over your requests per minute |
| 400 | Only r=json is supported. | The call asked for r=xml |
| 400 | Incorrect request. | A parameter is wrong |
The OMDb API documentation lists the parameters.
{
"Response": "False",
"Error": "Movie not found!"
}const res = await fetch("https://api.amodb.dev/3/movie/550", {
headers: { Authorization: `Bearer ${process.env.AMODB_KEY}` },
});
if (!res.ok) {
const err = await res.json();
if (res.status === 429) {
// wait Retry-After seconds, then retry
}
throw new Error(`amodb ${res.status} code ${err.status_code}: ${err.status_message}`);
}res = requests.get(url, headers=headers, timeout=10)
if not res.ok:
err = res.json()
raise RuntimeError(f"amodb {res.status_code} code {err['status_code']}: {err['status_message']}")Which cases are not errors?
- An unknown
languagetag does not fail. amodb serves English for it. See language codes. - A field with no data is
nullor an empty array, as in TMDB. - A rating from IMDb, Kinopoisk, Metacritic, Rotten Tomatoes or TMDB can be
nullon the movie ratings API.