The Open Triviata Database provides a completely free JSON API for use in programming projects, providing questions sourced from The Open Trivia Database. If you don't need question ID numbers or unencoded data, the original Open Trivia Database will serve you perfectly well :)
To get started using the Open Triviata Database API, use this URL:
For more settings or help using the API, read along below. Alternatively, you can use the ‘Build a Request’ form to craft your specific query.
To retrieve one or more questions by ID number, simply use the 'ids' parameter with a comma-separated list (NOTE: all other parameters will be discarded with the exception of encode):
Session Tokens are unique keys that will help keep track of the questions the API has already retrieved. By appending a Session Token to a API Call, the API will never give you the same question twice. Over the lifespan of a Session Token, there will eventually reach a point where you have exhausted all the possible questions in the database. At this point, the API will respond with the approperate ‘Response Code’. From here, you can either ‘Reset’ the Token, which will wipe all past memory, or you can ask for a new one.
Session Tokens will be deleted after 6 hours of inactivity.
|0||Success Results successfully returned.|
|1||No Results The API doesn't have enough questions to satisfy query. (Eg requesting 50 Questions in a Category that only has 20.)|
|2||Invalid Parameter One or more arguments aren't valid. (Eg amount=Five)|
|3||Token Not Found Session Token does not exist.|
|4||Token Empty Session Token has returned all possible questions for given query. Token should be reset.|
|5||ID Not Found Question ID does not exist. Response includes array of offending IDs.|
The Open Triviata Database may contain questions which contain Unicode or Special Characters. For this reason, the API returns results in a encoded format. You can specify the desired encoding format using the examples below. If the encode type is not present in the URL, it will follow the default encoding. To disable encoding use the value ‘none’.
Example Sentence (Non Encoded): ‘Don't forget that π = 3.14 & doesn't equal 3.’
There are some functions in the API which can be useful to developers.