Error Codes
All API errors return a JSON object with error (human-readable message) and code (machine-readable identifier).
json
{
"error": "Invalid or missing authentication.",
"code": "UNAUTHORIZED"
}HTTP Status Codes
| Status | Meaning |
|---|---|
| 200 | Success |
| 201 | Created |
| 204 | Deleted (no content) |
| 400 | Bad request (validation error) |
| 401 | Unauthorized (missing or invalid auth) |
| 403 | Forbidden (insufficient permissions) |
| 404 | Not found |
| 409 | Conflict (duplicate resource) |
| 429 | Rate limited |
| 500 | Server error |
Error Codes
| Code | Status | Description |
|---|---|---|
VALIDATION_ERROR | 400 | Request body failed validation. Check required fields and types. |
BAD_REQUEST | 400 | Generic bad request. The error message has details. |
UNAUTHORIZED | 401 | Missing Authorization header or invalid API key. |
INVALID_PASSWORD | 400 | Current password is incorrect (password change). |
FORBIDDEN | 403 | Your role does not have permission for this action. |
NOT_FOUND | 404 | The resource (org, device, segment, member) was not found. |
SLUG_TAKEN | 409 | The URL slug is already in use by another organization. |
EMAIL_TAKEN | 409 | This email is already associated with an organization. |
CONFLICT | 409 | Generic duplicate. For example, already subscribed to an org. |
LAST_OWNER | 400 | Cannot remove the last owner from an organization. |
RATE_LIMITED | 429 | Too many requests. Wait and retry. |
INTERNAL_ERROR | 500 | Something went wrong on our end. Try again or contact support. |
Rate Limit Response
When rate limited, the response includes:
json
{
"error": "Too many requests. Please try again later.",
"code": "RATE_LIMITED"
}Current limits:
POST /v1/notify: 120 requests/min per API keyPOST /v1/devices: 30 requests/min per IP
Handling Errors
javascript
const res = await fetch("https://api.bzzz.sh/v1/notify", {
method: "POST",
headers: {
"Authorization": "Bearer bzzz_live_YOUR_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({ body: "Hello!", target: "all" }),
});
if (!res.ok) {
const { error, code } = await res.json();
console.error(`bzzz error [${code}]: ${error}`);
}