Skip to content

Sample a random or seeded subset of questions for quick quiz flows.

GET
/api/v1/questions/sample
curl --request GET \
--url 'https://api.utmelab.com/api/v1/questions/sample?exam=example&subject=example' \
--header 'X-API-Key: <X-API-Key>'
exam
required
string

Scope to an exam (e.g. JAMB).

subject
required
string

Scope to a subject slug (e.g. physics).

count
integer | null format: int32

Number of questions to draw. Clamped to 1..50. Default: 15.

seed
integer | null format: int64

Optional deterministic seed for 1-on-1 challenges or reproducible tests.

verified
boolean | null

Only verified questions. Default: true.

topic
string | null

Optional drill to a specific topic slug.

subtopic
string | null

Optional drill to a specific subtopic.

year
integer | null format: int32

Scope to a cohort year.

country
string | null

Scope to a country; a question with no stated scope survives any.

include_explanation
boolean | null

Include the answer and the working. Default: false.

include_passage
boolean | null

Include companion passages for questions referencing them. Default: false.

Media typeapplication/json

A sampled set of questions for fast practice or quick quiz flows.

object
count
required
integer
exam
required
string
passages
object | null
questions
required
Array<object>

One question as served. Identical to storage except the answer and working, which are present only when explicitly requested. An answer in a default payload gets rendered by somebody, eventually, by accident. verified comes from the verification log, never a stored flag.

object
answer

Present only when explanations were requested.

string | null
difficulty
required
integer format: int32
exam
required
string
explanation
One of:

Why the answer is what it is: teaser, working, and the distractor that catches people.

object
body
required

Plain text plus offset marks. text stays searchable as characters; structure rides in inline as Unicode-scalar offsets, never bytes.

object
inline
required
Array

One offset mark. Serialised flat with an adjacent kind tag, e.g. {"start":24,"len":6,"kind":"underline"}.

object
One of:
object
kind
required
string
Allowed values: bold
len
required

Length in Unicode scalar values. Zero for an image anchor, which marks an attachment point rather than a span.

integer format: int32
start
required

Offset in Unicode scalar values from the start of text.

integer format: int32
text
required
string
key_point
required

Plain text plus offset marks. text stays searchable as characters; structure rides in inline as Unicode-scalar offsets, never bytes.

object
inline
required
Array

One offset mark. Serialised flat with an adjacent kind tag, e.g. {"start":24,"len":6,"kind":"underline"}.

object
One of:
object
kind
required
string
Allowed values: bold
len
required

Length in Unicode scalar values. Zero for an image anchor, which marks an attachment point rather than a span.

integer format: int32
start
required

Offset in Unicode scalar values from the start of text.

integer format: int32
text
required
string
trap
One of:

Plain text plus offset marks. text stays searchable as characters; structure rides in inline as Unicode-scalar offsets, never bytes.

object
inline
required
Array

One offset mark. Serialised flat with an adjacent kind tag, e.g. {"start":24,"len":6,"kind":"underline"}.

object
One of:
object
kind
required
string
Allowed values: bold
len
required

Length in Unicode scalar values. Zero for an image anchor, which marks an attachment point rather than a span.

integer format: int32
start
required

Offset in Unicode scalar values from the start of text.

integer format: int32
text
required
string
id
required
string
lesson_refs

Lessons that teach the idea assessed by this question.

Array<object>
object
id
required
string
order

Canonical position of this reference within its parent.

integer format: int32
title
string
marks
required
number format: float
options
required
Array<object>
object
id
required
string
text
required

Plain text plus offset marks. text stays searchable as characters; structure rides in inline as Unicode-scalar offsets, never bytes.

object
inline
required
Array

One offset mark. Serialised flat with an adjacent kind tag, e.g. {"start":24,"len":6,"kind":"underline"}.

object
One of:
object
kind
required
string
Allowed values: bold
len
required

Length in Unicode scalar values. Zero for an image anchor, which marks an attachment point rather than a span.

integer format: int32
start
required

Offset in Unicode scalar values from the start of text.

integer format: int32
text
required
string
passage
One of:

The attached stimulus if requested.

object
author
string | null
exam
required
string
id
required
string
kind
required
string
subject
required
string
text
required

Plain text plus offset marks. text stays searchable as characters; structure rides in inline as Unicode-scalar offsets, never bytes.

object
inline
required
Array

One offset mark. Serialised flat with an adjacent kind tag, e.g. {"start":24,"len":6,"kind":"underline"}.

object
One of:
object
kind
required
string
Allowed values: bold
len
required

Length in Unicode scalar values. Zero for an image anchor, which marks an attachment point rather than a span.

integer format: int32
start
required

Offset in Unicode scalar values from the start of text.

integer format: int32
text
required
string
title
string | null
year
required
integer format: int32
passage_id

A stimulus this row belongs to. Fetch it, never ignore it: the stem may be unanswerable without it.

string | null
section
string | null
source
required
string
subject
required
string
subtopic_id
string | null
text
required

Plain text plus offset marks. text stays searchable as characters; structure rides in inline as Unicode-scalar offsets, never bytes.

object
inline
required
Array

One offset mark. Serialised flat with an adjacent kind tag, e.g. {"start":24,"len":6,"kind":"underline"}.

object
One of:
object
kind
required
string
Allowed values: bold
len
required

Length in Unicode scalar values. Zero for an image anchor, which marks an attachment point rather than a span.

integer format: int32
start
required

Offset in Unicode scalar values from the start of text.

integer format: int32
text
required
string
topic_slug

The syllabus topic tag for this question when the catalogue provides one.

string | null
verified
required
boolean
year
required
integer format: int32
subject
required
string
total_available
required
integer

Example

{
"questions": [
{
"explanation": {
"body": {
"inline": [
{
"kind": "bold"
}
]
},
"key_point": {
"inline": [
{
"kind": "bold"
}
]
},
"trap": {
"inline": [
{
"kind": "bold"
}
]
}
},
"options": [
{
"text": {
"inline": [
{
"kind": "bold"
}
]
}
}
],
"passage": {
"text": {
"inline": [
{
"kind": "bold"
}
]
}
},
"text": {
"inline": [
{
"kind": "bold"
}
]
}
}
]
}

An API key is missing or invalid.

Media typeapplication/json

Stable body returned by HTTP error responses.

object
code
required
string
error
required
string

Example generated

{
"code": "example",
"error": "example"
}

The API key lacks the required scope.

Media typeapplication/json

Stable body returned by HTTP error responses.

object
code
required
string
error
required
string

Example generated

{
"code": "example",
"error": "example"
}

A subject the bank never had

Media typeapplication/json

Stable body returned by HTTP error responses.

object
code
required
string
error
required
string

Example generated

{
"code": "example",
"error": "example"
}

The caller has exceeded the applicable rate limit.

Media typeapplication/json

Stable body returned by HTTP error responses.

object
code
required
string
error
required
string

Example generated

{
"code": "example",
"error": "example"
}

The API is temporarily unavailable.

Media typeapplication/json

Stable body returned by HTTP error responses.

object
code
required
string
error
required
string

Example generated

{
"code": "example",
"error": "example"
}