TL;DR
JokeAPI (v2) delivers jokes across six categories — Programming, Miscellaneous, Dark, Pun, Spooky, and Christmas — in either single-line or two-part (setup/delivery) format. You can filter out NSFW, religious, political, racist, sexist, or explicit content using the blacklist flags. The API is particularly popular among developer dashboards and Discord bots for its straightforward JSON responses and reliable uptime.
Quick start: https://v2.jokeapi.dev/joke/Programming?type=single
No API key needed — just make a request!
How to Use This API
1. Get a Random Programming Joke
https://v2.jokeapi.dev/joke/Programming
2. Multi-Category with Blacklist
Get safe jokes from Programming or Miscellaneous, excluding NSFW content:
https://v2.jokeapi.dev/joke/Programming,Miscellaneous?blacklistFlags=nsfw
3. Two-Part Joke Format
https://v2.jokeapi.dev/joke/Any?type=twopart
4. JavaScript — Random Safe Joke
fetch('https://v2.jokeapi.dev/joke/Programming?blacklistFlags=nsfw,racist,sexist')
.then(r => r.json())
.then(j => {
if (j.type === 'single') console.log(j.joke);
else console.log(j.setup + '\n' + j.delivery);
});
5. Python — Get Multiple Jokes
import requests
for _ in range(5):
resp = requests.get('https://v2.jokeapi.dev/joke/Dark', params={
'type': 'twopart'
})
j = resp.json()
print(f"{j['setup']} — {j['delivery']}\n")
https://v2.jokeapi.dev/joke/Programming?type=single
API Details
- API URL
https://v2.jokeapi.dev/joke- Documentation
- jokeapi.dev
- Category
- Fun
- Authentication
- Not Required
- Geographic Coverage
- Global
Frequently Asked Questions
- What categories are available?
- Programming, Miscellaneous, Dark, Pun, Spooky, and Christmas. Use
Anyto pick from all categories randomly. - How do I get a two-part joke (setup + punchline)?
- Add
?type=twopartto get a setup/delivery pair, or?type=singlefor a one-liner. - Can I filter out offensive content?
- Yes, use
blacklistFlags=nsfw,religious,political,racist,sexist,explicitto exclude any combination of these. - Can I request multiple categories at once?
- Yes, separate category names with commas:
/joke/Programming,Misc,Punpicks randomly from those three. - What format are the responses in?
- All responses are in JSON. Includes
error,category,type,jokeorsetup/delivery,flags,safe,id, andlang. - Is the API free for commercial use?
- Yes, JokeAPI is free for any use. No attribution required but appreciated.
What You Can Build
- Developer dashboard with a daily programming joke widget
- Discord or Slack bot that tells jokes on command
- Mood-booster app with safe-for-work humor
- Programming conference slides with relevant jokes
- Comedy writing tool with categorized joke inspiration