To ensure API stability, rate limits apply to certain endpoints.
| Status | Description |
|---|---|
| 400 | Invalid request body or missing required fields |
| 401 | Missing or invalid API key |
| 404 | Order not found |
| 429 | Rate limit exceeded |
| 500 | Internal server error |
All errors follow a consistent JSON format.
// 429 Rate Limit
{ "error": "Rate limited" }
// 400 Validation Error
{
"error": "Validation failed",
"details": {
"customerName": { "_errors": ["Required"] },
"type": { "_errors": ["Invalid enum value"] }
}
}
// 404 Not Found
{ "error": "Order not found" }For rate limit errors (429), we recommend exponential backoff:
async function fetchWithRetry(url, options, maxRetries = 3) {
for (let attempt = 0; attempt < maxRetries; attempt++) {
const res = await fetch(url, options);
if (res.status === 429 || res.status >= 500) {
const delay = Math.pow(2, attempt) * 1000; // 1s, 2s, 4s
await new Promise((r) => setTimeout(r, delay));
continue;
}
return res;
}
throw new Error("Max retries exceeded");
}