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 (see table below).
error.messagestringA human-readable description of the error.
error.statusnumberThe HTTP status code.

Error Codes

CodeHTTP StatusDescription
AUTH_MISSING_TOKEN401No authentication token or API key was provided.
AUTH_INVALID_TOKEN401The token is malformed, expired, or the signature is invalid.
AUTH_TOKEN_REVOKED401The token has been revoked (e.g. after a logout or password change).
AUTH_INVALID_CREDENTIALS401The email or password is incorrect.
AUTH_EMAIL_NOT_VERIFIED403The account’s email address has not been verified.
FORBIDDEN403The authenticated user does not have permission to perform this action.
TENANT_REQUIRED400The X-Tenant-ID header is missing and is required for this endpoint.
TENANT_NOT_FOUND404The specified tenant does not exist or you do not have access to it.
VALIDATION_ERROR400One or more fields in the request body failed validation.
NOT_FOUND404The requested resource does not exist.
CONFLICT409The request conflicts with the current state (e.g. duplicate email, domain already added).
RATE_LIMITED429Too many requests. Check the Retry-After header.
WIDGET_KEY_INVALID401The widget key is not recognised or has been revoked.
WIDGET_DOMAIN_NOT_ALLOWED403The widget is being loaded from a domain that is not in the allowed domains list.
FILE_TOO_LARGE400The uploaded file exceeds the maximum size limit.
PLAN_LIMIT_EXCEEDED403The action exceeds the limits of your current plan (e.g. max widgets, max agents).
INTERNAL_ERROR500An unexpected server error occurred. If the problem persists, contact support.

HTTP Status Codes

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

StatusMeaningWhen
200OKRequest succeeded.
201CreatedResource was created successfully.
204No ContentRequest succeeded with no response body (e.g. DELETE).
400Bad RequestInvalid or missing parameters.
401UnauthorizedAuthentication failed or was not provided.
403ForbiddenAuthenticated but not permitted.
404Not FoundResource does not exist.
409ConflictResource already exists or conflicts with current state.
429Too Many RequestsRate limit exceeded.
500Internal Server ErrorUnexpected server error.

Handling Errors in Code

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 Docs