Errors & Status Codes
The Weave API uses standard HTTP status codes and wraps every response in a consistent JSON envelope.
The response envelope
A successful response carries your result under data:
{
"success": true,
"eventId": "…",
"eventDateTime": "…",
"data": { "customerId": "…" }
}
When a request fails, success is false and the problem is described in an errors array:
{
"success": false,
"errors": [{ "code": 1001, "message": "A human-readable description of what went wrong." }]
}
Check the HTTP status first, then read errors[0].message for detail. Rate-limit, overload and billing errors also set errors[0].description to a stable reason (RATE_LIMITED, SERVICE_OVERLOADED or PAYMENT_REQUIRED) you can branch on.
Common status codes
| Status | Meaning |
|---|---|
200 | Success. The result is under data. |
400 | Invalid input — a required field is missing or a value is malformed. Fix and retry. |
401 | Missing or invalid credentials. Check your Authorization header and API key. |
402 | Payment required (PAYMENT_REQUIRED). The organization's billing has lapsed, so writes are refused until it is fixed; see Billing. |
403 | Authenticated, but not permitted to perform this operation. Check the key's roles. |
404 | The resource doesn't exist (or isn't visible to you). |
409 | Conflict — the request collides with existing state (e.g. the target is still referenced by other entities). |
429 | Rate limited (RATE_LIMITED). Wait for Retry-After, then retry; see Rate Limits. |
503 | Briefly overloaded (SERVICE_OVERLOADED). Wait for Retry-After, then retry; see Rate Limits. |
A 5xx status indicates an unexpected error on our side; these are safe to retry with backoff.
Handling errors
const response = await fetch("https://api.loomloyalty.com/customers/does-not-exist", {
headers: { Authorization: `Bearer ${process.env.LOOM_API_KEY}` },
});
const body = await response.json();
if (!response.ok || body.success === false) {
const message = body.errors?.[0]?.message ?? response.statusText;
throw new Error(`Weave API ${response.status}: ${message}`);
}
// Use body.data
- Treat any non-
2xxstatus, orsuccess: false, as a failure. - Log
errors[0].code(a numeric code) andmessage— the code is stable enough to branch on, the message is for humans. - Retry
429and5xxresponses with exponential backoff; don't retry4xxclient errors without changing the request. - Don't retry a
402: it won't succeed until someone fixes the organization's billing on the Dashboard's Billing page. Reads keep working in the meantime.
Next Steps
- Page through list endpoints with Pagination & Filtering
- Handle throttling in Rate Limits
- Make your first calls in the Quick Start