Error Handling

Comprehensive guide to error codes, status codes, and error handling strategies.

Common Error Responses

400 Bad Request

The request contains invalid parameters or is malformed.

{"error": "invalid_request", "error_description": "Missing required parameter"}

401 Unauthorized

The token is invalid or expired, or authentication is missing.

{"error": "invalid_token", "error_description": "Token expired or invalid"}

403 Forbidden

Access denied. The user may have revoked access or the account is banned/suspended.

{"error": "access_denied", "error_description": "Account banned"}

429 Too Many Requests

You exceeded the rate limit. Wait before retrying.

{"error": "rate_limit_exceeded", "error_description": "Too many requests"}

Authorization Endpoint Errors

Cengel ID returns errors as query parameters in the redirect URI:

?error=ERROR_CODE&error_description=DESCRIPTION&state=YOUR_STATE

Common Error Codes

Error CodeTypeDescription
invalid_requeststringRequest is missing a required parameter
unauthorized_clientstringClient is not authorized to use this flow
access_deniedstringUser denied the authorization request
invalid_scopestringRequested scope is invalid or unknown
server_errorstringInternal server error occurred

Token Endpoint Errors

The API returns errors as JSON in the response body:

{
  "error": "invalid_grant",
  "error_description": "Authorization code expired"
}

Common Error Codes

Error CodeTypeDescription
invalid_requeststringRequest is missing a required parameter
invalid_clientstringClient authentication failed
invalid_grantstringAuthorization code is invalid or expired
unauthorized_clientstringClient is not authorized to use this grant type
unsupported_grant_typestringGrant type is not supported