JokeAPI
Programming and general jokes with filtering and safe-mode — no key.
What it does
JokeAPI (v2) serves programming, pun, spooky, Christmas and miscellaneous jokes, single-line or two-part (setup/delivery), with strong filtering: category selection, a blacklist for unsafe content, language, type, keyword search and safe-mode.
Base URL
Authentication
None. /joke/{Category} where Category is Any, Programming, Misc, Pun, Spooky, Christmas or Dark (comma-separated). Filter with ?blacklistFlags=, ?type=, ?safe-mode, ?contains=, ?amount=, ?lang=.
Code examples
curl -s "https://v2.jokeapi.dev/joke/Programming?type=single&safe-mode" curl -s "https://v2.jokeapi.dev/joke/Any?blacklistFlags=nsfw,racist,sexist,explicit&amount=3"
const j = await fetch(
"https://v2.jokeapi.dev/joke/Programming?safe-mode"
).then(r => r.json());
console.log(j.type === "single" ? j.joke : `${j.setup} ... ${j.delivery}`);Rate limits & quotas
120 requests/minute per IP — over that returns HTTP 429 with a Retry-After. Use ?amount=N (up to 10) to batch. Always set safe-mode or a thorough blacklistFlags list for anything user-facing.
Key response fields
| error | false on success; true with message/causedBy otherwise |
| type | single or twopart |
| joke | The joke (single type) |
| setup / delivery | The two halves (twopart type) |
| category / flags / safe / lang | Metadata — flags is an object of booleans |
Common errors
| error:true, code 106 | No joke matched your filters — loosen categories/flags. |
| 429 | Over 120/minute. |
| error:true, code 108 | The lang requested has no matching jokes. |
| (unsafe content slipped through) | Combine safe-mode with an explicit blacklistFlags list. |
When to use it (and alternatives)
The most configurable joke API — good when you need safe, category-controlled humour for a bot or app. For dad jokes specifically, icanhazdadjoke; for a simple setup/punchline feed, Official Joke API.
FAQ
How do I keep it family-friendly?
Add ?safe-mode (a curated safe subset) and blacklistFlags=nsfw,religious,political,racist,sexist,explicit. Belt and braces.
Can I get several jokes in one call?
Yes — ?amount=5 (max 10). The response then has a jokes array and an amount field.
What is the Dark category?
Edgier jokes. Exclude it (don’t list it, and use safe-mode) for general audiences; only include it deliberately.
New to APIs?
Short guides for working with this API — and any other.