Skip to content

Error Handling

The Color API returns standard HTTP status codes and detailed error information in JSON format.

{
"error": {
"code": "error_code_here",
"message": "Human-readable error message",
"details": ["Additional context or validation errors"]
}
}
Status Meaning
200 Success
400 Bad Request - Invalid parameters
401 Unauthorized - Invalid or missing API key
404 Not Found - Endpoint doesn’t exist
429 Rate Limit Exceeded
500 Internal Server Error
Code Description
invalid_color_format The color value provided is not a valid format
missing_parameter Required parameter is missing
invalid_parameter Parameter value is invalid
rate_limit_exceeded Too many requests
authentication_failed Invalid API key
try {
const response = await fetch(url, {
headers: { Authorization: `Bearer ${apiKey}` },
});
if (!response.ok) {
const error = await response.json();
console.error("API Error:", error.error.message);
}
} catch (e) {
console.error("Network error:", e);
}