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
| Code | Meaning |
|---|---|
| 200 | Success |
| 201 | Created - content was successfully published |
| 400 | Bad Request - invalid input or missing required fields |
| 401 | Unauthorized - missing or invalid API key |
| 403 | Forbidden - key lacks permission or IP not whitelisted |
| 404 | Not Found - the requested resource doesn't exist |
| 409 | Conflict - content with this slug already exists |
| 422 | Unprocessable Entity - validation errors in the submitted data |
| 429 | Too Many Requests - rate limit exceeded |
| 500 | Internal Server Error - unexpected server error |
Common Error Codes
| Error Code | HTTP | Description |
|---|---|---|
missing_api_key | 401 | No Authorization header provided |
invalid_api_key | 401 | API key not found or revoked |
key_disabled | 403 | API key is disabled |
key_expired | 403 | API key has expired |
ip_not_whitelisted | 403 | Request IP not in key's whitelist |
insufficient_permissions | 403 | Key lacks the required permission |
rate_limit_exceeded | 429 | Too many requests - try again later |
missing_field | 422 | A required field is missing |
invalid_field | 422 | A field value is invalid |
invalid_content_type | 400 | Unknown content type specified |
slug_exists | 409 | Content with this slug already exists |
content_not_found | 404 | The referenced content does not exist |
category_not_found | 404 | Referenced 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"
}
}