api.php: Get trivia questions

API: opentdb.com:open-trivia
Endpoint: /api.php
Response format: text/plain
Auth: unknown
Method: GET
Last Status: 200
Latency: 549ms

Description

Retrieve trivia questions from the database. Supports filtering by amount, category, difficulty, and question type. Maximum 50 questions per call. Only one category can be requested per call.

Parameters (6)

amount (integer, query, optional, default: 1)

Number of questions to retrieve (1-50)

Constraints: {'minimum': 1, 'maximum': 50}

category (integer, query, optional)

Category ID to filter questions. See /api_category.php for available categories.

difficulty (string, query, optional)

Difficulty level of questions

Constraints: {'enum': ['easy', 'medium', 'hard']}

encode (string, query, optional, default: default)

Encoding format for special characters in questions and answers

Constraints: {'enum': ['urlLegacy', 'url3986', 'base64', 'default']}

token (string, query, optional)

Session token to prevent receiving the same question twice in a session

type (string, query, optional)

Type of questions to retrieve

Constraints: {'enum': ['multiple', 'boolean']}

Examples (1)

Get trivia questions probe-gate
curl 'https://opentdb.com/api.php?amount=1&encode=default'
import requests

resp = requests.get(
    "https://opentdb.com/api.php",
    params={
        'amount': '1',
        'encode': 'default',
    },
)
data = resp.json()
import zingu_apis

api = zingu_apis.api("opentdb")
result = api.fetch("api.php", amount=1, encode="default")

for item in result:
    print(item)
const resp = await fetch("https://opentdb.com/api.php?amount=1&encode=default");
const data = await resp.json();

Probe History

Latency

Status Codes

TimeStatusLatencySize
2026-04-16 04:08:16.631298 200 549ms
2026-04-15 01:44:53.184736 200 542ms
2026-04-14 03:51:14.115343 200 510ms
2026-04-12 14:53:35.855294 200 489ms
2026-04-10 00:43:25.027135 200 511ms
2026-04-09 02:04:07.312908 200 576ms
2026-03-27T23:27:58.187204 200 482ms