The Kini API is designed to provide clear and actionable error messages to help you diagnose and resolve issues quickly. This guide outlines the common error codes, their meanings, and best practices for handling them.

Common Error Codes

1. Authentication Errors

Status CodeError MessageResolution
401UnauthorizedEnsure the Authorization header contains a valid token. Use /token/refresh/ or /token/if the token has expired.
403ForbiddenVerify the user’s permissions for the requested endpoint.

2. Validation Errors

Status CodeError MessageDescriptionResolution
400Invalid InputRequest body or query parameters are malformed.Validate the request payload against the API specification.
400Missing Required FieldA required field is missing in the request payload.Include all mandatory fields as specified in the API documentation.

3. Rate Limiting

Status CodeError MessageDescriptionResolution
429Too Many RequestsExceeded the allowed number of requests per minute.Implement retry logic with exponential backoff. Monitor usage to stay within rate limits.

4. Server Errors

Status CodeError MessageDescriptionResolution
500Internal Server ErrorUnexpected error occurred on the server.Retry the request after a short delay. If the issue persists, please contact support.
503Service UnavailableThe server is temporarily overloaded or down.Wait and retry after a few minutes. If the issue persists, please contact support.

Error Response Format

All error responses from the Kini API follow a standard format for consistency and ease of debugging.

Example Error Response

{
  "error": {
    "code": 400,
    "message": "Invalid Input",
    "details": [
      {
        "field": "job_title",
        "issue": "This field is required."
      }
    ]
  }
}

Fields

FieldDescription
codeHTTP status code of the error.
messageShort description of the error.
detailsAdditional information about specific fields or issues, if applicable.

Best Practices for Error Handling

  1. Log Errors:
    Log error responses in your application for debugging and monitoring.
  2. Implement Retry Logic:
    For 429 and 5xx errors, implement retry logic with exponential backoff.
  3. Validate Requests:
    Ensure all required fields are included and conform to the API schema before making a request.
  4. Handle Token Expiry:
    Monitor for 401 Unauthorized responses and use the /token/refresh/ endpoint to obtain a new access token.
  5. Monitor API Limits:
    Keep track of your API usage to avoid rate limiting errors (429 Too Many Requests).

Contact Support

If you encounter persistent errors or need assistance resolving an issue, please send us an Email at: [email protected]