Joke Search API

The Joke Search API finds jokes that contain the words you give it. Pass a comma-separated list in keywords, for example horse,man, and you get jokes in which all of these words occur. With over 50,000 jokes, you should find something for any occasion. Keywords are optional, so you can also search by tag alone.

The response has a jokes list with the text of each joke and available, the number of jokes that match. Use number to get 1 to 10 jokes per call and offset (0 to 1000) to page through the rest. You can also filter by tag with include-tags and exclude-tags, and by rating with min-rating.

Each search costs 1 token. This jokes API works with the same API key as every other API League API, and the free plan includes 50 tokens a day. Typical uses are jokes on a topic for a chatbot or greeting card, a search box in a joke app, or a list of clean jokes for kids.

This API wraps the search jokes endpoint by Humor API. Check out the tutorial about writing a joke and meme app using this API.

Joke tags

If you want to filter the jokes using include-tags or exclude-tags you can use one or more of the following:

  • animal
  • clean
  • one_liner
  • food
  • sexual
  • relationship
  • religious
  • racist
  • sport
  • kids
  • holiday
  • knock_knock
  • nerdy
  • law
  • political
  • q_a
  • school
  • christmas
  • chuck_norris
  • dark
  • nsfw
  • analogy
  • jewish
  • yo_mama
  • sexist
  • blondes
  • deep_thoughts
  • insults
  • animal
  • clean
  • one_liner
  • food
  • sexual
  • relationship
  • religious
  • racist
  • sport
  • kids
  • holiday
  • knock_knock
  • nerdy
  • law
  • political
  • q_a
  • school
  • christmas
  • chuck_norris
  • dark
  • nsfw
  • analogy
  • jewish
  • yo_mama
  • sexist
  • blondes
  • deep_thoughts
  • insults
GET
https://api.apileague.com/search-jokes

Parameters

NameExampleDescription
keywords
s o q
horse,manA comma-separated list of words that must occur in the joke.
include-tags
s o q
animalA comma-separated list of tags the jokes should have.
exclude-tags
s o q
nsfw,darkA comma-separated list of tags the jokes must not have.
min-rating
n o q
0The minimum rating in range [0.0,1.0] of the jokes.
max-length
n o q
140The maximum length of the joke in letters.
offset
n o q
0The number of jokes to skip, between 0 and 1000.
number
n o q
3The number of jokes, between 1 and 10.
api-key
s r q
abcd1234Your API key.
Example Request and Response
GET
https://api.apileague.com/search-jokes?keywords=horse,man&number=3
{
    "jokes": [
        {
            "joke": "A retiring farmer in preparation for selling his land, needed to rid his farm of animals. So he went to every house in his town. \nTo the houses where the man is the boss, he gave a horse. To the houses where the woman is the boss, a chicken was given. \nHe got toward the end of the street and saw a couple outside gardening. \"Who's the boss around here?\" he asked. \n\"I am.\" said the man. \n\"I have a black horse and a brown horse,\" the farmer said, \"which one would you like?\" \nThe man thought for a minute and said, \"The black one.\" \n\"No, no, no, get the brown one.\" the man's wife said. \n\"Here's your chicken.\" said the farmer."
        },
        {
            "joke": "A blonde decides to try horseback riding, even though she has had no\r\nlessons or prior experience. She mounts the horse unassisted and then\r\nhorse immediately springs into motion. It gallops along at a steady and\r\nrhythmic pace, but the blonde begins to slip from the\r\nsaddle. In terror, she grabs for the horse's mane, but cannot seem to get\r\na firm grip.\r\nShe tries to throw her arms around the horse's neck, but she slides down\r\nthe side of the horse anyway. The horse gallops along, seemingly\r\nimpervious to its slipping rider. Finally, giving up her frail grip, she\r\nleaps away from the horse to try and throw herself to safety.\r\nUnfortunately, her foot has become entangled in the stirrup and she is now\r\nat the mercy of the horse's pounding hooves as her head is battered\r\nagainst the ground again and again. She is mere moments away from\r\nunconsciousness when...\r\n ...the Wal-Mart manager runs out to shut the horse off."
        },
        {
            "joke": "Once Chuck Norris met a man on a horse that he did'nt like, now we know him as the headless horseman."
        }
    ],
    "available": 169
}
 Copy Codecurl -X GET 'https://api.apileague.com/search-jokes?keywords=horse,man&number=3' \ -H 'x-api-key: myapikey'

Headers

Response Headers:

  • Content-Type: application/json
  • X-API-Quota-Request: The number of tokens used by the request
  • X-API-Quota-Used: The number of tokens used in total today
  • X-API-Quota-Left: The number of tokens left today (depends on your plan)

Frequently Asked Questions

Is there a free jokes API?

Yes. The API League free plan includes 50 tokens a day at no cost. A joke search costs 1 token and returns up to 10 jokes. The free plan is for non-commercial use and requires a backlink to apileague.com.

Can I search for jokes by keyword?

Yes. Put one or more comma-separated words in the keywords parameter and only jokes that contain all of them are returned.

Which joke categories are there?

Jokes are tagged with categories ranging from "clean" and "kids" to "dark" and "nsfw", including "nerdy", "knock_knock" and "one_liner". All tags are listed on this page.

Can I exclude offensive jokes?

Yes. Use the exclude-tags parameter to filter out categories like "nsfw", "racist", "sexist" or "religious" so the jokes fit your audience.

How do I get more than 10 jokes?

Each call returns up to 10 jokes. Use offset to skip the jokes you already have, up to an offset of 1000. The available field tells you how many jokes match.

How is the Search Jokes API different from the Random Joke API?

The Search Jokes API allows you to search for specific jokes using keywords, while the Random Joke API returns a single random joke, potentially filtered by tags.

Questions? Need Help? Ask Away

Quotas

Calling this endpoint costs
1 token