Overview
The MTB Backend API uses standard HTTP status codes to indicate the success or failure of API requests. Error responses include detailed information to help you diagnose and resolve issues.HTTP Status Codes
The API returns the following HTTP status codes:| Status Code | Description |
|---|---|
200 | OK - Request succeeded |
201 | Created - Resource successfully created |
204 | No Content - Request succeeded with no response body |
400 | Bad Request - Invalid request parameters or malformed syntax |
401 | Unauthorized - Authentication required or invalid credentials |
403 | Forbidden - Authenticated but lacking permissions |
404 | Not Found - Requested resource does not exist |
429 | Too Many Requests - Rate limit exceeded |
500 | Internal Server Error - Server encountered an unexpected error |
503 | Service Unavailable - Server temporarily unavailable |
Error Response Format
All error responses follow a consistent JSON structure provided by Strapi:Response Fields
Always
null for error responsesCommon Errors
400 - Validation Error
400 - Validation Error
Cause: Invalid or missing required fields in the request body or query parameters.Example:Solution: Verify that all required fields are included and properly formatted.
401 - Unauthorized
401 - Unauthorized
403 - Forbidden
403 - Forbidden
Cause: Authenticated user lacks permission to access the resource or perform the action.Example:Solution: Verify that your user account has the necessary permissions for this operation.
404 - Not Found
404 - Not Found
Cause: The requested resource does not exist or the endpoint URL is incorrect.Example:Solution: Check the resource ID and endpoint URL for typos.
429 - Rate Limit Exceeded
429 - Rate Limit Exceeded
Cause: Too many requests sent in a given timeframe.Example:Solution: Implement exponential backoff and retry logic in your client application.
500 - Internal Server Error
500 - Internal Server Error
Cause: Unexpected server-side error.Example:Solution: If the error persists, contact the API administrators with the request details.
Best Practices
The
details field structure may vary depending on the error type. Always check for its presence before accessing nested properties.