Home › Joke API › Knock Knock Jokes API

Knock Knock Jokes API

Knock knock jokes are a category of the Humor API joke API. Add include-tags=knock_knock to a joke request to get a random knock knock joke or search them by keyword. Perfect for kids' apps, voice assistants and chat bots.

Get a free API key Read the docs See pricing

Get a random knock knock joke

curl
curl "https://api.humorapi.com/jokes/random?include-tags=knock_knock&exclude-tags=nsfw,dark,sexual&api-key=YOUR_API_KEY"
JavaScript (fetch)
const res = await fetch("https://api.humorapi.com/jokes/random?include-tags=knock_knock&exclude-tags=nsfw,dark,sexual", {
  headers: { "x-api-key": process.env.HUMOR_API_KEY }
});
const data = await res.json();
console.log(data);
Python (requests)
import os, requests

res = requests.get("https://api.humorapi.com/jokes/random?include-tags=knock_knock&exclude-tags=nsfw,dark,sexual",
                   headers={"x-api-key": os.environ["HUMOR_API_KEY"]})
print(res.json())
Response format (the joke and id vary)
{
    "id": 12345,
    "joke": "Knock knock.\nWho's there?\nLettuce.\nLettuce who?\nLettuce in, it's cold out here!"
}

Jokes can contain line breaks (\n); keep them when you display the joke.

Search knock knock jokes

GET https://api.humorapi.com/jokes/search?include-tags=knock_knock&keywords=cow&number=5

Filter further with min-rating and max-length, and page through results with offset. All parameters: Search Jokes.

Use cases

Pricing

The free plan has 10 points per day (most calls cost 1 point) and needs a backlink; paid plans start at $3 per month for 100 points per day and bill extra points instead of stopping. Compare the plans.

More from Humor API

Joke API Meme API GIF Search API Insult & Praise API Nonsense Word API Chuck Norris Jokes API

Get a free API key Read the docs See pricing