REST API Reference

ExamsWave Developer API

Programmatically pull practice exam questions, vector-rendered math/science diagrams, and full exam blueprints directly into your LMS or learning application.

Base Request Format

GET /api.php?action=fetch_questions

// Header

Authorization: Bearer YOUR_API_KEY

// Request URL

https://examswave.com/api.php?action=fetch_questions&framework=alevels&subject=mathematics&limit=100

Authentication & Access Control

The ExamsWave API authenticates requests using Bearer Tokens in the HTTP header or via query string parameter (?key=...). Direct API access is restricted exclusively to Partner accounts with bulk seat balances.

HEADER Option A: Bearer Token (Recommended)

Provide your API key in the standard Authorization header with every request.

Authorization: Bearer YOUR_API_KEY

URL PARAMETER Option B: Query Parameter

Pass the key directly in the request query string for rapid browser testing.

https://examswave.com/api.php?action=ping&key=YOUR_API_KEY

API Endpoints Reference

All API calls execute through the main gateway controller /api.php using the action parameter.

GET action=ping
Aliases: auth_check, check

Validates your API credentials, role entitlement, subscription status, and remaining bulk seat credits.

Sample Request URL

https://examswave.com/api.php?action=ping&key=YOUR_API_KEY

JSON Response Object (200 OK)

{
  "status": "success",
  "message": "API key validated successfully.",
  "user": {
    "id": 101,
    "name": "Jane Doe",
    "email": "jane@partner-lms.com",
    "role": "partner",
    "bulk_seats_left": 450,
    "subscription_status": "active",
    "subscription_expires_at": "2026-12-31 23:59:59"
  }
}
GET action=get_frameworks
Aliases: blueprints, exams

Returns paginated active exam blueprints (10 per page), subject mappings, time limits, and supported languages.

Query Parameters

Parameter Type Required Description
q string Optional Search query for exam name or subjects (e.g., alevels)
country string Optional Filter blueprints by country code (e.g., US, UK)
id integer Optional Fetch a single blueprint by explicit ID
page integer Optional Page index for pagination (Default: 1, Batch Size: 10)

Sample Response (200 OK)

{
  "status": "success",
  "batch_size": 10,
  "page": 1,
  "quota_max_allowed": 900,
  "count": 1,
  "data": [
    {
      "id": 1,
      "exam_name": "A-Levels Advanced",
      "slug": "alevels",
      "country": "UK",
      "total_exam_questions": 100,
      "time_limit_minutes": 180,
      "is_active": true,
      "subjects": ["Mathematics", "Physics", "Chemistry"],
      "languages": ["English"]
    }
  ]
}
GET action=fetch_questions
Aliases: questions

Generates a randomized set of practice questions dynamically balanced across blueprint subjects. Charges 1 seat credit per call and returns clean sequential serial IDs (1, 2, ..., N).

Query Parameters

Parameter Type Required Description
framework / blueprint_id / exam_id string / int Yes Framework search key/slug (e.g., alevels) or explicit blueprint_id integer
subject string Optional Filter by explicit subject module (e.g., mathematics). Omit to distribute across all subjects equally.
limit integer Optional Target count override (Defaults to blueprint total, e.g., 100)
language string Optional Target language filter (Default: English)

Sample Connection Requests

// Fetch balanced exam test paper (100 questions randomized across blueprint subjects)
https://examswave.com/api.php?action=fetch_questions&key=YOUR_API_KEY&framework=alevels
// Fetch subject specific questions
https://examswave.com/api.php?action=fetch_questions&key=YOUR_API_KEY&blueprint_id=1&subject=Mathematics&limit=33

JSON Response Object (200 OK)

{
  "status": "success",
  "exam": "A-Levels Advanced",
  "language": "English",
  "requested_limit": 100,
  "count": 100,
  "credits_deducted": 1,
  "bulk_seats_left": 449,
  "data": [
    {
      "id": 1,
      "exam_id": 1,
      "subject": "Mathematics",
      "language": "English",
      "question_text": "Which coordinate accurately marks the point of inflection on the curve?",
      "image_xml": "",
      "correct_option": "A",
      "explanation": "The point of inflection occurs where concavity changes sign at coordinate (0,0).",
      "created_at": "2026-01-15 10:30:00",
      "options": {
        "A": "(0, 0) — Turning point coordinate threshold",
        "B": "(50, 10) — Maximum boundary curve",
        "C": "(100, 50) — Axis intercept",
        "D": "(190, 10) — Endpoint"
      }
    },
    {
      "id": 2,
      "exam_id": 1,
      "subject": "Physics",
      "language": "English",
      "question_text": "Calculate the terminal velocity of an object falling through a fluid.",
      "image_xml": null,
      "correct_option": "B",
      "explanation": "Terminal velocity is reached when drag force equals gravitational force.",
      "created_at": "2026-02-01 11:20:00",
      "options": {
        "A": "12.5 m/s",
        "B": "24.8 m/s",
        "C": "9.8 m/s",
        "D": "0 m/s"
      }
    }
  ]
}

Error Handling & Status Codes

401 UNAUTHORIZED

Returned when the API key is missing or invalid.

{
  "status": "error",
  "code": 401,
  "message": "Unauthorized: Invalid API Key or user account not found."
}
403 FORBIDDEN

Returned when account role is not 'partner'.

{
  "status": "error",
  "code": 403,
  "message": "Forbidden: API access is restricted to partner role users only."
}
429 LIMIT EXCEEDED

Returned when partner account balance has 0 bulk seats remaining.

{
  "status": "error",
  "code": 429,
  "message": "Access denied: Insufficient bulk seat balance left in account."
}