Welcome to this Joke API! This website is pretty simple, and it gives a
pretty good idea on what the API does. You can try out the API by using
JokeAPI is an API that serves random and generated jokes. It is great for adding a dash of humor to your application or website easily. I curated a list of only the best programming jokes to save you the hassle of finding them yourself. You can also generate your own jokes using the API, allowing your users to have a good time. The API is really fast and easy to use. Just make a request to the API and you will get a random joke in JSON format.
The documentation for the API is below.
View the source code here.
Generate unique jokes with the power of large language models. Every time, you'll get a new joke. You can also specify a prompt to generate jokes related to that topic. Try it out now!
Try it out 🪄The joke of the day shows a new joke each day. The joke will remain for the day.
Q: Why do Java developers wear glasses?
A: Because they don't see sharp.
Note that all examples below use the joke above inside of them. However, the API will return a random joke every time.
You do not have to use
Parameters: None
Returns a random joke in JSON format. The user agent is checked and if the request is from a browser, it will return this HTML page.
Example usage:
curl https://jokeapi.adamxu.net/
Returns:
{'q': 'Why did the developer go to therapy?', 'a': 'Because he had too many unresolved issues.', 'tags': ['programming', 'therapy', 'pun']}
Parameters: number (optional)
Returns a list of random jokes in JSON format. If number is not given, returns all jokes.
Example usage:
curl https://jokeapi.adamxu.net/puns?number=3'
Returns:
[{'q': 'Why did the programmer go broke?', 'a': 'Because he used up all his cache.', 'tags': ['programming', 'money', 'pun']}, {'q': 'Why do pirates prefer programming in Python?', 'a': "Because they love the 'arg-uments'!", 'tags': ['programming', 'pirates', 'pun']}, {'q': 'Why was the computer cold?', 'a': 'It left its Windows open.', 'tags': ['windows', 'computers', 'pun']}]
Parameters: date (optional)
Returns a random joke in JSON format. If date is given, it fetches the joke of the day for that date. If date is not given, it fetches the joke of the day for today.
Example usage:
curl -X GET http://127.0.0.1:8080/joke-of-the-day?date=
Returns:
{'q': 'Why do Java developers wear glasses?', 'a': "Because they don't see sharp.", 'tags': ['programming', 'Java', 'pun']}
Parameters: prompt (optional)
Returns a random joke in plain text. If prompt is given, it generates a joke relating to the prompt. If prompt is not given, it generates a random programming related joke.
The model used is Llama3.2-7b-instant by Meta, which is hosted on Groq. Generation is really fast (usually <100 ms but sometimes a bit more).
Example usage:
curl https://jokeapi.adamxu.net/generate-joke?prompt=programming
Returns:
Q: Why did the developer go to therapy?
A: Because he had too many unresolved issues.
Your joke will appear here.
Parameters: prompt (optional)
Returns a random joke in JSON format. If prompt is given, it generates a joke relating to the prompt. If prompt is not given, it generates a random programming related joke.
Example usage:
curl -X POST https://jokeapi.adamxu.net/generate-joke -H "Content-Type: application/json" -d '{"prompt": "something goes here"}'
Returns:
{"q": "Since generating jokes costs money, you will need to copy and paste the above into your terminal to see an actual result.", "a": "Sorry for any inconvenience.", "tags": ["money", "cost", "copy","paste"]}
Parameters: query, limit (optional)
Returns a list of jokes in JSON format that contain the query. If limit is given, it returns at most limit jokes. If limit is not given, it returns at most 10 jokes.
Example usage:
curl -X POST https://jokeapi.adamxu.net/search-jokes -H "Content-Type: application/json" -d '{"query": "something goes here", "limit": 3}'
Returns:
[{'q': 'Why did the programmer go broke?', 'a': 'Because he used up all his cache.', 'tags': ['programming', 'money', 'pun']}, {'q': 'Why do pirates prefer programming in Python?', 'a': "Because they love the 'arg-uments'!", 'tags': ['programming', 'pirates', 'pun']}, {'q': 'Why was the computer cold?', 'a': 'It left its Windows open.', 'tags': ['windows', 'computers', 'pun']}]
Parameters: tag
Returns a list of jokes in JSON format that contain the tag.
Example usage:
curl -X POST https://jokeapi.adamxu.net/get-jokes-by-tag -H "Content-Type: application/json" -d '{"tag": "programming"}'
Returns:
[{'q': 'Why did the programmer go broke?', 'a': 'Because he used up all his cache.', 'tags': ['programming', 'money', 'pun']}, {'q': 'Why do pirates prefer programming in Python?', 'a': "Because they love the 'arg-uments'!", 'tags': ['programming', 'pirates', 'pun']}, {'q': 'Why was the computer cold?', 'a': 'It left its Windows open.', 'tags': ['windows', 'computers', 'pun']}]
Read a list of all jokes here.