# Open Trivia Database

Category: [Fun and games](https://free-web-services.com/web-services/other/fun/)  
Page: https://free-web-services.com/web-services/other/fun/open-trivia-database.html  
Documentation: https://opentdb.com/api_config.php

The Open Trivia Database is a free, user-contributed collection of thousands of trivia questions. Ask for a number of questions by category, difficulty and type (multiple choice or true/false), and use a session token to avoid getting the same question twice. Responses are JSON. Free, no key needed; the questions are licensed under Creative Commons BY-SA.

- API key: Not needed
- Pricing: Free, no key needed; the questions are licensed under Creative Commons BY-SA.
- From the browser: Yes (CORS)
- Formats: JSON
- Interface: REST, HTTP-GET
- Provider: opentdb.com
- Last checked: Working on November 1st, 2026

Example request:

```sh
curl 'https://opentdb.com/api.php?amount=1'
```

The JavaScript works in a web page as well as in Node.js 18 or newer.

