BYTETOOLS

icanhazdadjoke API

Free dad joke API with no key. Returns jokes as JSON, plain text or image depending on the Accept header. Search supported. Tested curl example included.

No API key requiredCORS enabledHTTPSFree tier

Endpoint tested and returned HTTP 200 on 19 Aug 2026

What is the icanhazdadjoke API?

icanhazdadjoke is a free dad joke API requiring no API key. It returns a random joke, and uniquely uses the HTTP Accept header to decide whether to respond with JSON, plain text or an image.

icanhazdadjoke is the clearest real-world example of HTTP content negotiation you will find in a free API. The same URL returns HTML in a browser, plain text to a bare curl call, and JSON when you send `Accept: application/json` — one endpoint, three representations.

That makes it genuinely useful for teaching, because it demonstrates that the Accept header is a real mechanism and not just boilerplate. The API also asks that you send a User-Agent identifying your app, which is a reasonable courtesy worth honouring.

Quick facts

Base URL
https://icanhazdadjoke.com
Authentication
No key. The maintainer asks that you send a descriptive User-Agent with a contact URL.
Rate limit
No published limit; fair use expected.
Pricing
Free.
CORS
Enabled — callable directly from browser JavaScript
Official docs
Read the docs

How to use the icanhazdadjoke API

Every request below was executed against the live API on 19 Aug 2026, and the response shown is the real body it returned — not an illustration.

1. Fetch a random dad joke as JSON

GET https://icanhazdadjoke.com/

curl
curl 'https://icanhazdadjoke.com/' \
  -H 'Accept: application/json'
JavaScript (fetch)
const res = await fetch("https://icanhazdadjoke.com/", {
  headers: {
    "Accept": "application/json",
  },
});
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const data = await res.json();
console.log(data);
Python (requests)
import requests

headers = {
    "Accept": "application/json",
}

res = requests.get("https://icanhazdadjoke.com/", headers=headers, timeout=20)
res.raise_for_status()
print(res.json())
Response — HTTP 200
{
  "id": "wXDIB5h3wc",
  "joke": "I used to have a job at a calendar factory but I got the sack because I took a couple of days off.",
  "status": 200
}

Parameters

ParameterTypeRequiredDescription
AcceptheaderRequiredSet to application/json for JSON. Omit for plain text, or use text/html for HTML. application/json
termqueryOptionalSearch term, used with the /search endpoint. cat
page / limitqueryOptionalPagination controls on /search. 1

Response fields

idstring
Joke identifier, usable with /j/{id} to fetch it again.
jokestring
The joke text as a single string — no setup/punchline split.
statusinteger
HTTP status echoed in the body.

What you can build with the icanhazdadjoke API

  • Teach HTTP content negotiation with a single memorable example
  • Add a random joke command to a Slack or Discord bot
  • Search a joke corpus by keyword with the /search endpoint
  • Generate joke images for social posts using the image representation

Common errors and how to fix them

HTML returned instead of JSON

The Accept header was missing.

Fix: Send `Accept: application/json` — this is the whole point of the API's design.

403

Blocked for a missing or generic User-Agent.

Fix: Send a User-Agent naming your app and a contact URL.

icanhazdadjoke API — frequently asked questions

How do I get JSON from icanhazdadjoke?

Send the header `Accept: application/json`. Without it the API returns plain text or HTML, because it uses content negotiation to pick the representation.

Does icanhazdadjoke require an API key?

No key is needed. The maintainer does ask that you send a descriptive User-Agent identifying your application and a contact URL.

Can I search for jokes on a specific topic?

Yes, the /search endpoint accepts a `term` parameter plus pagination, returning matching jokes with a total count.

Can I get a joke as an image?

Yes. Requesting /j/{id}.png returns the joke rendered as an image, which is convenient for social media posts.

Tools that pair with this API

Alternatives to icanhazdadjoke API

If icanhazdadjoke does not fit, these entertainment apis cover similar ground. Every one was called before publishing, and each links to its own reference page with a working curl command and the response it returned.

APIWhat it doesAuthCORSLast verified
Official Joke APIFree joke API with no key: random jokes with setup and punchline, filterable by type. Perfect for beginner projects. Tested curl example and live JSON.No keyYes19 Aug 2026
chucknorris.ioFree Chuck Norris jokes API with no key. Random jokes, 16 categories and full-text search. CORS enabled. Tested curl example and live JSON response.No keyYes19 Aug 2026
Advice SlipFree advice API with no key. Returns random advice slips as JSON, with search and id lookup. CORS enabled. Tested curl example and live response.No keyYes19 Aug 2026
Open Trivia DatabaseFree trivia and quiz API with no key: 24 categories, three difficulty levels, multiple choice and true/false questions. Tested curl example and live JSON.No keyYes19 Aug 2026
ImgflipImgflip's get_memes endpoint returns the 100 most popular meme templates with image URLs, dimensions and text box counts. No API key for reading. Tested example included.No keyYes21 Aug 2026
InspiroBotInspiroBot's API returns the URL of a freshly generated inspirational poster as plain text. One GET, no key, no JSON parsing. Tested example and the caveats you need.No keyYes21 Aug 2026
All Entertainment APIs

icanhazdadjoke is an independent third-party service and is not affiliated with ByteTools or ByteVancer. Details on this page were verified on 19 Aug 2026; always check the official documentation before relying on this API in production, as terms and limits can change.