Games & Comics — entry 047 of 75

Open Trivia

Verified Aug 2026

The Open Trivia Database is a free, user-contributed trivia question API — no API key required — with questions spanning dozens of categories and difficulty levels, all licensed under Creative Commons Attribution-ShareAlike 4.0. Optional session tokens let a client track which questions it has already been served so the same question isn't repeated within a session.

The Open Trivia Database is a free, keyless JSON API over a community-contributed pool of trivia questions, filterable by amount, category, difficulty, and type. A live GET this run against /api.php?amount=1&type=multiple returned a genuine 229 B question at HTTP 200 — no key or signup of any kind, and the response carried access-control-allow-origin: *.

triviaquizno-authcreative-commons
AuthenticationNone requiredCall it straight away — no key, no signup.
HTTPSSupportedTraffic is encrypted in transit.
CORSEnabledCallable directly from browser JavaScript.
PricingFreeNo paid tier — free for the documented use case.
FormatsJSONResponses can be requested as JSON.

GreatAPIs Score

Score74out of 100
Authentication25/25No authentication required
Pricing20/20Free to use
Docs0/20No docs or spec available
Formats9/15Single response format
Freshness20/20Verified within 6 months

Embed this badge

Scored 74 on greatapis.com
<a href="https://greatapis.com/api/open-trivia/"><img src="https://greatapis.com/badge/open-trivia.svg" alt="Scored 74 on greatapis.com"></a>

Auth quickstart

  1. No API key, signup, or credit card required — a live GET this run against /api.php?amount=1&type=multiple returned a real question with zero credentials, and the response carried access-control-allow-origin: *.
Stored keyNo key stored

Your key is stored only in this browser (localStorage) and sent directly to the API — never to greatapis.

Fetch one multiple-choice question

GEThttps://opentdb.com/api.php?amount=1&type=multiple

200 application/json

{"response_code": 0, "results": [{"type": "multiple", "difficulty": "easy", "category": "Entertainment: Music", "question": "When was Gangnam Style uploaded to YouTube?", "correct_answer": "2012", "incorrect_answers": ["2013", "2014", "2011"]}]}

response_code: 0 means the payload's own success signal, separate from the HTTP status — confirmed live above. A second, immediate repeat of this exact request (no delay) returned real HTTP 429 with body {"response_code":5,"result":[]} (31 B) this run — note the singular result key on the rate-limited body, not the plural results the success shape above uses.

Try it

Developer reference

Base URLhttps://opentdb.com
Rate limit

1 request every 5 seconds per IP, per opentdb.com/api_config.php's own "Code 5: Rate Limit" documentation

Key endpoints
  • GET/api.php
  • GET/api_token.php
  • GET/api_category.php

Gotchas & limits

  • The documented 1 request per 5 seconds per IP limit is real and surfaces at the transport layer, not just in the body — a live GET immediately following the example above returned genuine HTTP 429 with {"response_code":5,"result":[]}. Waiting 5+ seconds between calls avoids it; a burst-fetch loop will not.
  • Question/category/answer text is HTML-entity-encoded by default, not plain text — a live GET this run against /api.php?amount=10&type=multiple returned a question rendered as "In &quot;Call Of Duty: Zombies&quot;, which map&#039;s opening cutscene shows &quot;Richtofen&quot; killing another version of himself?". Code that renders question directly without decoding &quot;/&#039;/&amp; will show literal entity text to users.
  • Passing encode=url3986 switches every text field to percent-encoding instead of HTML entities — a live GET this run against /api.php?amount=1&encode=url3986 returned "category":"Entertainment%3A%20Video%20Games" and "correct_answer":"Estus%20Flask". The two encode modes are not interchangeable: code written to strip &...; entities will silently do nothing to %XX sequences.
  • Session tokens exist to avoid repeat questions within a run — a live GET this run against /api_token.php?command=request returned {"response_code":0,"response_message":"Token Generated Successfully!","token":"880ad4a3548d364b2303f3f54c2383891d74a949e3d534e3cc1dc405809de455"}. Passing that token back as &token= on /api.php excludes already-served questions instead of risking repeats.