@anomalyarmor/sdk is the official TypeScript SDK for AnomalyArmor. Types are generated straight from our OpenAPI spec via openapi-typescript, so every endpoint is typed end-to-end. Runtime is a thin wrapper around openapi-fetch with Bearer auth and retry-on-429 middleware baked in.
Install
Quickstart
aa_live_.
Authentication
The SDK captures your API key at construction time and attachesAuthorization: Bearer <key> to every outgoing request via a small middleware. The SDK library itself never reads from process.env — that would hide auth at a distance. Only the CLI shim (next section) reads ANOMALYARMOR_API_KEY, because CLIs traditionally do.
CLI
The package ships abin binary so you can smoke-check connectivity without writing code:
health) by design — anything richer belongs in a real script calling the library API.
Rate limiting & retries
The SDK automatically retries HTTP 429 responses, honoringRetry-After. Retries are bounded (default 3 attempts, each sleep capped at 60 s) and only apply to idempotent verbs (GET, HEAD, PUT, DELETE, OPTIONS) so a POST failure never duplicates a side effect.
How requests work
Every typed SDK call flows through six layers: the ergonomic helper →openapi-fetch → the middleware stack → platform fetch → parse / unwrap → a statically-typed response.
Error handling
Ergonomic methods throwAnomalyArmorApiError on 4xx / 5xx responses:
Drop down to the raw client
The ergonomic surface covers the endpoints customers use most often. For anything else,client.raw exposes the full typed openapi-fetch client:
Configuration reference
| Option | Default | Purpose |
|---|---|---|
apiKey | (required) | Your aa_live_* Bearer token. |
baseUrl | https://app.anomalyarmor.ai | Override for staging or a local backend. |
maxRetries | 3 | 429-retry budget. Set to 0 to disable. |
maxRetrySleepSeconds | 60 | Cap on any single Retry-After sleep. |
fetch | globalThis.fetch | Injectable fetch for tests / alternate runtimes. |
Next steps
API reference
Full typed reference for every SDK method
Authentication
How API keys work across the platform
Python SDK
Same API surface in Python
CLI reference
Installable CLI for interactive use
