SilentChat

Error Codes

When a request fails the SilentChat API returns a JSON error response with a consistent structure. This page documents the response format, all error codes, and the HTTP status codes used.

Error Response Format

Every error response has the following shape:

{
"error": {
"code": "VALIDATION_ERROR",
"message": "The 'email' field must be a valid email address.",
"status": 400
}
}
FieldTypeDescription
error.codestringA machine-readable error code in SCREAMING_SNAKE_CASE. Use this for programmatic error handling.
error.messagestringA human-readable message describing what went wrong. Safe to display to end users.
error.statusnumberAn optional object with additional context, such as field-level validation errors.

Error Codes

CodeHTTP StatusDescription
AUTH_MISSING_TOKEN401No valid credentials were provided or the access token has expired.
AUTH_INVALID_TOKEN401The provided token is malformed or has an invalid signature.
AUTH_TOKEN_REVOKED401The JWT access token has expired. Refresh it using your refresh token.
AUTH_INVALID_CREDENTIALS401No valid credentials were provided or the access token has expired.
AUTH_EMAIL_NOT_VERIFIED403The authenticated user does not have permission to perform this action.
FORBIDDEN403The authenticated user does not have permission to perform this action.
TENANT_REQUIRED400One or more request fields failed validation. See details for field-level errors.
TENANT_NOT_FOUND404The requested resource does not exist or is not accessible.
VALIDATION_ERROR400One or more request fields failed validation. See details for field-level errors.
NOT_FOUND404The requested resource does not exist or is not accessible.
CONFLICT409The request conflicts with the current state of the resource (e.g. duplicate email).
RATE_LIMITED429Too many requests. Slow down and retry after the duration indicated in the Retry-After header.
WIDGET_KEY_INVALID401The webhook payload could not be verified. Check your signing secret.
WIDGET_DOMAIN_NOT_ALLOWED403The authenticated user does not have permission to perform this action.
FILE_TOO_LARGE400One or more request fields failed validation. See details for field-level errors.
PLAN_LIMIT_EXCEEDED403Your current plan does not allow this action. Upgrade to unlock this feature.
INTERNAL_ERROR500An unexpected server error occurred. If this persists, contact support.

HTTP Status Codes

The API uses standard HTTP status codes. Here is a summary of the codes you may encounter:

StatusMeaningWhen
200OKThe request succeeded.
201CreatedA new resource was created successfully.
204No ContentThe request succeeded with no response body (e.g. after a DELETE).
400Bad RequestThe request was malformed or failed validation.
401UnauthorizedAuthentication is required or credentials are invalid.
403ForbiddenThe caller is authenticated but not authorised to perform the action.
404Not FoundThe resource was not found.
409ConflictThe request conflicts with the current resource state.
429Too Many RequestsThe caller has exceeded the rate limit.
500Internal Server ErrorAn unexpected server-side error occurred.

Handling Errors in Code

Always check the code field rather than the error message string — the message may change between releases, but error codes are stable.

const response = await fetch('https://api.silentchat.de/v1/conversations', {
headers: {
'Authorization': 'Bearer ' + accessToken,
'Content-Type': 'application/json',
},
});
if (!response.ok) {
const { error } = await response.json();
switch (error.code) {
case 'AUTH_INVALID_TOKEN':
// Token expired - refresh and retry
break;
case 'RATE_LIMITED':
// Wait and retry
const retryAfter = response.headers.get('Retry-After');
break;
case 'VALIDATION_ERROR':
// Fix request parameters
console.error('Validation:', error.message);
break;
default:
console.error(`API error [${error.code}]: ${error.message}`);
}
}
Error Codes | SilentChat