icanhazdadjoke API

⭐ Beginner's Pick Personality / No Auth Required Beginner HTTPS
Free to Use Varies (check documentation)

Overview

icanhazdadjoke is a free API serving the internet's largest collection of dad jokes. It returns a random dad joke in JSON, plain text, or image format with no API key needed. It is a favorite beginner project API because the responses are simple, clean, and always entertaining.

💡

Beginner Tip

Set the Accept header to application/json to get a JSON response. Without it, the API returns plain text. You can also search jokes by keyword using the /search endpoint.

Available Data

joke text (setup/punchline)
joke category
joke type (single/twopart)

Example Response

JSON Response
{
  "error": false,
  "category": "Programming",
  "type": "twopart",
  "setup": "Why do programmers prefer dark mode?",
  "delivery": "Because light attracts bugs.",
  "id": 42,
  "lang": "en"
}

Field Reference

id Unique identifier for the joke.
joke The full text of the dad joke.
status HTTP status code of the response, typically 200.

Implementation Example

// ⚠️ Note: This URL may be a documentation page. Check official docs for actual API endpoint.
const url = "https://icanhazdadjoke.com/api";
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.

Common Errors & Troubleshooting

Response is plain text or HTML instead of JSON The Accept: application/json header was not included.
Always include -H "Accept: application/json" in your request.
404 on /search with no results The search term returned no matching jokes.
Check that the "results" array is not empty before accessing results[0]; try a broader search term.
CORS error in browser Request originates from a disallowed origin.
icanhazdadjoke supports CORS, so this usually means a local file:// origin; serve your page from a local server instead.

Matrix Score Breakdown

🌐 Reachability 30/30
⚡ Speed 5/20
🔒 Security 15/15
🛠 Developer XP 20/20
✓ Reliability 7/15
Response Time 1073ms

Fully tested on Apr 5, 2026

Technical Specifications

Auth No Auth
HTTPS REQUIRED
CORS UNKNOWN
Category Personality
Difficulty Beginner
Verified: 2026-04-04

Similar APIs

View All →