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 Status | Meaning |
|---|---|
200 OK | Request was successful. |
401 Unauthorized | Missing or invalid API key. |
402 Payment Required | Insufficient wallet balance. |
429 Too Many Requests | Rate limit exceeded. |
{
"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.
| Parameter | Type | Required | Description |
|---|---|---|---|
subject | string | Yes | Subject slug (e.g. mathematics). |
year | integer | No | Filter by exam year. |
limit | integer | No | Number 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.
{
"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.
{
"status": 200,
"data": [
{
"name": "Mathematics",
"slug": "mathematics"
},
{
"name": "Physics",
"slug": "physics"
}
]
}