JokeAPI API

Beginner's Pick Games & Comics / No Auth Required Beginner HTTPS CORS
Free to Use 120 per window (119 remaining at test time)
80 A
Measured Score 0 50 100 Speed 14/30 Consistency 20/20 Security 20/20 Browser access 15/15 Transparency 11/15 TESTED 2026-08-10

Overview

JokeAPI is a free, no-auth REST API that returns programming, miscellaneous, and dark jokes in single-part or two-part formats. It supports extensive filtering options so you can exclude categories like NSFW, racist, or sexist content to keep jokes appropriate. It is one of the easiest APIs for beginners to start with since no sign-up is required.

Beginner Tip

Use the blacklistFlags parameter to exclude offensive content (e.g., ?blacklistFlags=nsfw,racist) and specify a category like Programming or Misc to get more relevant jokes.

Measurement Record

What actually happened when we called this API from our own infrastructure. Every value below was recorded by the request, not copied from the provider's documentation.

Request
GET https://v2.jokeapi.dev/joke/Programming?blacklistFlags=nsfw
Result
HTTP 200 · application/json · 387 bytes
Response time
282 ms (median of 3) · fastest 278 ms
Transport
TLSv1.3 · TLS_AES_256_GCM_SHA384 · certificate issued by Google Trust Services
Browser CORS
Allowed — Access-Control-Allow-Origin: *
Rate limit
120 per window (119 remaining at test time)
Served by
cloudflare
Recorded
2026-08-10

Fields Returned

Top-level fields present in the response we captured, with the type and value we actually received.

Field Type Value received
error boolean false
category string Programming
type string single
joke string "Knock, knock." "Who's there?" [very long pa…
flags object {6 fields}
id integer 36
safe boolean true
lang string en

Captured Response

Captured from a real request to https://v2.jokeapi.dev/joke/Programming?blacklistFlags=nsfw on 2026-08-10. Long arrays and nested objects are truncated to keep the shape readable.

JSON Response · Captured
{
  "error": false,
  "category": "Programming",
  "type": "single",
  "joke": "\"Knock, knock.\"\n\"Who's there?\"\n\n[very long pause]\n\n\"Java.\"",
  "flags": {
    "nsfw": false,
    "religious": false,
    "political": false,
    "racist": false,
    "sexist": false,
    "explicit": false
  },
  "id": 36,
  "safe": true,
  "lang": "en"
}

Field Reference

type Format of the joke: single (one field) or twopart (setup + delivery).
joke The full joke text when type is single.
category The category this joke belongs to, such as Programming or Dark.
id Unique identifier for the joke, useful for linking directly to a specific joke.

Implementation Example

Calls a real endpoint of this API. Replace any placeholder credentials with your own key.

Request
const url = "https://v2.jokeapi.dev/joke/Programming?blacklistFlags=nsfw";
const response = await fetch(url);
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

How This API Fails

We deliberately sent this API a broken request and recorded exactly what came back on 2026-08-10. Knowing the shape of an error before you hit it makes error handling much easier to write.

HTTP 400 Sending an invalid value for "blacklistFlags" application/json
{
  "error": true,
  "internalError": false,
  "code": 106,
  "message": "No matching joke found",
  "causedBy": [
    "No jokes were found that match your provided filter(s)."
  ],
  "additionalInfo": "The specified flags are invalid. Got: \"!!!invalid!!!\" - Possible flags are: \"nsfw, religious, political, racist, sexist, explicit\".",
  "timestamp": 1786391782968
}

Common Errors & Troubleshooting

Generated guidance based on this API's documentation, not observed by us. Treat it as a starting point and check against the provider's own error reference.

Error object in response An invalid category name or unknown query parameter was used.
Check valid category names (Programming, Misc, Dark, Pun, Spooky, Christmas) and valid flag names in the docs.
Joke not appropriate for audience No blacklist flags were set, allowing all content types.
Add blacklistFlags=nsfw,racist,sexist,explicit to the query string to filter out inappropriate content.
429 Too Many Requests You have exceeded the 120 requests per minute rate limit.
Cache joke responses for a few minutes and slow down the frequency of API calls.

Measured Score Breakdown

Live HTTP request to the API endpoint

Speed 14/30
Consistency 20/20
Security 20/20
Browser access 15/15
Transparency 11/15
Endpoint Response Time 282ms

Fully tested on Aug 10, 2026

Technical Specifications

Auth No Auth
HTTPS REQUIRED
CORS YES
Category Games & Comics
Difficulty Beginner
Endpoint last called: 2026-08-10

Related Tags

Recipes Using JokeAPI

Build something with this API. Each recipe includes step-by-step instructions and code outlines.

Similar APIs

View All →