api.php: Get trivia questions
Description
Retrieve trivia questions with optional filtering by category, difficulty, type, and session token. Maximum 50 questions per call.
Parameters (6)
amount
(integer, query, required)
Number of questions to retrieve (1-50)
Constraints: {'minimum': 1, 'maximum': 50}
category
(integer, query, optional)
Category ID (see /api_category.php for list)
difficulty
(string, query, optional)
Question difficulty level
Constraints: {'enum': ['easy', 'medium', 'hard']}
encode
(string, query, optional)
Encoding type for special characters
Constraints: {'enum': ['urlLegacy', 'url3986', 'base64']}
token
(string, query, optional)
Session token to prevent duplicate questions
type
(string, query, optional)
Question type
Constraints: {'enum': ['multiple', 'boolean']}
Examples (1)
Get trivia questions
probe-gate
curl 'https://opentdb.com/api.php'
import requests
resp = requests.get("https://opentdb.com/api.php")
data = resp.json()
import zingu_apis
api = zingu_apis.api("open-trivia-database")
result = api.fetch("api.php")
for item in result:
print(item)
const resp = await fetch("https://opentdb.com/api.php");
const data = await resp.json();
Probe History
| Time | Status | Latency | Size |
| 2026-04-16 01:42:00.371777 |
200
|
507ms |
|
| 2026-04-15 00:06:06.648086 |
200
|
519ms |
|
| 2026-04-14 01:24:20.244502 |
200
|
658ms |
|
| 2026-04-12 13:34:04.762687 |
200
|
490ms |
|
| 2026-04-10 02:41:18.731448 |
200
|
525ms |
|
| 2026-04-09 01:41:56.216546 |
200
|
762ms |
|
| 2026-04-03T10:50:32.607776 |
200
|
354ms |
|