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.
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.
| Credential | Looks like | Sent as | Issued by | Works on amodb |
|---|---|---|---|---|
| TMDB v3 API key | 32 hex characters | api_key query parameter | TMDB | No |
| TMDB v4 read access token | A long JWT | Authorization: Bearer header | TMDB | No |
| amodb key, TMDB style calls | 32 lowercase hex characters | api_key or Authorization: Bearer | amodb, under Account and API keys | Yes |
| amodb key, OMDb style calls | The same key | apikey query parameter | amodb | Yes |
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:/.
| Method | Example |
|---|---|
| Query parameter | ?api_key=YOUR_KEY |
| Header | Authorization: Bearer YOUR_ |
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:
| Order | Where | Note |
|---|---|---|
| 1 | api_key query parameter | Wins over everything else |
| 2 | apikey query parameter | The OMDb spelling, accepted on any path |
| 3 | Authorization: Bearer header | The 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 "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.
| Item | Value |
|---|---|
| Sign in | Enter your email and the 6 digit code amodb sends; after a payment the code arrives at the checkout email |
| Code | Valid for 10 minutes, 5 tries per code |
| Session | A fixed 6 hours from sign in |
| Keys per account | Up to 10 active keys, and up to 20 created in any 24 hours, revoked ones included |
| Payment | Card, 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
productionorstaging, 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?
| HTTP | status_code | Meaning |
|---|---|---|
| 401 | 7 | The key is missing, malformed or unknown. |
| 401 | 10 | The key is suspended. Write to support@amodb.dev. |
| 402 | 36 | Your plan has expired. Pay for a new period on the pricing page. |
| 403 | 3 | The key is valid but the plan lacks the endpoint. The all in one endpoint /3/all is Pro+ only. |
| 429 | 25 | The 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.