The Trivia API Quizzes API
The Quizzes API from The Trivia API — 3 operation(s) for quizzes.
The Quizzes API from The Trivia API — 3 operation(s) for quizzes.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/the-trivia-api-com:the-trivia-api-com-quizzes-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: Trivia Quizzes API
version: 1.0.0
description: '# Introduction #
The Trivia API is a REST API used to request multiple choice trivia questions. No API key is required to request questions, but an API key can be used to gain access to further functionality, such as searching, quizzes, and sessions.
An API key is also required if you would like to use data from the API commercially.'
servers:
- url: https://the-trivia-api.com/v2
tags:
- name: Quizzes
paths:
/quizzes:
get:
operationId: getMyQuizzes
summary: Get all quizzes for a given user
description: '(Requires subscription)
Will return all quizzes that were created using the API key send with this request.'
tags:
- Quizzes
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Quiz'
'401':
description: Unauthorized
security:
- ApiKeyAuth: []
/quiz/{id}:
get:
operationId: getQuiz
summary: Get a quiz by ID
description: Get a quiz by ID.
tags:
- Quizzes
parameters:
- in: path
name: id
description: The ID of the quiz to get.
required: true
schema:
type: string
- in: query
name: language
description: The language to return questions in, defaults to English.
required: false
schema:
type: string
responses:
'200':
description: The quiz.
content:
application/json:
schema:
$ref: '#/components/schemas/Quiz'
delete:
operationId: deleteQuiz
summary: Delete a quiz
description: (Requires subscription)
tags:
- Quizzes
parameters:
- name: id
in: path
description: The ID of the quiz to delete.
required: true
schema:
type: string
responses:
'204':
description: The quiz was deleted.
/quiz:
post:
operationId: createQuiz
summary: Create a quiz
description: (Requires subscription)
tags:
- Quizzes
requestBody:
description: The quiz to create.
required: true
content:
application/json:
schema:
type: object
properties:
title:
type: string
required: true
description: User-friendly title for the quiz.
example: Will's Dinosaur Quiz
questionIds:
type: array
required: true
items:
type: string
description: The IDs of the questions to include on this quiz.
required:
- title
- questionIds
responses:
'201':
description: Information on the created quiz.
content:
application/json:
schema:
type: object
properties:
id:
type: string
description: Unique ID for this quiz.
required:
- id
components:
schemas:
ImageOption:
type: object
properties:
url:
type: string
description: Full URL of the image
example: https://example.com/images/12345/an-interesting-image.jpg
height:
type: number
description: Height of the image in pixels
example: 400
width:
type: number
description: Width of the image in pixels
example: 300
size:
type: number
description: Size of the image in bytes
example: 256612
author:
type: object
properties:
name:
type: string
description: The author's name
example: John Smith
url:
type:
- string
- 'null'
description: URL to the author's website or social media profile
example: https://john-smith.example.com
source:
type: object
properties:
url:
type:
- string
- 'null'
description: Where the image is originally credited
example: https://example.com/some-source-gallery
description:
type: string
description: Description of what the image is showing, can be used as alt text.
example: A picture of a cat
license:
type: object
properties:
url:
type:
- string
- 'null'
description: URL to the license of the image
example: https://creativecommons.org/licenses/by/4.0/
name:
type: string
description: Name of the license
example: Creative Commons Attribution 4.0 International
required:
- url
- height
- width
- size
- author
- source
- description
- license
Quiz:
type: object
properties:
id:
type: string
description: Unique ID for this quiz.
title:
type: string
description: User-friendly title for the quiz.
example: Will's Dinosaur Quiz
questions:
type: array
items:
$ref: '#/components/schemas/V2Question'
description: The questions on this quiz.
required:
- id
- title
- questions
TextChoiceQuestion:
allOf:
- $ref: '#/components/schemas/BaseQuestion'
- type: object
properties:
question:
type: object
properties:
text:
type: string
description: String formulation of the questions
example: What is the capital of France?
required:
- text
correctAnswer:
type: string
description: The correct answer
example: Paris
incorrectAnswers:
type: array
description: Array of incorrect answers
example:
- London
- Berlin
- Brussels
items:
type: string
description: An incorrect answer
hint:
type: string
description: 'A one-sentence clue to show before the player answers, if they ask for one. It points towards the answer without giving it away. Optional: not every question has one yet, and it is currently only returned for English requests.'
example: Think of a city famous for a tower built for the 1889 World's Fair.
explanation:
type: string
description: 'One or two sentences to show after the player answers, saying why the correct answer is right or adding a related fact. It names the correct answer, so do not show it before the player has answered. Optional: not every question has one yet, and it is currently only returned for English requests.'
example: Paris is France's capital and largest city; London, Berlin and Brussels are the capitals of the UK, Germany and Belgium.
type:
type: string
enum:
- text_choice
example: text_choice
required:
- question
- correctAnswer
- incorrectAnswers
- type
BaseQuestion:
type: object
properties:
category:
type: string
$ref: '#/components/schemas/Category'
id:
type: string
description: Unique identifier for the question
example: 5f9f1b9b0e1b9c0017a5f1a5
tags:
type: array
description: Secondary categories for the question. More freeform than category (can take any value), and can have multiple tags per question.
items:
type: string
example:
- france
- geography
- capital_cities
- cities
difficulty:
type: string
enum:
- easy
- medium
- hard
description: How difficult the question is perceived to be by the moderators of the API.
regions:
type: array
items:
type: string
description: 'If the question is regional (i.e. only reasonable to ask people from a particular set of countries), then the ISO 3166-1 alpha-2 country codes for those countries are specified here.
For most questions, this will be an empty array, meaning that the question is suitable to ask to people from anywhere in the world.'
isNiche:
type: boolean
description: Will be true if the question is a niche question, i.e. if it is considered too difficult to return unless the tag is specifically requested.
required:
- category
- id
- tags
- isNiche
- difficulty
V2Question:
oneOf:
- $ref: '#/components/schemas/TextChoiceQuestion'
- $ref: '#/components/schemas/ImageChoiceQuestion'
- $ref: '#/components/schemas/TextInputQuestion'
Category:
type: string
enum:
- music
- sport_and_leisure
- film_and_tv
- arts_and_literature
- history
- society_and_culture
- science
- geography
- food_and_drink
- general_knowledge
TextInputQuestion:
allOf:
- $ref: '#/components/schemas/BaseQuestion'
- type: object
properties:
question:
type: object
properties:
text:
type: string
description: String formulation of the question
example: What is the chemical symbol for gold?
required:
- text
correctAnswer:
type: string
description: The "gold standard" correct answer
example: Au
acceptedAnswers:
type: array
description: Cached list of accepted answer variations (only returned if showAnswer=true)
example:
- Au
- AU
- au
items:
type: string
correctAnswerRatio:
type: object
description: How often this question has been answered correctly vs incorrectly
properties:
correct:
type: number
description: Number of correct answers recorded
incorrect:
type: number
description: Number of incorrect answers recorded
required:
- correct
- incorrect
hint:
type: string
description: 'A one-sentence clue to show before the player answers, if they ask for one. It points towards the answer without giving it away. Optional: not every question has one yet, and it is currently only returned for English requests.'
example: The symbol comes from the metal's Latin name, not its English one.
explanation:
type: string
description: 'One or two sentences to show after the player answers, saying why the correct answer is right or adding a related fact. It names the correct answer, so it is not returned when showAnswer=false. Optional: not every question has one yet, and it is currently only returned for English requests.'
example: Gold's symbol Au comes from its Latin name, aurum, meaning 'shining dawn'.
type:
type: string
enum:
- text_input
example: text_input
required:
- question
- correctAnswer
- correctAnswerRatio
- type
ImageChoiceQuestion:
allOf:
- $ref: '#/components/schemas/BaseQuestion'
- type: object
properties:
question:
type: object
properties:
text:
type: string
description: String formulation of the questions
example: Which of these photos shows The Eiffel Tower?
required:
- text
correctAnswer:
type: array
items:
$ref: '#/components/schemas/ImageOption'
incorrectAnswers:
type: array
items:
type: array
items:
$ref: '#/components/schemas/ImageOption'
type:
type: string
enum:
- image_choice
example: image_choice
required:
- question
- correctAnswer
- incorrectAnswers
- type
securitySchemes:
ApiKeyAuth:
type: apiKey
in: header
name: X-API-Key