Corteksa

Errors

Errors

Corteksa uses standard HTTP status codes and a consistent JSON error shape, so you can handle failures the same way across every endpoint.

Error shape

{
  "statusCode": 403,
  "message": "You do not have permission to perform this action",
  "error": "Forbidden"
}

Validation errors return an array of messages:

{
  "statusCode": 400,
  "message": ["email must be an email", "name should not be empty"],
  "error": "Bad Request"
}

Status codes

CodeMeaningCommon causeFix
400Bad RequestMissing/invalid field, wrong enum, bad bodyCheck the message array; key record bodies by field slug
401UnauthorizedMissing/expired token or API keyRe-authenticate; send Authorization: Bearer or X-Api-Key
403ForbiddenAuthenticated, but the role/key lacks the permission or scopeGrant the read.* / create.* scope or raise the access level
404Not FoundWrong slug — or a record outside your visibility (masked)Verify the slug; check your access level
409ConflictDuplicate / concurrent writeRetry or resolve the duplicate
422UnprocessableBusiness-rule validation failedRead message for the specific rule
429Too Many RequestsRate limit hitBack off and retry with the standard backoff
500Server ErrorUnexpected fault (reported to Sentry)Retry; if it persists, contact support

Auth: 401 vs 403

  • 401 = "I don't know who you are" — the credential is missing or invalid.
  • 403 = "I know who you are, but you can't do this" — the permission/scope or access level (A > G > M > D) forbids it.

The 404 that's really a 403

Some resources (a chat or record outside your scope) are masked as 404 rather than 403, so you can't probe for things you can't see. If you're sure it exists, your access level is too low — see Authorization.

Handle errors well

  • Parse message (string or array) for a user-facing reason.
  • Retry 429 and 5xx with exponential backoff; never retry 4xx blindly.
  • Treat 401 as "refresh and retry once", then send the user to log in.

On this page