Errors
The API uses standard HTTP status codes and returns errors in a consistent JSON envelope. Every error response includes a request ID for debugging.
Error Envelope
{
"error": {
"code": "ERROR_CODE",
"message": "Human-readable description",
"request_id": "req_abc123"
}
}Status Codes
| Status | Code | Description |
|---|---|---|
| 400 | VALIDATION_ERROR | Invalid request body or parameters |
| 401 | AUTHENTICATION_ERROR | Missing, invalid, disabled, or expired API key |
| 404 | NOT_FOUND | Resource not found |
| 429 | RATE_LIMIT_EXCEEDED | Too many requests — check Retry-After header |
| 500 | INTERNAL_ERROR | Unexpected server error |
SDK Error Handling
The SDK provides typed error classes for each error type:
JavaScript
import {
IndigiArmor,
AuthenticationError,
RateLimitError,
ValidationError,
NotFoundError,
} from 'indigiarmor';
const armor = new IndigiArmor('ia_sk_...');
try {
const result = await armor.scan('some prompt');
} catch (err) {
if (err instanceof RateLimitError) {
console.log('Retry after', err.retryAfter, 'seconds');
} else if (err instanceof AuthenticationError) {
console.log('Bad API key');
} else if (err instanceof ValidationError) {
console.log('Bad request:', err.message);
}
}