Appearance
Error Responses
All error responses follow a consistent JSON format.
Standard Error
json
{
"success": false,
"message": "Human-readable error description"
}Validation Errors (422)
Write operations (POST) that fail validation return field-level errors:
json
{
"errors": {
"name": ["Name is required"],
"price": ["Price must be a positive number"]
}
}HTTP status: 422 Unprocessable Entity
Status Codes
| Code | Meaning | When |
|---|---|---|
200 | Success | Successful GET, POST, DELETE |
201 | Created | Successful POST (entity created) |
400 | Bad Request | Invalid JSON input, missing required fields |
401 | Unauthorized | Missing or invalid JWT token on a protected endpoint |
403 | Forbidden | Valid token but insufficient role/permissions |
404 | Not Found | Entity with given ID does not exist |
409 | Conflict | Duplicate entry (e.g., email already registered) |
422 | Validation Error | Input validation failed (see errors object) |
500 | Server Error | Unexpected server-side error |
Success Responses
All successful responses include "success": true:
json
{
"success": true,
"data": { ... }
}For delete operations:
json
{
"success": true,
"message": "Entity deleted successfully"
}