quizbase
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 enum`trivial` | `easy` | `medium` | `hard` | `expert` — LLM-calibrated 5-level difficulty, graded with distractor-set context. See [GET /v1/questions § difficulty](/docs/api/questions#parameters) for level definitions. Pre-rescore records hold an importer placeholder (mostly `medium` for factoid sources).
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 enumhighThree tiers, nested `high` ⊆ `standard` ⊆ `all`. `high` (default) returns only the cleanest, most broadly-useful questions. `standard` broadens to the full reviewed pool including niche/narrowly-scoped questions (more volume). `all` includes everything, even questions flagged for review — useful for audit, research, BY-SA dump. When `quality=all` each returned question gains a `"quality": "high" | "needs_review"` field so you can tell which records were flagged; `high`/`standard` skip the field.
regions CSV lowercase ISO + cultural**Cultural affinity** — residents of the country or members of the cultural/religious group are statistically more likely to know the answer (NOT geography of the subject). Lowercase ISO 3166-1 alpha-2 (`pl`, `us`, `gb`) plus cultural codes (`jewish`, `christian-catholic`, `islam`). AND-logic. Empty array on a question = universally accessible. Uppercase tolerated (normalized server-side). Example: `regions=pl,jewish` returns questions tagged for both Polish AND Jewish affinity. Discover via [GET /v1/regions](/docs/api/regions).
source CSV source idsInclude only these source databases. One or more of: `arc`, `creak`, `entityq`, `kqa-pro`, `mintaka`, `mkqa`, `nq-open`, `opentdb`, `opentriviaqa`, `qasc`, `quizbase`, `webq`. Comma-separated for multiple (OR), e.g. `source=mintaka,opentdb`. Each has its own license + attribution (see `attribution.license` per question).
exclude_source CSV source idsExclude these source databases, e.g. `exclude_source=entityq` to drop a noisy auto-generated source. Comma-separated for multiple. Applied after `source` if both are present.
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 211ms, p95 265ms (sustained 50 RPS, 5-min baseline). Single-request warm: ~130ms.
  • Narrow filter (any of tags, tags_any, topic, topics_any, subcategory): GIN bitmap scan path. Single-request warm: ~150ms; can degrade under sustained load while we tune indexes.
  • p99 ~345ms (broad); narrow filter path p95 ~303ms.
  • Last measured: 2026-05-30.
  • SLO: p95 < 800ms (broad) / < 1500ms (narrow), error rate < 1%.

See also#