Skip to Content

Errors

Preview

How the Luso8 API reports errors, what each status code means and which requests are safe to retry.

Preview

This feature is in preview. The contract documented here is stable enough to build against, but details may still change before general availability.

The Luso8 API uses conventional HTTP status codes. Codes in the 2xx range mean success, 4xx means something about the request needs to change, and 5xx means something went wrong on our side.

Error body

Errors return a JSON object with a detail field. For most errors it is a human-readable message:

{ "detail": "Invalid API key" }

Validation errors (422) return detail as an array, one entry per invalid field:

{
  "detail": [
    {
      "type": "value_error",
      "loc": ["body", "email"],
      "msg": "value is not a valid email address: An email address must have an @-sign.",
      "input": "ada.lovelace.example.com"
    },
    {
      "type": "missing",
      "loc": ["body", "contact_ids"],
      "msg": "Field required",
      "input": {}
    }
  ]
}

loc is the path to the problem: where it was sent (body, query, path) followed by the field name.

Messages are meant for developers and may change. Branch on the status code, not on the message text.

Status codes

StatusMeaningTypical cause
200 OK / 201 CreatedSuccess
204 No ContentSuccess, no bodySome deletes
400 Bad RequestThe request cannot be processedAn operation that is not allowed in the current state, such as launching a campaign that is not reviewed
401 UnauthorizedNot authenticatedInvalid API key: missing, malformed, revoked or unknown key, or an expired OAuth token
403 ForbiddenAuthenticated, but not allowedMissing scope: contacts:write, or the resource is restricted to admins
404 Not FoundThe resource does not exist in this workspaceWrong ID, or the record belongs to another workspace
409 ConflictThe request conflicts with the current stateDuplicate records, or acting on something that is not active
422 Unprocessable EntityValidation failedMissing required fields, wrong types, invalid formats
429 Too Many RequestsRate limit exceededMore than 600 requests per minute with one key. See Rate limits.
500 Internal Server ErrorUnexpected error on our sideRetry later; contact us if it persists
502 / 503 / 504Temporarily unavailableDeploys or upstream timeouts. Retry with backoff.

Authentication and scope errors

401
{ "detail": "Invalid API key" }
403
{ "detail": "Missing scope: contacts:write" }

A 403 for a missing scope names the exact scope to add. Create a key with that scope in Settings›Developers›API keys, or ask a workspace admin to. See API keys.

Retrying

StatusRetry?
429Yes, after Retry-After seconds
500, 502, 503, 504Yes, with exponential backoff and jitter, up to a few attempts
Network errors and timeoutsYes for GET, PUT and DELETE. For POST, check whether the record was created before retrying to avoid duplicates.
Other 4xxNo. Fix the request first.
retry.py
RETRYABLE = {429, 500, 502, 503, 504}

def should_retry(status: int, attempt: int, max_attempts: int = 5) -> bool:
    return status in RETRYABLE and attempt < max_attempts

Reporting a problem

If an error looks wrong, email hello@rexplore.ai with the method, path, status code, time of the request (with time zone) and the response body. Never send your API key.

Edit on GitHub

Last updated on

On this page