Games & Comics — entry 047 of 75
Open Trivia
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: *.
GreatAPIs Score
Auth quickstart
- No API key, signup, or credit card required — a live GET this run against
/api.php?amount=1&type=multiplereturned a real question with zero credentials, and the response carriedaccess-control-allow-origin: *.
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
{"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
https://opentdb.com1 request every 5 seconds per IP, per opentdb.com/api_config.php's own "Code 5: Rate Limit" documentation
- 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=multiplereturned a question rendered as"In "Call Of Duty: Zombies", which map's opening cutscene shows "Richtofen" killing another version of himself?". Code that rendersquestiondirectly without decoding"/'/&will show literal entity text to users. - Passing
encode=url3986switches every text field to percent-encoding instead of HTML entities — a live GET this run against/api.php?amount=1&encode=url3986returned"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%XXsequences. - Session tokens exist to avoid repeat questions within a run — a live GET this run against
/api_token.php?command=requestreturned{"response_code":0,"response_message":"Token Generated Successfully!","token":"880ad4a3548d364b2303f3f54c2383891d74a949e3d534e3cc1dc405809de455"}. Passing that token back as&token=on/api.phpexcludes already-served questions instead of risking repeats.