Errors
PreviewHow the Luso8 API reports errors, what each status code means and which requests are safe to retry.
Preview
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
| Status | Meaning | Typical cause |
|---|---|---|
200 OK / 201 Created | Success | |
204 No Content | Success, no body | Some deletes |
400 Bad Request | The request cannot be processed | An operation that is not allowed in the current state, such as launching a campaign that is not reviewed |
401 Unauthorized | Not authenticated | Invalid API key: missing, malformed, revoked or unknown key, or an expired OAuth token |
403 Forbidden | Authenticated, but not allowed | Missing scope: contacts:write, or the resource is restricted to admins |
404 Not Found | The resource does not exist in this workspace | Wrong ID, or the record belongs to another workspace |
409 Conflict | The request conflicts with the current state | Duplicate records, or acting on something that is not active |
422 Unprocessable Entity | Validation failed | Missing required fields, wrong types, invalid formats |
429 Too Many Requests | Rate limit exceeded | More than 600 requests per minute with one key. See Rate limits. |
500 Internal Server Error | Unexpected error on our side | Retry later; contact us if it persists |
502 / 503 / 504 | Temporarily unavailable | Deploys or upstream timeouts. Retry with backoff. |
Authentication and scope errors
{ "detail": "Invalid API key" }{ "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
| Status | Retry? |
|---|---|
429 | Yes, after Retry-After seconds |
500, 502, 503, 504 | Yes, with exponential backoff and jitter, up to a few attempts |
| Network errors and timeouts | Yes for GET, PUT and DELETE. For POST, check whether the record was created before retrying to avoid duplicates. |
Other 4xx | No. Fix the request first. |
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_attemptsReporting 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.
Last updated on