Error codes

Every API error response uses the same JSON envelope. Use the code field to handle specific cases.

Response envelope

All errors return the same top-level shape.

{
  "error": {
    "type": "invalid_request_error",
    "code": "VALIDATION_ERROR",
    "message": "key is required",
    "status": 400,
    "doc_url": "https://docs.thewitn.com/docs/errors/validation-error"
  }
}

Validation errors add a details array with the exact fields that failed. Server errors add a request_id you can share with support.

Error types

TypeWhen
invalid_request_errorThe request was malformed or rejected. Fix the request before retrying.
authentication_errorThe Authorization header is missing, malformed, or the token is not recognised.
api_errorAn unexpected server-side failure. Retry with exponential back-off. If it persists, contact support with the request_id.

Error codes

CodeStatusTypeDescription
VALIDATION_ERROR400invalid_request_errorBody or params failed schema validation.
TOKEN_INVALID401authentication_errorToken missing, malformed, or not recognised.
PAYLOAD_TOO_LARGE413invalid_request_errorEvent body exceeded the 256 KiB limit.
INTERNAL_ERROR500api_errorUnexpected server error.

On this page