API Directory › 🎉 Fun & Random › Official Joke API
No authHTTPSCORS

Official Joke API

Random setup-and-punchline jokes from a free, no-key endpoint.

Auth
No auth needed
HTTPS
Yes
CORS
Yes
Open Official Joke API docs ↗

What it does

The Official Joke API is a simple open dataset of setup/punchline jokes in a few types (general, knock-knock, programming, dad). Endpoints for a single random joke, ten at once, by type, or by id.

Base URL

https://official-joke-api.appspot.com

Authentication

None. /random_joke, /jokes/random, /jokes/ten, /jokes/{type}/random, /jokes/{id}. Reliability note: it runs on Google App Engine and has had intermittent downtime — keep a fallback.

Code examples

curl
curl -s https://official-joke-api.appspot.com/random_joke
curl -s https://official-joke-api.appspot.com/jokes/programming/random
JavaScript
const [j] = await fetch(
  "https://official-joke-api.appspot.com/jokes/programming/random"
).then(r => r.json());
console.log(`${j.setup} ... ${j.punchline}`);

Rate limits & quotas

No key or documented rate limit. /jokes/ten is the efficient call — grab ten and rotate client-side rather than hitting /random_joke repeatedly. Note /jokes/{type}/random returns an array with one element.

Key response fields

idJoke id
typegeneral, knock-knock, programming, dad
setupThe lead-in
punchlineThe payoff

Common errors

(array vs object)/random_joke returns one object; /jokes/random and /jokes/{type}/random return a one-element array.
503 / timeoutApp Engine instance cold or down — retry, then fall back to a bundled joke.
404Unknown id or type.

When to use it (and alternatives)

Fine for a lightweight joke feed where the occasional outage doesn’t matter. For filtering, safe-mode and more categories use JokeAPI; for dad jokes, icanhazdadjoke.

FAQ

Is this API reliable?

It has had periods of downtime on its free App Engine hosting. Fetch /jokes/ten, cache them, and bundle a few jokes locally as a fallback.

Why does my code get an array sometimes and an object other times?

/random_joke → object. /jokes/random and the per-type random endpoints → array of one. Normalise on your side.

Can I filter content?

Not really — the dataset is small and generally clean, but there is no safe-mode or blacklist. Use JokeAPI if you need guarantees.

New to APIs?

Short guides for working with this API — and any other.

🛠️ Handy LarzOS tools

Free tools to help you work with this API.

JSON Formatter

Related Fun & Random APIs

← Back

More Fun & Random APIs · All 196 APIs