Trivia API logo
EntertainmentMAINTAINED2 tokens / call

Trivia API

5,298 multiple-choice and true-or-false trivia questions in 24 categories and three difficulties

Multiple-choice and true/false trivia questions across ~24 categories and three difficulty levels. Pull random questions, filter by category/difficulty/type, or page through the full set. Powered by the Open Trivia Database (CC BY-SA 4.0).

Every call needs an X-Api-Key header. A free key includes 500 tokens a month, no card required. 2 tokens per call, so the free plan covers about 250 calls a month.

No credit card requiredAccess to 125+ APIsCancel anytime
response.json
{
  "count": 1,
  "results": [
    {
      "id": 142,
      "category": "Entertainment: Comics",
      "type": "multiple",
      "difficulty": "hard",
      "question": "In the Batman comics, by what other name is the villain Dr. Jonathan Crane known?",
      "correct_answer": "Scarecrow",
      "incorrect_answers": [
        "Bane",
        "Calendar Man",
        "Clayface"
      ]
    }
  ]
}
Production Ready
Battle-tested infrastructure with a 99.9% uptime SLA. Rate limits are generous, responses are consistent.
Simple Integration
Standard REST + JSON. Works with any HTTP client. Copy-ready code snippets in 4 languages.
One Key, 125+ APIs
Your DataAndAPIs subscription unlocks every API on the platform — anime, finance, sports, and more.

Use cases for Trivia API

  • Build a quiz game with rounds by category and difficulty.

  • Add a daily trivia question to a newsletter or app.

  • Run pub-quiz style events with random question sets.

  • Create learning drills with instant answer checking.

Trivia API endpoints

Every endpoint with its parameters and a real example response.

GETGet Trivia By Id

https://api-trivia.dataandapis.com/v1/trivia/{id}

Path parameters

ParameterExample
id142Required

Example request

curl "https://api-trivia.dataandapis.com/v1/trivia/142" \
  -H "X-Api-Key: YOUR_API_KEY"
Example response
{
  "id": 142,
  "category": "Entertainment: Comics",
  "type": "multiple",
  "difficulty": "hard",
  "question": "In the Batman comics, by what other name is the villain Dr. Jonathan Crane known?",
  "correct_answer": "Scarecrow",
  "incorrect_answers": [
    "Bane",
    "Calendar Man",
    "Clayface"
  ]
}

GETList Categories

https://api-trivia.dataandapis.com/v1/trivia/categories

This endpoint takes no parameters.

Example request

curl "https://api-trivia.dataandapis.com/v1/trivia/categories" \
  -H "X-Api-Key: YOUR_API_KEY"
Example response
{
  "count": 24,
  "categories": [
    {
      "category": "Entertainment: Film",
      "count": 251
    },
    {
      "category": "General Knowledge",
      "count": 469
    },
    {
      "category": "Science & Nature",
      "count": 215
    }
  ]
}

GETList Trivia

https://api-trivia.dataandapis.com/v1/trivia

Query parameters

ParameterExample
categoryHistoryOptional
limit20Optional
page1Optional

Example request

curl "https://api-trivia.dataandapis.com/v1/trivia?category=History&limit=20&page=1" \
  -H "X-Api-Key: YOUR_API_KEY"
