TMDB read access token vs API key: amodb authentication

TMDB read access token vs API key: TMDB issues two credentials, a v3 API key and a v4 token, while amodb needs one 32 hex key. Send it as api_key, as an Authorization Bearer header, or as apikey on OMDb calls. Images need no key. A wrong key returns 401 with status_code 7.

Updated View as Markdown

amodb takes one credential: a 32 lowercase hex key. Send it as api_key in the query, as an Authorization: Bearer header, or as apikey on OMDb style calls. There is no second token to manage, so the TMDB choice between a read access token and an API key does not come up. Images need no key.

What is the difference between a TMDB read access token and an API key?

On TMDB, each app gets two credentials. The v3 API key is a 32 character hex string sent as the api_key query parameter. The v4 API read access token is a much longer JWT sent as an Authorization: Bearer header, and TMDB accepts it on its v3 read endpoints too. Both identify the same app, and the token lets you keep the credential out of the URL. Check TMDB's site for its current rules.

amodb folds both into one key. It is 32 lowercase hex characters, the same shape as a TMDB v3 key, and it goes wherever your TMDB credential went. The TMDB API key page shows how to get one in four steps.

CredentialLooks likeSent asIssued byWorks on amodb
TMDB v3 API key32 hex charactersapi_key query parameterTMDBNo
TMDB v4 read access tokenA long JWTAuthorization: Bearer headerTMDBNo
amodb key, TMDB style calls32 lowercase hex charactersapi_key or Authorization: Beareramodb, under Account and API keysYes
amodb key, OMDb style callsThe same keyapikey query parameteramodbYes

What does an amodb key look like?

A key is 32 lowercase hex characters, for example 0123456789abcdef0123456789abcdef. It has the same shape as a TMDB v3 key, so fields and validators built for TMDB keys accept it.

amodb trims spaces and lowercases the value before it checks it, so letter case does not matter. A value that is not 32 hex characters returns 401 with status_code 7, as does a key amodb does not know.

amodb stores only a SHA-256 hash of each key. The full key is shown once, when you create it. If you lose it, delete it and create a new one.

How do I send the key on TMDB style calls?

Send the key in one of two ways. Both work on every endpoint under https://api.amodb.dev/3.

MethodExample
Query parameter?api_key=YOUR_KEY
HeaderAuthorization: Bearer YOUR_KEY
bashjspyphpgo
curl "https://api.amodb.dev/3/configuration" \
  -H "Authorization: Bearer $AMODB_KEY"
const res = await fetch("https://api.amodb.dev/3/configuration", {
  headers: { Authorization: `Bearer ${process.env.AMODB_KEY}` },
});
import os
import requests

res = requests.get(
    "https://api.amodb.dev/3/configuration",
    headers={"Authorization": f"Bearer {os.environ['AMODB_KEY']}"},
    timeout=10,
)
<?php
$url = "https://api.amodb.dev/3/configuration?api_key=" . urlencode(getenv("AMODB_KEY"));
$config = json_decode(file_get_contents($url), true);
req, _ := http.NewRequest("GET", "https://api.amodb.dev/3/configuration", nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("AMODB_KEY"))
res, err := http.DefaultClient.Do(req)

Which key wins when a request carries more than one?

amodb reads the key from the first place that holds one, in this order:

OrderWhereNote
1api_key query parameterWins over everything else
2apikey query parameterThe OMDb spelling, accepted on any path
3Authorization: Bearer headerThe scheme word is not case sensitive

A forgotten api_key=old in a URL beats a correct header and gives 401 with status_code 7. When a call fails with a key you know is valid, look for a second one in the request.

How do I send the key on OMDb style calls?

The OMDb compatible endpoint takes the key as apikey, as OMDb does. It is the same key you use for TMDB style calls.

The OMDb API documentation lists every parameter.

curl
curl "https://api.amodb.dev/omdb/?t=Inception&y=2010&apikey=$AMODB_KEY"

Do images need a key?

No. Image URLs on img.amodb.dev are public. Do not add your key to them: an <img> tag would expose it to every visitor.

How do I get, rotate and delete a key?

You can buy without an account: pick a plan, enter your email and pay. After the payment is confirmed, amodb emails a 6 digit sign in code to that address. Sign in with it, and the keys page creates your first key and shows it once. Later sign ins use the same email and code flow.

ItemValue
Sign inEnter your email and the 6 digit code amodb sends; after a payment the code arrives at the checkout email
CodeValid for 10 minutes, 5 tries per code
SessionA fixed 6 hours from sign in
Keys per accountUp to 10 active keys, and up to 20 created in any 24 hours, revoked ones included
PaymentCard, Apple Pay or Google Pay with only an email, prepaid, no automatic renewal; or Patreon, monthly, renewed on Patreon until you cancel there

To rotate a key without downtime: create a new key with a label, deploy it, check that calls succeed, then delete the old one. Calls with a deleted key fail at once. A new key does not reset the rate window, because the window belongs to the account. See amodb pricing for the plans a key runs on.

Where do I keep the key?

A key in a browser bundle, a mobile app or a public repository is public. Anyone who copies it spends the request rate of your whole account. Call amodb from your server, a serverless function or a build step, and pass only the data to clients.

  • Store the key in an environment variable or a secret manager.
  • Use one key per app or environment, with a label such as production or staging, so you can revoke one without touching the others.
  • Delete a key the moment it leaks. Calls with it fail at once.

The acceptable use policy bars sharing keys and putting them in client side code. All keys of an account count against one shared window, at the rate on the rate limits page, so a new key adds no requests. The quickstart shows a first call with a new key.

Why does my key return an error?

HTTPstatus_codeMeaning
4017The key is missing, malformed or unknown.
40110The key is suspended. Write to support@amodb.dev.
40236Your plan has expired. Pay for a new period on the pricing page.
4033The key is valid but the plan lacks the endpoint. The all in one endpoint /3/all is Pro+ only.
42925The key is over its requests per minute. Wait for Retry-After seconds.

See error codes for every code and the checklist for a TMDB API key that is not working.

Questions and answers

What is the difference between a TMDB read access token and an API key?

TMDB's v3 API key is a 32 character hex string sent as api_key. Its v4 read access token is a long JWT sent as a Bearer header. amodb has no second token: one 32 lowercase hex key goes in api_key, in a Bearer header, or in apikey on OMDb calls.

Does a TMDB read access token or API key work on amodb?

No. A TMDB credential is issued by TMDB, and amodb checks only its own keys. A TMDB token or key sent to https://api.amodb.dev/3 returns 401 with status_code 7. Use an amodb key instead: the first one is created when you first sign in after paying, and more are made under Account and API keys.

Which wins if I send both api_key and a Bearer header?

The query parameter wins. amodb reads api_key first, then apikey, then the Authorization header. A stale api_key left in the URL therefore overrides a correct Bearer header and returns 401 with status_code 7. Remove the old parameter.

Is a Bearer header safer than api_key in the query?

Yes, a little. Query strings end up in server logs and browser history more often than headers. Both reach the same check, so use the header where your client allows it. Neither belongs in client side code.

How many keys can I create?

Up to 10 active keys per account, and up to 20 new keys in any 24 hours, revoked ones included. All keys share one 60 second window at the rate of your plan, 20, 40 or 120 requests per minute, so more keys never add requests. Use one key per app or environment so you can revoke one without touching the others.

What happens to my keys when I change plans?

Nothing you need to do. Every active key is rewritten with the new plan once the payment is confirmed, and the account's new rate covers all of them, so the same key keeps working. The key string does not change.