Error Handling
The Kini API is designed to provide clear and actionable error messages to help you diagnose and resolve issues quickly.
Common Error Codes
1. Authentication Errors
| Status Code | Error Message | Resolution |
|---|
401 | Unauthorized | Ensure the Authorization header contains a valid token. Rotate the API key in the Kini Partner App if it has expired or been revoked. |
403 | Forbidden | Verify the user's permissions for the requested endpoint. |
2. Validation Errors
| Status Code | Error Message | Description | Resolution |
|---|
400 | Invalid Input | Request body or query parameters are malformed. | Validate the request payload against the API specification. |
400 | Missing Required Field | A required field is missing in the request payload. | Include all mandatory fields as specified in the API documentation. |
3. Rate Limiting
| Status Code | Error Message | Description | Resolution |
|---|
429 | Too Many Requests | Exceeded the allowed number of requests per minute. | Implement retry logic with exponential backoff. Monitor usage to stay within rate limits. |
4. Server Errors
| Status Code | Error Message | Description | Resolution |
|---|
500 | Internal Server Error | Unexpected error occurred on the server. | Retry the request after a short delay. If the issue persists, please contact support. |
503 | Service Unavailable | The server is temporarily overloaded or down. | Wait and retry after a few minutes. If the issue persists, please contact support. |
All error responses from the Kini API follow a standard format for consistency and ease of debugging.
Example Error Response
{
"title": [
"This field is required."
]
}
Fields
| Field | Description |
|---|
code | HTTP status code of the error. |
message | Short description of the error. |
details | Additional information about specific fields or issues, if applicable. |
Best Practices for Error Handling
- Log Errors:
Log error responses in your application for debugging and monitoring.
- Implement Retry Logic:
For 429 and 5xx errors, implement retry logic with exponential backoff.
- Validate Requests:
Ensure all required fields are included and conform to the API schema before making a request.
- Handle Token Expiry:
Monitor for 401 Unauthorized responses and rotate the API key from the Kini Partner App.
- Monitor API Limits:
Keep track of your API usage to avoid rate limiting errors (429 Too Many Requests).
If you encounter persistent errors or need assistance resolving an issue, please send us an Email at: support@getkini.com