Trivia questions for your app, served as JSON

A trivia question database behind a plain HTTP API. Filter by category, difficulty and tag, and make your first request without an API key.

14,633 questions across 10 categories, from multiple choice to image and typed-answer questions.

An example request to the API and the JSON it returns: one science question with its answers, tags, difficulty, hint and explanation.
GETthe-trivia-api.com/v2/questions?categories=science&limit=1
200 OKapplication/json
[{"category": "science","id": "65056f737a97013de78b544d","correctAnswer": "Isobar","incorrectAnswers": ["Isotherm", "Isohyet", "Contour line"],"question": {"text": "What line connects points of equal atmospheric pressure?"},"tags": ["science"],"type": "text_choice","difficulty": "medium","regions": [],"isNiche": false,"hint": "The word combines a prefix meaning “equal” with a unit of pressure.","explanation": "Isobars join points of equal pressure on weather maps; isotherms mark equal temperature, and isohyets mark equal rainfall."}]

Try it against the live API

Pick some filters and the request changes to match. Each one goes to the real API, with no key, and brings back a fresh question.

categories10 of them, from music to food and drink
difficultiesall three if you pick none
curl "https://the-trivia-api.com/v2/questions?categories=science&limit=1"

You can also filter by tags and region, and ask for up to 50 questions at a time without a key. Filtering guide. In TypeScript, @trivia-api/sdk has a typed function for every endpoint and no dependencies. See the quickstart.

Example response

Show the response as

Sciencemedium

What line connects points of equal atmospheric pressure?

Image and typed-answer questions, translations and sessions need an API key. See plans

Five things you won't have to build yourself

Random questions get a game started. These are what it needs next, each one a parameter or an endpoint away.

Let players type their answers

Text input questions have no options to pick from. Send what the player typed to the validate endpoint and an LLM decides whether it's right, so typos and other wordings still count.

There's no list of accepted spellings to maintain, and answers can be checked in any of the translated languages too.

type=text_inputPOST /v2/question/:id/validate
Available with Complete subscription
Four answers typed for “Which planet has the most moons?” and how the API marked each one.

Text input · Science

Which planet has the most moons?

  • “Saturn”Accepted: Exact match
  • “the planet saturn”Accepted: Same answer, different wording
  • “Satrun”Accepted: A typo
  • “Jupiter”Rejected: A different planet

// response for “Satrun”
{ "isCorrect": true, "correctAnswer": "Saturn" }

Ask with pictures

The four options are photos: people, places, flags, maps and food. Every image arrives ready to lay out, at several sizes, with the author and source you need to credit it.

type=image_choice
Available with Complete subscription

Image choice · Geography

Which of these pictures shows New York's Grand Central Station?

  • Option A: Grand Central terminal in New York, NYACorrect
  • Option B: South facade of the Basilique du Sacré-Cœur de MontmartreB
  • Option C: The Luce ChapelC
  • Option D: Buckingham Palace in London, England. taken by myself with a Canon 5D and 24-105mm f/4L IS lens.D
Each image comes in up to 7 sizes, credited to its author. Here: Fcb981; Eric Baetscher, Tonchino, Yakult6067, Diliff.

Ask in 9 languages

Add a language code to a request and the question comes back in Spanish, Dutch or Hindi, with its answers translated to match. The same question id works in every language, so players can share a round across them.

language=es
Available with Complete subscription
One question, shown in the language you pick.
Language

English · Arts & literature

The painting "American Gothic" by Grant Wood is a part of which art movement?

  • Modernism (correct)
  • Pointillism
  • Primitivism
  • Ukiyo-e

Never ask the same question twice

Create a session for each player or game and pass its id when you ask for questions. The API remembers what it has sent and skips it next time, and tells you how many are left.

POST /v2/sessionsession=…
Available with Regular and Complete subscriptions
Two requests with the same session get different questions, and the session counts down what is left.
  1. POST /v2/session
    "id": "3kmTmW29aDTf"
  2. GET /v2/questions?session=3kmTmW29aDTf&limit=5
    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
  3. GET /v2/questions?session=3kmTmW29aDTf&limit=5
    1. 6
    2. 7
    3. 8
    4. 9
    5. 10
  4. GET /v2/session/3kmTmW29aDTf
    "remainingQuestions": 15580

Search by meaning rather than keywords, so asking for creatures from ancient myths finds Medusa and Pegasus. Use it to let players pick a topic, or add query to a questions request for a random round on one.

POST /v2/questions/searchquery=…
Available with Complete subscription
The top results for the search “creatures from ancient myths”.
creatures from ancient myths
  1. 1Which Ancient Greek creature had snakes for hair?Society & culture · Medusa
  2. 2In Greek mythology, what kind of monster is an offspring of a woman and a bull?Society & culture · The minotaur
  3. 3Which Ancient Greek mythological creature was a winged horse?Society & culture · Pegasus
  4. 4In Greek mythology, which animal's head does the Minotaur have?Society & culture · Bull
  5. 5In Greek mythology, who solved the riddle of the Sphinx?Society & culture · Oedipus

Also included

  • Quizzes

    Save a fixed set of questions under one id, so every player in a league gets the same round.

    Available with any subscription
  • Family filter

    contentFilter=family leaves out questions marked as adult content.

  • Regions

    A country code lets in questions that only make sense to players there.

  • MCP server

    Claude, Cursor and other AI assistants can fetch questions directly.

Built with The Trivia API

  • Roblox game

    Trivia Roblox Game Show

    It was the only API I found that offered text-input questions. Players now see new questions every round, which saves me hours of work every week.
    Lucas, creatorPlay on Roblox
  • Trivia leagues

    Kwizaa

    Runs automated trivia leagues on The Trivia API. Quizzes go out on a schedule, and the results post to Discord or email.

Questions, answered

The docs go into detail on everything here.

Your first question is one request away

English multiple choice questions need no sign-up and no key, so you can try it from a terminal or a browser right now.

  1. Step 1

    Ask for questions

    A plain GET returns 10 random questions, each with its answer and three wrong options.

    curl "https://the-trivia-api.com/v2/questions"
    Or open it in your browser
  2. Step 2

    Narrow them down

    Add categories, difficulties or tags to choose what comes back, and limit for how many.

    curl "https://the-trivia-api.com/v2/questions?categories=history&difficulties=easy&limit=5"
  3. Step 3

    Add a key for more

    Typed answers, image questions, translations and sessions need an API key, sent in the X-API-Key header.

Read the quickstart

Or start from an example quiz app in React or Vue.

License

Information about the Creative Commons license for The Trivia API.

The API and all data returned from it are licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.

Creative Commons License

This means that the API and the questions it returns are free for noncommercial use. If you have somewhere suitable in your app, then please credit the API somewhere discreet — we love having our hard work shared!

If you would like to use the API commercially, or would like enhanced functionality, this service is offered through a paid subscription.

Sign in

Sign in to access your API key and manage your account.

or continue with email