TMDB API example: your first request in 2 minutes
This TMDB API example sends one request in 2 minutes: GET https://api.amodb.dev/3/movie/550 with your key as a Bearer token. The reply is TMDB v3 JSON with title, runtime 139 and poster_path. Then build the poster URL on img.amodb.dev. To move a TMDB or OMDb client, change only the base URL and the key.
A first request takes 5 steps and about 2 minutes. You need an amodb key and any HTTP client. The call GET /3/movie/550 counts as 1 request toward your rate and returns the TMDB v3 JSON for Fight Club: title, runtime 139 and poster_path. Loading the poster from img.amodb.dev counts as 0 requests, because images need no key.
What do I need before the first request?
| Need | Detail |
|---|---|
| An email address | You enter it at checkout, with no account first. After the payment amodb emails a 6 digit sign in code to it, valid for 10 minutes with 5 tries. Later sign ins use the same email and code. |
| A plan | Lite, Pro or Pro+ from $5.19 a month. Card, Apple Pay and Google Pay payments are prepaid for 1 to 24 months and do not renew automatically. Patreon is monthly. |
| A key | 32 lowercase hex characters. The first one is created when you first sign in; more are made under API keys. |
| An HTTP client | curl, fetch, requests, PHP cURL or Go net/http. The samples below use all five. |
1. Get a key
Pick a plan on the pricing page, enter your email and pay for a period. You do not need an account first. 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. The payment page itself shows no key. A key is 32 lowercase hex characters, the same shape as a TMDB v3 key.
The full key is shown once. Store it as an environment variable named AMODB_KEY so the samples on this page work as written.
export AMODB_KEY="0123456789abcdef0123456789abcdef"2. Request movie details
Call GET /. Send the key as a Bearer token or as api_key in the query. Both are accepted on every endpoint.
curl "https://api.amodb.dev/3/movie/550?language=en-US" \
-H "Authorization: Bearer $AMODB_KEY"const res = await fetch("https://api.amodb.dev/3/movie/550?language=en-US", {
headers: { Authorization: `Bearer ${process.env.AMODB_KEY}` },
});
if (!res.ok) throw new Error(`amodb ${res.status}`);
const movie = await res.json();
console.log(movie.title, movie.runtime);import os
import requests
res = requests.get(
"https://api.amodb.dev/3/movie/550",
params={"language": "en-US"},
headers={"Authorization": f"Bearer {os.environ['AMODB_KEY']}"},
timeout=10,
)
res.raise_for_status()
movie = res.json()
print(movie["title"], movie["runtime"])<?php
$ch = curl_init("https://api.amodb.dev/3/movie/550?language=en-US");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Bearer " . getenv("AMODB_KEY")],
]);
$movie = json_decode(curl_exec($ch), true);
echo $movie["title"] . " " . $movie["runtime"];package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"os"
)
func main() {
req, _ := http.NewRequest("GET", "https://api.amodb.dev/3/movie/550?language=en-US", nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("AMODB_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer res.Body.Close()
var movie struct {
Title string `json:"title"`
Runtime int `json:"runtime"`
}
json.NewDecoder(res.Body).Decode(&movie)
fmt.Println(movie.Title, movie.Runtime)
}A 200 response has the TMDB v3 fields. A short part of it:
{
"id": 550,
"imdb_id": "tt0137523",
"title": "Fight Club",
"release_date": "1999-10-15",
"runtime": 139,
"poster_path": "/pB8BM7pdSp6B6Ih7QZ4DrQ3PmJK.jpg"
}3. Load the poster
Join the image base URL, a size and poster_path. Images need no key and stay cached for 30 days.
See images for every size and for building URLs from /3/configuration.
curl -o poster.jpg "https://img.amodb.dev/t/p/w500/pB8BM7pdSp6B6Ih7QZ4DrQ3PmJK.jpg"const poster = `https://img.amodb.dev/t/p/w500${movie.poster_path}`;poster = f"https://img.amodb.dev/t/p/w500{movie['poster_path']}"4. Move an existing client
For a TMDB v3 client, change the base URL from https:/ to https:/ and use your amodb key. The rest of the call stays the same.
For an OMDb client, change it to https:/ and pass the same key as apikey.
Account, session, rating and list write methods of TMDB are not offered. They return HTTP 405 with status_code 37, so a read only client needs no other change.
# before
curl "https://api.themoviedb.org/3/movie/550?api_key=$TMDB_KEY"
# after
curl "https://api.amodb.dev/3/movie/550?api_key=$AMODB_KEY"5. Handle limits and errors
Your account has one rate per minute, set by its plan and shared by all its keys. Read X-RateLimit-Remaining and wait for Retry-After seconds after a 429. Errors use the TMDB body with success, status_code and status_message.
Read rate limits and errors before you go to production.
What does each call cost in requests?
Each HTTP call to a keyed path counts as 1 request in your sliding 60 second window, whether the answer comes from the edge cache or not. Lite allows 20 requests per minute, Pro 40 and Pro+ 120, so the first request on this page uses 1 of the 20 to 120 your plan allows in that minute.
| Call | What it returns | Requests counted |
|---|---|---|
GET /3/movie/550 | Fight Club details (step 2) | 1 |
GET / | Details, credits and ratings in one reply | 1 |
GET / | A page of matching movies | 1 |
GET /3/configuration | Image base URLs and size lists | 1 |
GET / | OMDb style details | 1 |
https:/ | A poster or backdrop | 0 |
GET /plans | The public plan catalog, no key | 0 |
Why does my first request fail?
| What you see | Likely cause | Fix |
|---|---|---|
401, status_code 7 | Key missing, cut short or from another service | Paste all 32 characters of the amodb key |
401, status_code 10 | Key suspended | Write to support@amodb.dev |
402, status_code 36 | Plan expired | Pay for a new period on amodb pricing |
404, status_code 34 | Wrong id or path | Check the id; some TMDB paths are not offered |
429, status_code 25 | Over your plan's rate | Wait Retry-After seconds |
| No answer at all | Network or DNS problem | Open https:/, which needs no key |
See error codes for every status and authentication for the three ways to send the key.
What should I build after the first request?
Pick the call you need next from the API reference: movie details API, TMDB search API or the movie ratings API. For a full walk through in your language, read the TMDB API in Python, TMDB API in JavaScript, TMDB API in PHP or TMDB API in Go tutorial, or browse all tutorials.