Skip to main content

Error Handling

HTTP Status Codes

CodeDescription
200OK - Request succeeded
400Bad Request - Missing parameter or invalid request structure
401Unauthorized - Invalid or missing API key
403Forbidden - API key owner lacks permission for this action
404Not Found - Resource doesn't exist
422Unprocessable Entity - Semantic errors in parameters
429Too Many Requests - Rate limit exceeded (see Rate Limiting)
500Internal Error - Server-side issue (rare)

Error Types

All errors follow a consistent structure with a type field indicating the error category:

Error TypeDescription
BaseErrorBase schema for all error types
RecordErrorError when saving a record
InvalidParameterErrorOne or more parameters are missing or invalid
AuthErrorAuthentication failed (missing or expired token)
MaintenanceErrorHolistics is in maintenance mode
SubscriptionErrorSubscription lacks permission for this resource
PermissionDeniedErrorAPI key owner lacks access to this resource
InternalHolisticsErrorInternal error - provide debug id to support
InvalidOperationErrorAction blocked by system constraints

Error Response Format

All error responses follow this structure:

{
"error": {
"type": "InvalidParameterError",
"message": "Parameter 'source_id' is required",
"debug_id": "abc123xyz"
}
}

Handling Errors

Best practices:

  1. Check status codes first - Use HTTP status to determine error category
  2. Parse error type - Use the type field for specific error handling
  3. Log debug IDs - For InternalHolisticsError, save the debug_id for support requests
  4. Validate inputs - Prevent InvalidParameterError by validating before sending

Example error handling (Python):

import requests

response = requests.post(url, headers=headers, json=data)

if response.status_code == 200:
return response.json()
elif response.status_code == 401:
raise Exception("Invalid API key")
elif response.status_code == 403:
raise Exception("Permission denied")
elif response.status_code == 422:
error = response.json().get('error', {})
raise Exception(f"Validation error: {error.get('message')}")
elif response.status_code == 429:
# Handle rate limiting
pass
else:
error = response.json().get('error', {})
raise Exception(f"API error: {error.get('message')} (debug_id: {error.get('debug_id')})")

Let us know what you think about this document :)