Example response
{
  "total": 411,
  "page": 1,
  "limit": 20,
  "count": 20,
  "attribution": "Questions from the Open Trivia Database (opentdb.com), CC BY-SA 4.0",
  "results": [
    {
      "id": 4082,
      "category": "History",
      "type": "multiple",
      "difficulty": "medium",
      "question": "When was the United States National Security Agency established?",
      "correct_answer": "November 4, 1952",
      "incorrect_answers": [
        "July 26, 1908",
        " July 1, 1973",
        " November 25, 2002"
      ]
    },
    {
      "id": 4083,
      "category": "History",
      "type": "multiple",
      "difficulty": "hard",
      "question": "After the 1516 Battle of Marj Dabiq, the Ottoman Empire took control of Jerusalem from which sultanate?",
      "correct_answer": "Mamluk",
      "incorrect_answers": [
…
Show full response
{
  "total": 411,
  "page": 1,
  "limit": 20,
  "count": 20,
  "attribution": "Questions from the Open Trivia Database (opentdb.com), CC BY-SA 4.0",
  "results": [
    {
      "id": 4082,
      "category": "History",
      "type": "multiple",
      "difficulty": "medium",
      "question": "When was the United States National Security Agency established?",
      "correct_answer": "November 4, 1952",
      "incorrect_answers": [
        "July 26, 1908",
        " July 1, 1973",
        " November 25, 2002"
      ]
    },
    {
      "id": 4083,
      "category": "History",
      "type": "multiple",
      "difficulty": "hard",
      "question": "After the 1516 Battle of Marj Dabiq, the Ottoman Empire took control of Jerusalem from which sultanate?",
      "correct_answer": "Mamluk",
      "incorrect_answers": [
        "Ayyubid",
        "Ummayyad",
        "Seljuq"
      ]
    },
    "... 18 more questions omitted from this example"
  ]
}

GETRandom Trivia

https://api-trivia.dataandapis.com/v1/trivia/random

Query parameters

ParameterExample
amount1Optional
categoryEntertainment: FilmOptional
difficultyeasyOptional
typemultipleOptional

Example request

curl "https://api-trivia.dataandapis.com/v1/trivia/random?amount=1&category=Entertainment%3A%20Film&difficulty=easy&type=multiple" \
  -H "X-Api-Key: YOUR_API_KEY"
Example response
{
  "count": 1,
  "results": [
    {
      "id": 142,
      "category": "Entertainment: Comics",
      "type": "multiple",
      "difficulty": "hard",
      "question": "In the Batman comics, by what other name is the villain Dr. Jonathan Crane known?",
      "correct_answer": "Scarecrow",
      "incorrect_answers": [
        "Bane",
        "Calendar Man",
        "Clayface"
      ]
    }
  ]
}

Where the data comes from

Source
Open Trivia Database (CC BY-SA 4.0), loaded into the API's database.
Freshness
Reloaded as the source grows.

One install. Every endpoint.

No proprietary SDKs needed. Any HTTP client works. Pick your language and paste.

3languages
4endpoints
RESTarchitecture
1key for all APIs
  • Fully typed responses — auto-completion in your IDE
  • Tracks the API in lockstep — new endpoints land same day
  • One key works across 125+ APIs on the platform
import axios from 'axios';

const { data } = await axios.get(
  'https://api-trivia.dataandapis.com/v1/trivia/{id}',
  { headers: { 'X-Api-Key': process.env.API_KEY } }
);

Trivia API · X-Api-Key

Explore the endpoints

Browse request parameters and inspect live example responses.

Available Endpoints

Request Parameters

API URL

Headers

X-Api-Key

Path Parameters

id
import axios from 'axios';

const url = 'https://api-trivia.dataandapis.com/v1/trivia/{id}';
const { data } = await axios.get(url, {
  headers: { 'X-Api-Key': 'YOUR_API_KEY' }
});

One subscription. Every API.

Tokens unlock this API and 125+ others on DataAndAPIs. Switch APIs any time — we promote.

FREE

$0/mo

500 tokens / month

  • Access to all APIs
  • Tokens reset monthly
  • Community support
Start free
Most Popular

STARTER

$6.99/mo

25,000 tokens / month

  • Access to all APIs
  • Tokens reset monthly
  • Email support
Subscribe

PRO

$24.99/mo

100,000 tokens / month

  • Access to all APIs
  • Tokens reset monthly
  • Priority email support
Subscribe

ULTRA

$99.99/mo

1,000,000 tokens / month

  • Access to all APIs
  • Tokens reset monthly
  • Priority support
Subscribe

Need higher volume, dedicated infra, or a custom contract? Talk to sales →

Questions about Trivia API

Ship Trivia API this afternoon.

500 free tokens. No card. Plus 125+ other APIs on the same key.