Errors
HTTP status codes and SDK error handling
llms.txtHTTP status codes and SDK error handling
HTTP responses
| Status | Meaning |
|---|---|
400 | Validation failed - { "error": { "<field>": ["message"] } } |
401 | Missing/invalid/expired API key - { "error": "..." } |
404 | Resource not found - { "error": "..." } |
500 | Server error - { "error": "message" } |
Some routes return 204 with no body (e.g. DELETE /meters/:id).
SDK: KwitError
import Kwit, { KwitError } from "@kwit/sdk";
try {
await kwit.customers.create({ email: "bad" });
} catch (err) {
if (err instanceof KwitError) {
console.log(err.status);
console.log(err.code);
console.log(err.details); // field errors on 400
}
}| Code | Status | Notes |
|---|---|---|
validation_error | 400 | Check details |
authentication_error | 401 | Rotate API key |
not_found | 404 | Wrong ID or other org |
rate_limit_exceeded | 429 | SDK retries automatically |
internal_error | 5xx | SDK retries with backoff |