Open Trivia API
Overview
Open Trivia DB is a free, community-sourced trivia question database with thousands of questions across many categories and difficulty levels. No API key is required, and you can request questions in multiple formats including multiple choice and true/false. It is one of the easiest APIs to start with for building quiz games or interactive learning apps.
Beginner Tip
Add the ?encode=url3986 parameter to your request to safely handle special characters in questions and answers without parsing issues. You can also request a session token to avoid receiving duplicate questions in the same session.
Available Data
Example Response
{
"id": 1,
"name": "Open Trivia",
"data": "Trivia Questions",
"source": "Open Trivia"
} Field Reference
response_code 0 = success, 1 = no results, 2 = invalid parameter, 3 = token not found, 4 = token empty results Array of trivia question objects returned for your request category The category the question belongs to (e.g. Science: Computers) difficulty Question difficulty level: easy, medium, or hard question The trivia question text (URL-encoded if encode=url3986 was used) correct_answer The single correct answer; combine with incorrect_answers array to build a shuffled answer list Implementation Example
const url = "https://opentdb.com/";
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
Matrix Score Breakdown
Fully tested on Apr 5, 2026
Technical Specifications
Related Tags
Similar APIs
View All →Age of Empires II
Age of Empires II provides programmatic access to get information about age of empires ii resources via REST API.
AmiiboAPI
AmiiboAPI provides programmatic access to nintendo amiibo information via REST API.
Animal Crossing: New Horizons
⭐ Beginner's PickThe Animal Crossing: New Horizons API gives you free access to in-game data including villagers, critters, fossils, art, music, and furniture.
Autochess VNG
The Autochess VNG API provides game data for the Autochess VNG mobile game including heroes, items, and races.
Barter.VG
Barter.VG aggregates data about PC games, DLC, bundles, giveaways, and trading from Steam and other platforms.