Skip to main content
Clausum uses conventional HTTP status codes. 2xx indicates success, 4xx indicates a problem with your request, and 5xx indicates a problem on Clausum’s side.

Status codes

StatusMeaning
200Success
201Resource created
400Validation error — missing or invalid fields
401Unauthorized — missing, invalid, disabled, revoked, or expired credential
403Forbidden — authenticated but missing the required permission or role
404Not found
409Conflict — resource already exists or already in the target state
429Too many requests — rate limit exceeded
500Internal server error
503Service unavailable

Error shape

Most management endpoints return a structured error object:
{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "list_type and value are required",
    "details": {}
  }
}
Partner API endpoints (/api/v1/assess, /api/v1/report-fraud, /api/v1/merchant/*) always return the structured object above, including codes such as SECRET_KEY_REQUIRED, PUBLIC_KEY_NOT_ALLOWED, and RATE_LIMIT_EXCEEDED.
Use error.message for user-facing copy and error.code for branching logic. On 429, honor X-RateLimit-Reset and back off.

Common codes

CodeTypical cause
UNAUTHORIZEDNo or bad credential
FORBIDDENKey/role lacks permission
VALIDATION_ERRORMissing or malformed body / params
INVALID_TYPEUnsupported list_type
INVALID_SEVERITYUnsupported severity
DUPLICATEEntry already exists
NOT_FOUNDResource does not exist
RATE_LIMITEDToo many requests
INTERNAL_ERRORUnexpected server error

Handling errors

const res = await fetch(url, options)

if (!res.ok) {
  const body = await res.json().catch(() => ({}))
  const message = typeof body.error === "string" ? body.error : body.error?.message
  const code = typeof body.error === "object" ? body.error?.code : undefined

  switch (res.status) {
    case 401: throw new AuthError(message)
    case 403: throw new PermissionError(message)
    case 429: return retryWithBackoff()
    default:  throw new ClausumError(code, message)
  }
}
For 5xx and 429 responses, retry with exponential backoff. For 4xx responses other than 429, fix the request — retrying won’t help.