IndigiArmorIndigiArmorDocs

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

StatusCodeDescription
400VALIDATION_ERRORInvalid request body or parameters
401AUTHENTICATION_ERRORMissing, invalid, disabled, or expired API key
404NOT_FOUNDResource not found
429RATE_LIMIT_EXCEEDEDToo many requests — check Retry-After header
500INTERNAL_ERRORUnexpected 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);
  }
}