API Error Codes

The SiteX API uses standard HTTP status codes and returns structured JSON error responses. 

Error Response Format

{
    "error": "error_code",
    "message": "Human-readable description of the error",
    "status": 400,
    "details": {}  // Optional additional context
}

HTTP Status Codes

CodeMeaning
200Success
201Created - content was successfully published
400Bad Request - invalid input or missing required fields
401Unauthorized - missing or invalid API key
403Forbidden - key lacks permission or IP not whitelisted
404Not Found - the requested resource doesn't exist
409Conflict - content with this slug already exists
422Unprocessable Entity - validation errors in the submitted data
429Too Many Requests - rate limit exceeded
500Internal Server Error - unexpected server error

Common Error Codes

Error CodeHTTPDescription
missing_api_key401No Authorization header provided
invalid_api_key401API key not found or revoked
key_disabled403API key is disabled
key_expired403API key has expired
ip_not_whitelisted403Request IP not in key's whitelist
insufficient_permissions403Key lacks the required permission
rate_limit_exceeded429Too many requests - try again later
missing_field422A required field is missing
invalid_field422A field value is invalid
invalid_content_type400Unknown content type specified
slug_exists409Content with this slug already exists
content_not_found404The referenced content does not exist
category_not_found404Referenced category does not exist

Validation Errors

When a 422 error occurs, the details field contains per-field errors:

{
    "error": "validation_failed",
    "message": "The submitted data contains errors",
    "status": 422,
    "details": {
        "title": "Title is required and must be between 1 and 255 characters",
        "category_id": "Category with this ID does not exist"
    }
}