Home › Joke 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
curl "https://api.humorapi.com/jokes/random?include-tags=knock_knock&exclude-tags=nsfw,dark,sexual&api-key=YOUR_API_KEY" 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); 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()) {
"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.
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.
exclude-tags for safe content.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.