Skip to content
Command Palette
Search for a command to run...
QuizBase · Docs

GET /v1/questions/random#

GET /api/v1/questions/random API key required

Returns up to 50 random questions in the requested language. This is the killer endpoint for quiz apps — one request, one JSON array, ready to render.

Parameters#

ParameterTypeDefaultDescription
amount integer10How many questions to return (1–50).
lang enumenSupported: `en`, `pl`. Strict — any other value returns `400`. If we have no questions matching your filters in that language, you get an empty array, not English.
category integer or slugFilter by category. Accepts internal id (1-24), OpenTDB ids (9-32), or canonical slugs like `geography`.
difficulty enumOne of: `easy`, `medium`, `hard`.
type enumDefault response includes `multiple` and `boolean` only. Pass `?type=text_input` to opt into open-ended questions explicitly.
tags CSV kebab-caseAll-of match (AND). Example: `tags=capitals,europe`.
tags_any CSV kebab-caseAny-of match (OR), max 10.
topic kebab-caseCurated topic slug — see [GET /v1/topics](/docs/api/topics).
topics_any CSV kebab-caseAny-of match (OR) on curated topics, max 10.
subcategory kebab-caseRaw subcategory slug.
quality `high`Pass `quality=high` to exclude questions flagged by distractor validation.
regions CSV ISO 3166-1All-of match (AND), lowercase 2-letter codes. Example: `regions=pl,de`.
source enumRestrict to one import source: `opentdb`, `opentriviaqa`, `mkqa`, `mintaka`, `nq-open`, `kqa-pro`, `entityq`, `quizbase`.
license SPDXe.g. `CC-BY-SA-4.0`, `MIT`.
exclude CSV UUIDsUp to 250 ids to skip. Useful for de-duplicating within a game session.

Examples#

Response#

Rate limits#

Every response carries RateLimit-Limit, RateLimit-Remaining, RateLimit-Reset. On 429 also Retry-After. See Errors and retries for the full picture.

Performance#

  • Broad filter (no tags/topic/subcategory): p50 138ms, p95 158ms (sustained 50 RPS).
  • Narrow filter (any of tags, tags_any, topic, topics_any, subcategory): p50 ~110ms, p95 ~180ms (sustained 30 RPS).
  • p99 ≤ ~280ms across both paths.
  • Last measured: 2026-05-07. Burst-tested at 200 RPS without degradation.
  • SLO: p95 < 800ms (broad) / < 1500ms (narrow), error rate < 1%.

See also#