Skip to main content

Error Codes

All API errors return a consistent JSON structure with machine-readable codes for programmatic handling.

Error Format

{
"error": {
"message": "Invalid request body",
"statusCode": 400,
"code": "VALIDATION_ERROR",
"category": "VALIDATION",
"details": [{ "path": "events.0.type", "message": "Invalid enum value" }]
}
}
FieldTypeDescription
messagestringHuman-readable error description
statusCodenumberHTTP status code
codestringMachine-readable error code
categorystringError category (see below)
detailsanyAdditional context (validation errors, etc.)

Error Categories

CategoryDescription
VALIDATIONRequest body, query, or params failed schema validation
AUTHAuthentication or authorization failure
NOT_FOUNDRequested resource does not exist
CONFLICTResource already exists or is in use
RATE_LIMITRequest rate exceeded allowed threshold
EXTERNAL_SERVICEThird-party service (Google, AI provider) failed
INTERNALUnexpected server error

Common Error Codes

Validation Errors (400)

CodeDescription
VALIDATION_ERRORRequest body or parameters failed Zod schema validation
INVALID_INVITE_TOKENInvite token is malformed or expired
INVALID_RESET_TOKENPassword reset token is malformed or expired
MISSING_TENANT_IDCompany context could not be determined

Authentication Errors (401)

CodeDescription
AUTH_FAILEDAPI key is missing, invalid, revoked, or expired
AUTH_NO_TOKENNo JWT token found in cookie or Authorization header
AUTH_INVALID_TOKENJWT token is malformed or expired
AUTH_TOKEN_REVOKEDJWT token has been explicitly revoked
AUTH_INVALID_CREDENTIALSEmail/password combination is incorrect
AUTH_PROVIDER_MISMATCHAccount was registered with a different auth method (e.g., Google)
AUTH_NO_REFRESH_TOKENRefresh token cookie is missing
AUTH_INVALID_REFRESH_TOKENRefresh token is invalid or expired

Authorization Errors (403)

CodeDescription
FORBIDDENValid authentication but insufficient permissions
INSUFFICIENT_ROLEUser role does not have access to this operation

Not Found Errors (404)

CodeDescription
NOT_FOUNDGeneric resource not found
USER_NOT_FOUNDReferenced user does not exist
TENANT_NOT_FOUNDReferenced company does not exist
CONTENT_NOT_FOUNDFlow, tooltip, survey, or other content not found

Conflict Errors (409)

CodeDescription
EMAIL_EXISTSEmail address is already registered
TENANT_EXISTSA company with this name already exists
MEMBER_EXISTSUser is already a member of this company
AUDIENCE_IN_USEAudience is referenced by active content and cannot be deleted

Rate Limit Errors (429)

CodeDescription
RATE_LIMITEDToo many requests. Check Retry-After header for when to retry

Internal Errors (500)

CodeDescription
INTERNAL_ERRORUnexpected server error
EXTERNAL_SERVICE_ERRORThird-party service call failed
REGISTRATION_FAILEDUser/company registration could not be completed

Troubleshooting

401 on SDK routes: Verify the API key is passed via the X-API-Key header (not Authorization: Bearer). Ensure the key has not been revoked in the dashboard.

400 with validation details: Check the details array for specific field paths and messages. Event payloads require a valid type field from the supported event types.

429 rate limited: SDK routes allow 600 requests/min per API key. Batch multiple events in a single POST /api/sdk/events request instead of sending them individually.

500 errors: Retry with exponential backoff. If persistent, check the API health endpoint at GET /api/health.