Authentication

Welcome to the Allcbtapi documentation. Our API gives you programmatic access to a massive database of CBT past questions.

All requests must be authenticated. Pass your API key via the X-API-Key header or as a URL query parameter (?api_key=YOUR_KEY).

Base URL: https://allcbtapi.com/api/v1

HTTP StatusMeaning
200 OKRequest was successful.
401 UnauthorizedMissing or invalid API key.
402 Payment RequiredInsufficient wallet balance.
429 Too Many RequestsRate limit exceeded.
allcbtapi.com - Auth
cURL
PHP
Python
Node.js
Go
Java
Ruby
C#

                    
> HTTP 401 Unauthorized
{
  "status": 401,
  "message": "Invalid API Key provided."
}

Fetch Questions

Endpoint: GET /questions

Retrieve a list of questions formatted with standard options. The API natively supports MathJax/LaTeX formatting for complex mathematical equations, as demonstrated in the output terminal.

ParameterTypeRequiredDescription
subjectstringYesSubject slug (e.g. mathematics).
yearintegerNoFilter by exam year.
limitintegerNoNumber of questions to return (max 20, default 10).

Note: To properly render mathematics equations (like the one shown in the terminal preview), you should include the MathJax library in your frontend application.

allcbtapi.com - Questions
cURL
PHP
Python
Node.js
Go
Java
Ruby
C#

                    
> Executing request... HTTP 200 OK
{
  "status": 200,
  "data": {
    "id": 4821,
    "question": "Evaluate the integral \\( \\int_0^2 (3x^2 - 2x + 1) \\,dx \\)",
    "section": null,
    "option": {
      "a": "6",
      "b": "8",
      "c": "4",
      "d": "10"
    },
    "answer": "a",
    "solution": "Integrating yields \\( x^3 - x^2 + x \\). Evaluated from 0 to 2: (8 - 4 + 2) - 0 = 6.",
    "image": null,
    "examtype": "UTME",
    "examyear": "2022"
  }
}

List Subjects

Endpoint: GET /subjects

Retrieve a list of all available subjects in the database. Use the slug returned by this endpoint when filtering questions.

allcbtapi.com - Subjects
cURL
PHP
Python
Node.js
Go
Java
Ruby
C#

                    
> Executing request... HTTP 200 OK
{
  "status": 200,
  "data": [
    {
      "name": "Mathematics",
      "slug": "mathematics"
    },
    {
      "name": "Physics",
      "slug": "physics"
    }
  ]
}