API Documentation

Introduction

The eaxeli.com quiz and trivia API is available for use to fetch questions from a range of categories for your quiz and trivia applications. No API key required.

Endpoints

Fetch questions

GEThttps://eaxeli.com/api/v1/questions/quiz

Get started by making a GET request to the URL above and fetch 50 random questions from various categories. To further tailor request to your needs, read the helper section for filtering options.

$ curl -X GET "https://eaxeli.com/api/v1/questions/quiz"

Example

Example of a JSON response:

{ "_id": "665da6676d9faa7d024c05f3", "category": "General Knowledge", "categorySlug": "general-knowledge", "question": "What is the capital of France?", "options": ["Paris", "London", "Berlin", "Rome"], "answer": "Paris", "correctIndex": 0, "type": "multiple-choice" "..." }

Helpers

A GET request to the API returns 50 random questions from various categories and types. Categories may include general knowledge, history, tourism and culture, geography and types could be multiple choice and/or true or false.

Further filter - Category

To further filter your request to a specific category, use the categorySlug parameter to filter. If you prefer working with ids, each category has a categoryId. Here is an example to fetch general knowledge questions. https://eaxeli.com/api/v1/questions/quiz?categorySlug=general-knowledge

Make a GET request to this endpoint to return all available categories with their respective counts: https://eaxeli.com/api/v1/questions/categories

Further filter - Tags

The API has a sub-category called tags. With this, you can filter and fetch questions based on US presidents, notable dates, ancient civilizations and lots more. Use the tag parameter to filter. Here is an example to fetch questions based on tourist attractions https://eaxeli.com/api/v1/questions/quiz?tags=tourist-attractions.

You can find a list of all available tags here https://eaxeli.com/api/v1/questions/tags, however, you'll need to log in to access this endpoint.

Further filter - Difficulty

Questions are classified into difficulty - easy, medium and hard. You can filter your requests to return only questions under a specific difficulty. Here is how you can fetch questions with difficulty, medium - https://eaxeli.com/api/v1/questions/quiz?difficulty=medium

Further filter - Type

You can make request from two sets of questions, multiple choice and true or false using the type parameter. If you do not specify type, a mix of both would be returned. Here is how you can fetch questions with type, multiple choice - https://eaxeli.com/api/v1/questions/quiz?type=multiple-choice

Furthermore, each question has an info parameter, which is a brief note on the question, a hint parameter, which aims to point your to the correct answer. Check user's answer using string with the answer parameter or checking the correct index using the correctIndex parameter.