Ardent AfricaDocs
Developers

The error envelope

The consistent error shape returned by the public API.

Successful responses return the resource directly (an object, or a paginated list). Failed responses always use one envelope:

{
  "ok": false,
  "error": {
    "code": "NOT_FOUND",
    "message": "The requested resource was not found.",
    "ref": "err_01J..."
  }
}
  • code: a stable, machine-readable error code.
  • message: a human-readable, safe message.
  • ref: a unique reference for the request. Include it if you contact support.

Codes you may see

HTTPcodeWhen
400VALIDATION_FAILEDa query parameter is invalid (for example limit over 50)
401UNAUTHORIZEDthe x-api-key you sent is invalid or revoked
404NOT_FOUNDno resource matches the slug or username
429RATE_LIMITEDyou exceeded your rate limit
503SERVICE_UNAVAILABLEa backing service is temporarily unavailable

Handling errors

const res = await fetch(url, { headers: { 'x-api-key': key } })
const body = await res.json()
if (!res.ok || body.ok === false) {
  // body.error.code, body.error.message, body.error.ref
  throw new Error(`${body.error.code}: ${body.error.message}`)
}

A missing key is not an error: keyless requests simply use the lower rate tier.

Last updated: 18 June 2026

On this page