Error Handling
Understanding and handling API errors
Error Response Format
json
{
"error": "error_code",
"message": "Human readable message",
"details": {}
}HTTP Status Codes
400Bad RequestInvalid request parameters
401UnauthorizedInvalid or missing API key
404Not FoundResource not found
429Too Many RequestsRate limit exceeded
500Internal Server ErrorServer error
Example Error Handling
javascript
try {
const response = await fetch('/api/v1/leads');
if (!response.ok) {
const error = await response.json();
console.error(error.message);
}
} catch (error) {
console.error('Network error:', error);
}