The Trivia API
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…
Fork copies the collection into your workspace, without the publisher's secrets, so you can add your own key and send requests. Star saves it to your starred APIs (Account › Marketplace) and helps others find it.
Overview
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.
Endpoints 20
Quizzes
- GETGet all quizzes for a given user
/quizzes(Requires subscription) Will return all quizzes that were created using the API key send with this request. - GETGet a quiz by ID.
/quiz/:idGet a quiz by ID. - DELETEDelete a quiz.
/quiz/:id(Requires subscription) - POSTCreate a quiz.
/quiz(Requires subscription)
Meta
- GETGet all tags
/tagsReturns an array of all tags set on questions - GETList the tag vocabulary
/tag-registryReturns every active tag in the tag vocabulary, sorted by slug, with its label and description where it has them. These are the only tags a question can be… - GETGet the total number of questions per tag
/totals-per-tagTakes the same input parameters as the /questions endpoint and returns a dictionary where each key is a tag and each value is the number of questions that… - GETGet metadata on the questions that match a given query
/metadataWill return metadata on the questions that match the given query parameters. Including breakdowns by category, difficulty, status (approved/rejected/pending),… - GETGet content filter metadata
/metadata/content-filterReturns counts of approved questions by content-filter classification for the questions that match the given query parameters. family: questions with… - GETGet all languages that are supported by the API
/languagesReturns an array of all languages that are supported by the API
Questions
- GETGet a question by id
/question/:idGet a question by its id - POSTReport a question
/question/:id/reportReport a question as being incorrect or inappropriate - POSTValidate an answer for a text_input question
/question/:id/validate(Require a complete subscription) Validates a user's free-form text answer against a text_input question. First checks against cached accepted answers, then… - GETGet a random set of questions
/questionsGet a random set of questions. Any combination of query parameters can be used, or you can omit all of them. Pass an API Key in order to gain access to… - GETCount the questions available for a set of filters
/questions/countReturns the number of approved questions that GET /questions draws from when given the same query parameters. The same defaults apply: if types is not… - POSTSearch for questions
/questions/search(Requires subscription)
Sessions
- POSTCreate a new session
/session(Requires Regular subscription) - GETGet a session by id
/session/:id(Requires Regular subscription) - GETGet a session by id
/session/:id/preview-questionsPreview a session's questions. This is used to get a set of new questions for a session without marking them as 'used'. Questions generated in this way could… - POSTAdd used questions to a session
/session/:id/questionsIs used to manually add questions to a session's array of 'used' questions, so that they won't be asked for this session. Ordinarily, questions are…
API details
- Base URL
https://the-trivia-api.com/v2- Authentication
- An API key in the X-API-Key header
- Operations
- 20 operations on 19 pathsGET 13POST 6DELETE 1
- Main resources
- Meta 6Questions 6Quizzes 4Sessions 4
- Response formats
application/json- Description format
- OpenAPI 3.0.0, API version
1.0.0 - Links
- OpenAPI document
How to test the The Trivia API in Swastik Codes
- Open the APISelect “Fork & run in Swastik Codes” on this page. Sign in or create a free account if asked.
- Fork it into your workspaceChoose a workspace. You get your own copy of the The Trivia API collection, without the publisher's secrets.
- Add your credentialsThis API uses an API key in the X-API-Key header. Add yours in the collection's variables or an environment; the requests already reference it.
- Send a requestPick an endpoint, for example “Get all quizzes for a given user” (GET /quizzes), and press Send. Check the response, add tests and run the whole collection with the runner.
Frequently asked questions
What is the The Trivia API?
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… It is listed under Media & content and has 20 endpoints.
Who publishes the The Trivia API?
It is listed from The Trivia API's public API description (an OpenAPI document), not published by The Trivia API on Swastik Codes. Anyone who controls the-trivia-api.com can claim the profile by adding a DNS TXT record.
What is the base URL of the The Trivia API?
Requests go to https://the-trivia-api.com/v2. Endpoint paths are added to this base URL.
How do I authenticate with the The Trivia API?
With an API key in the X-API-Key header.
How many endpoints does the The Trivia API have?
20 operations on 19 paths (13 GET, 6 POST, 1 DELETE). The largest groups are Meta, Questions, Quizzes, Sessions.
Is forking the The Trivia API free?
Yes. Forking copies the collection into your workspace for free. It has been starred 0 times and forked 0 times.