API Reference

Quizzes API

Create, retrieve, update, and delete quizzes. The Quizzes API is the core of QuizAPI, giving you full control over your quiz content.

The Quiz Object

A quiz represents a collection of questions with associated metadata and settings.

AttributeTypeDescription
idstringUnique identifier for the quiz (e.g., quiz_abc123)
titlestringThe title of the quiz
descriptionstring | nullOptional description
categorystringCategory slug (e.g., programming, science, math)
difficultystringOne of: EASY, MEDIUM, HARD, EXPERT
tagsstring[]Array of tag strings for filtering
questionCountintegerNumber of questions in the quiz
playsintegerTotal number of times the quiz has been played
GET/api/v1/quizzes

List Quizzes

Returns a paginated list of quizzes. You can filter by category, difficulty, and tags.

Query Parameters

ParameterTypeDefaultDescription
categorystring-Filter by category (e.g., programming, science)
difficultystring-Filter by difficulty: beginner, intermediate, advanced
tagsstring-Comma-separated list of tags to filter by
limitinteger20Number of results to return (1-100)
offsetinteger0Number of results to skip for pagination

Example Request

bash
curl -X GET "https://quizapi.io/api/v1/quizzes?category=programming&limit=10" \
  -H "Authorization: Bearer YOUR_API_KEY"

Example Response

json
{
  "success": true,
  "data": [
    {
      "id": "quiz_abc123",
      "title": "JavaScript Fundamentals",
      "description": "Test your knowledge of JS basics",
      "category": "programming",
      "difficulty": "MEDIUM",
      "tags": ["javascript", "web"],
      "questionCount": 10,
      "plays": 1250
    },
    {
      "id": "quiz_def456",
      "title": "Python Data Structures",
      "description": "Test your knowledge of Python data structures",
      "category": "programming",
      "difficulty": "EASY",
      "tags": ["python", "data-structures"],
      "questionCount": 15,
      "plays": 830
    }
  ],
  "meta": {
    "total": 42,
    "limit": 10,
    "offset": 0
  }
}
GET/api/v1/quizzes/:id

Get a Quiz

Retrieves a single quiz by its ID, including its full questions array and settings.

Path Parameters

ParameterTypeDescription
idstringThe quiz ID (e.g., quiz_abc123)

Example Request

bash
curl -X GET "https://quizapi.io/api/v1/quizzes/quiz_abc123" \
  -H "Authorization: Bearer YOUR_API_KEY"

Example Response

json
{
  "success": true,
  "data": {
    "id": "quiz_abc123",
    "title": "JavaScript Fundamentals",
    "description": "Test your knowledge of JS basics",
    "category": "programming",
    "difficulty": "MEDIUM",
    "tags": ["javascript", "web"],
    "questionCount": 10,
    "plays": 1250
  },
  "meta": {
    "total": 1,
    "limit": 1,
    "offset": 0
  }
}
POST/api/v1/quizzes

Create a Quiz

Creates a new quiz. Requires an authenticated API key with write permissions.

Request Body

FieldTypeRequiredDescription
titlestringRequiredTitle of the quiz (max 200 characters)
descriptionstringOptionalDescription of the quiz
categorystringRequiredCategory for the quiz
difficultystringOptionalDifficulty level (beginner, intermediate, advanced). Defaults to intermediate.
tagsstring[]OptionalArray of tags (max 10)
settingsobjectOptionalQuiz settings object (time_limit, shuffle_questions, passing_score)

Example Request

bash
curl -X POST "https://quizapi.io/api/v1/quizzes" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "React Hooks Quiz",
    "description": "Test your knowledge of React hooks",
    "category": "programming",
    "difficulty": "MEDIUM",
    "tags": ["react", "hooks"]
  }'

Example Response

json
{
  "success": true,
  "data": {
    "id": "quiz_new789",
    "title": "React Hooks Quiz"
  }
}

Response Format

All API responses follow a consistent format. Successful single-object responses wrap the result in a data key. List endpoints include a meta object for pagination.

Status CodeDescription
200Successful request
201Resource created successfully
400Bad request (validation error)
401Unauthorized (missing or invalid API key)
404Resource not found
429Rate limit exceeded