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.

Updated View as Markdown

When an amodb call fails, read the HTTP status first and then status_code in the body. Every error on https://api.amodb.dev/3 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://api.amodb.dev/3 has the same JSON shape as TMDB:

JSON
{
  "success": false,
  "status_code": 34,
  "status_message": "The resource you requested could not be found."
}

Which TMDB API error codes does amodb return?

HTTPstatus_codestatus_messageRetry?What to do
40022Invalid page: Pages start at 1 and max at 500. They are expected to be an integer.NoSend page as an integer from 1 to 500.
4017Invalid API key: You must be granted a valid key.NoCheck the key and how you send it.
40110Suspended API key: Access to your account has been suspended, contact amodb.NoWrite to support@amodb.dev.
40236Your plan has expired. Renew at https://amodb.dev/pricing/NoPay for a new period.
4033The all in one endpoint is available on the Pro+ plan. See https://amodb.dev/pricing/NoMove to Pro+, or call the standard endpoints.
40434The resource you requested could not be found.NoCheck the id or path.
40537This method is not offered by amodb.NoUse a read endpoint.
42925Your request count (N) is over the allowed limit of (L).YesWait for Retry-After seconds.
50011Internal error: Something went wrong, contact amodb.YesRetry after a few seconds.
50424Your request to the backend server timed out. Try again.YesRetry after a few seconds.

The 403 comes from GET /3/all/{movie|tv|person}/{id}, 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 seeLikely causeFix
401, status_code 7, key from TMDBA TMDB API key or read access token is not an amodb keyCreate an amodb key under Account and API keys
401, status_code 7, key from amodbThe key was cut short, has a stray character or was deletedPaste all 32 hex characters; create a new key if you lost it
401, status_code 7, key looks rightA second key in the request wins: api_key beats apikey, which beats the Bearer headerRemove the stale parameter
401, status_code 10The key is suspendedWrite to support@amodb.dev
402, status_code 36The plan period ended; card payments are prepaid and do not renewPay for a new period on amodb pricing
403, status_code 3The path needs Pro+Use Pro+ or the standard endpoints
429, status_code 25The key is over its requests per minuteWait for Retry-After seconds
No answer, or a timeoutNetwork or DNS problem on your sideOpen https://api.amodb.dev/plans, 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?

ClassExamplesRetry?Wait
Your request is wrong400, 404, 405NoFix the request first
Your key or plan is wrong401, 402, 403NoFix the key or the plan first
Rate limit429YesRetry-After seconds, the same number as X-RateLimit-Reset
Our side500, 504Yes1, 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.

HTTPError textCause
401No API key provided.No apikey in the request
401Invalid API key!The key is malformed or unknown
402Your plan has expired. Renew at https://amodb.dev/pricing/The plan period ended
429Request limit reached!Over your requests per minute
400Only r=json is supported.The call asked for r=xml
400Incorrect request.A parameter is wrong

The OMDb API documentation lists the parameters.

JSON
{
  "Response": "False",
  "Error": "Movie not found!"
}
jspy
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 language tag does not fail. amodb serves English for it. See language codes.
  • A field with no data is null or an empty array, as in TMDB.
  • A rating from IMDb, Kinopoisk, Metacritic, Rotten Tomatoes or TMDB can be null on the movie ratings API.

Questions and answers

Why is my TMDB API key not working?

Most often the key is not an amodb key, was cut short, or a second key in the request overrides it. A 401 with status_code 7 means the key is missing, malformed or unknown. Check for 32 hex characters and the base URL https://api.amodb.dev/3. A TMDB key does not work on amodb.

What does TMDB API error 401 mean?

A 401 means the key check failed. status_code 7 is a missing, malformed or unknown key, and status_code 10 is a suspended key. Both return the TMDB body with success false. Fix the key, or write to support@amodb.dev about a suspension. Do not retry the same call.

Which errors should my client retry?

Retry 429 after Retry-After seconds, and 500 or 504 with a backoff of a few seconds, for example 1, 2 and 4 seconds. Do not retry 400, 401, 402, 403, 404 or 405: the same call fails again until you change the request or the plan.

Why do I get 405 for a TMDB endpoint?

amodb does not offer TMDB account, session, rating and list write methods. They return 405 with status_code 37. All TMDB v3 read endpoints work, so a client that only reads movie and TV data needs no other change.

What does status_code 34 mean?

It means HTTP 404: the resource was not found. Either the id is wrong or the path is not offered. The aggregate_credits and changes endpoints and person translations always return 404 with status_code 34. Check the id and the path before you retry.

How do I fix a 429 rate limit error?

Wait for the Retry-After seconds, then send the call again. Lite allows 20 requests per minute, Pro 40 and Pro+ 120, counted per account in one sliding 60 second window shared by all its keys. Cached replies still count. Read X-RateLimit-Remaining to slow down before the limit.