Error Handling
PostBoost uses standard HTTP status codes and returns consistent JSON error bodies.
Error format
All errors return a JSON object with at minimum a message field:
{
"message": "Validation errors.",
"errors": {
"versions": ["The versions field is required."],
"accounts.0": ["The selected account is invalid."]
}
}
Status codes
| Code | Meaning | Common cause |
|---|---|---|
400 Bad Request | Invalid request | Trying to delete your own account |
401 Unauthenticated | Missing or invalid token | No Authorization header, expired token |
403 Forbidden | Insufficient permissions | Token lacks admin rights for panel endpoints |
404 Not Found | Resource not found | Wrong workspace UUID, deleted post |
422 Unprocessable Entity | Validation failed | Missing required fields, invalid values |
429 Too Many Requests | Rate limit hit | Reduce request frequency |
500 Internal Server Error | Server error | Contact support |
Handling in code
- Python
- Node.js
response = requests.post(url, headers=headers, json=data)
if response.status_code == 422:
errors = response.json().get("errors", {})
for field, messages in errors.items():
print(f"{field}: {', '.join(messages)}")
elif response.status_code == 401:
print("Invalid API token — check your credentials")
elif not response.ok:
print(f"Error {response.status_code}: {response.json().get('message')}")
else:
post = response.json()
const res = await fetch(url, { method: "POST", headers, body });
const data = await res.json();
if (!res.ok) {
if (res.status === 422) {
console.error("Validation errors:", data.errors);
} else {
console.error(`Error ${res.status}:`, data.message);
}
throw new Error(data.message);
}
Validation errors
422 responses include an errors object mapping field names to arrays of error messages. Field names use dot notation for nested objects:
{
"message": "Validation errors.",
"errors": {
"versions": ["The versions field is required."],
"versions.0.is_original": ["The is_original field must be true for the first version."],
"date": ["The date does not match the format Y-m-d."]
}
}