HTTP Response Codes
The Authorium API uses standard HTTP status codes to indicate the outcome of API requests. Understanding these codes helps you handle responses effectively and implement robust error handling in your application.
Response Codes Used by Authorium
The following table summarizes the HTTP response codes you may encounter when working with the Authorium API:
Code | Type | Meaning |
---|---|---|
200 | Success | The request succeeded. The server returned the expected response. |
201 | Success | The request succeeded, and a new resource was created. |
400 | Client error | The request was invalid, often due to formatting issues or missing data. |
401 | Client error | Authentication failed. The token may be missing, expired, or incorrect. |
403 | Client error | Access is forbidden. The authenticated user does not have permission to take action. |
404 | Client error | The requested resource was not found. |
422 | Client error | The request was understood but couldn't be processed due to semantic issues. |
Error Response Format
When an error occurs, the API returns a structured JSON response with details about the failure:
{
"error": {
"code": "unauthorized",
"message": "Invalid email or password."
}
}
Where:
code
: A short, machine-readable string that identifies the error type.message
: A human-readable explanation of the error.
Handling Responses
To ensure a robust integration, handle each category of response appropriately:
- 2xx – Success: Continue processing the response as expected.
- 4xx – Client error: Check your request for mistakes. These errors often relate to invalid input or authentication issues.
- 5xx – Server error: These indicate an issue on the server. Retry the request or contact support if the issue persists.