{
  "openapi": "3.1.0",
  "info": {
    "title": "Jokes API",
    "version": "1.0.0",
    "description": "252 original, clean jokes in 12 categories, random, searchable and safe for any audience.\n\n252 original, clean jokes — single-liners and two-part setup/punchline — across 12 categories: dad, pun, programming, general, animal, food, science, work, school, music, sports and space. Pull random jokes (up to 20 at once), full-text search the whole set, filter by category or type, page through everything, or fetch a joke by id. Every joke is written for this API and SFW (safe: true), so it is drop-in ready for apps, chatbots, dashboards, Slack bots and games aimed at any audience.",
    "contact": {
      "name": "Data and APIs",
      "url": "https://dataandapis.com/contact"
    },
    "termsOfService": "https://dataandapis.com/terms-of-service",
    "license": {
      "name": "Data and APIs Terms of Service",
      "url": "https://dataandapis.com/terms-of-service"
    },
    "x-logo": {
      "url": "https://dataandapis.com/images/jokes.webp"
    }
  },
  "externalDocs": {
    "description": "Documentation, live tester and pricing",
    "url": "https://dataandapis.com/apis/jokes"
  },
  "servers": [
    {
      "url": "https://api-jokes.dataandapis.com"
    }
  ],
  "tags": [
    {
      "name": "Entertainment",
      "description": "Jokes API belongs to the Entertainment category of the Data and APIs catalog."
    }
  ],
  "paths": {
    "/v1/jokes/{id}": {
      "get": {
        "operationId": "getJoke",
        "summary": "Get Joke",
        "description": "Get Joke endpoint of the Jokes API. Costs 1 token per call.",
        "externalDocs": {
          "url": "https://dataandapis.com/apis/jokes/get-joke"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "1"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "ok": true,
                  "id": 96,
                  "type": "single",
                  "category": "programming",
                  "joke": "A byte walks into a bar looking miserable. The bartender asks what's wrong. 'Parity error.' 'Yeah, you look a bit off.'",
                  "safe": true
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Subscription past due; the response carries a payment_url"
          },
          "429": {
            "description": "Monthly token allowance exhausted"
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ]
      }
    },
    "/v1/jokes/categories": {
      "get": {
        "operationId": "listCategories",
        "summary": "List Categories",
        "description": "List Categories endpoint of the Jokes API. Costs 1 token per call.",
        "externalDocs": {
          "url": "https://dataandapis.com/apis/jokes/list-categories"
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "ok": true,
                  "count": 12,
                  "total_jokes": 252,
                  "categories": [
                    {
                      "name": "animal",
                      "jokes": 21
                    },
                    {
                      "name": "dad",
                      "jokes": 32
                    },
                    {
                      "name": "food",
                      "jokes": 20
                    },
                    {
                      "name": "general",
                      "jokes": 31
                    },
                    {
                      "name": "music",
                      "jokes": 12
                    },
                    {
                      "name": "programming",
                      "jokes": 38
                    },
                    {
                      "name": "pun",
                      "jokes": 31
                    },
                    {
                      "name": "school",
                      "jokes": 12
                    },
                    {
                      "name": "science",
                      "jokes": 16
                    },
                    {
                      "name": "space",
                      "jokes": 12
                    },
                    {
                      "name": "sports",
                      "jokes": 12
                    },
                    {
                      "name": "work",
                      "jokes": 15
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Subscription past due; the response carries a payment_url"
          },
          "429": {
            "description": "Monthly token allowance exhausted"
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ]
      }
    },
    "/v1/jokes": {
      "get": {
        "operationId": "listJokes",
        "summary": "List Jokes",
        "description": "List Jokes endpoint of the Jokes API. Costs 1 token per call.",
        "externalDocs": {
          "url": "https://dataandapis.com/apis/jokes/list-jokes"
        },
        "parameters": [
          {
            "name": "category",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "programming"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "20"
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "1"
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "cheese"
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "single"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "ok": true,
                  "total": 38,
                  "page": 1,
                  "limit": 2,
                  "count": 2,
                  "results": [
                    {
                      "id": 21,
                      "type": "twopart",
                      "category": "programming",
                      "setup": "Why do programmers prefer dark mode?",
                      "delivery": "Because light attracts bugs.",
                      "safe": true
                    },
                    {
                      "id": 22,
                      "type": "single",
                      "category": "programming",
                      "joke": "There are 10 kinds of people: those who understand binary and those who don't.",
                      "safe": true
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Subscription past due; the response carries a payment_url"
          },
          "429": {
            "description": "Monthly token allowance exhausted"
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ]
      }
    },
    "/v1/jokes/random": {
      "get": {
        "operationId": "randomJoke",
        "summary": "Random Joke",
        "description": "Random Joke endpoint of the Jokes API. Costs 1 token per call.",
        "externalDocs": {
          "url": "https://dataandapis.com/apis/jokes/random-joke"
        },
        "parameters": [
          {
            "name": "amount",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "1"
          },
          {
            "name": "category",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "dad"
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "twopart"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "ok": true,
                  "count": 1,
                  "results": [
                    {
                      "id": 241,
                      "type": "twopart",
                      "category": "space",
                      "setup": "How do you organize a space party?",
                      "delivery": "You planet.",
                      "safe": true
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Subscription past due; the response carries a payment_url"
          },
          "429": {
            "description": "Monthly token allowance exhausted"
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Api-Key",
        "description": "Create a free key at https://dataandapis.com/sign-up. 500 tokens a month on the Free plan; this API costs 1 token per call."
      }
    }
  },
  "security": [
    {
      "ApiKey": []
    }
  ]
}