Keymint uses standard HTTP status codes combined with custom error codes to provide detailed error information for better debugging and error handling.
Error Response Structure
All error responses follow this consistent structure:- Success Response
- Error Response
Complete Error Code Reference
Success Codes
Success Codes
HTTP Status | Code | Description |
---|---|---|
200 OK | 0 | Success - Request completed successfully |
Client Error Codes (4xx)
Client Error Codes (4xx)
HTTP Status | Code | Description | Common Causes |
---|---|---|---|
400 Bad Request | 1 | Malformed Request - Missing or invalid parameters | Missing productId, licenseKey, invalid date format |
401 Unauthorized | 1 | Invalid Token - Authentication failed | Missing, expired, or invalid access token |
403 Forbidden | 2 | Operation Restricted - License state prevents action | Expired license, activation limit reached, blocked |
404 Not Found | 1 | Resource Not Found - Requested resource doesn’t exist | Invalid productId, licenseKey, customerId |
404 Not Found | 2 | Customer Not Found - Specific to customer operations | Customer ID doesn’t exist |
409 Conflict | 2 | Resource Conflict - State prevents request | Duplicate customer email, existing activation |
429 Too Many Requests | 3 | Rate Limit Exceeded - Too many requests | Exceeded API rate limits |
Server Error Codes (5xx)
Server Error Codes (5xx)
HTTP Status | Code | Description | Action Required |
---|---|---|---|
500 Internal Server Error | 1 | Server Error - Unexpected server issue | Contact support if persistent |
Rate Limiting (429)
Implement robust retry logic, preferably with exponential backoff, when encountering this status.Server Errors (500)
These usually indicate a problem beyond the client’s control. Log the error and notify support if the issue persists.code Field
This custom code provides a secondary level of detail, differentiating between types of errors within the same HTTP status (e.g., 404 with code: 1 vs code: 2).Error Handling Best Practices
Parse Error Codes
Always check both HTTP status and custom error code for complete error context.
Implement Retry Logic
Use exponential backoff for rate limit errors (code 3) and temporary server errors.
Log Error Details
Log both the error message and code for debugging and monitoring purposes.
User-Friendly Messages
Translate technical error messages into user-friendly notifications.
Error Handling Examples
- JavaScript
- Python
Always implement proper error handling in production applications. Never expose raw API error messages to end users without proper sanitization.