This walks a Node 20+ developer through the things you actually need on day one: install, init, one REST call with the agentic envelope, a real-time stream, a webhook receiver, and how the SDK behaves on errors. Expect about five minutes end-to-end.Documentation Index
Fetch the complete documentation index at: https://developer.alterscope.org/llms.txt
Use this file to discover all available pages before exploring further.
The TypeScript SDK is
@alterscope/sdk@2.0.0-beta.2 — currently in beta, GA targeted for late Q2 2026. Surface area shown here is stable.1. Install
2. Initialize the client
sk_live_…. The constructor throws if apiKey is missing.
3. Your first call
The cheapest “is it working?” call is an oracle classification — it always returns a shape that includes the agentic envelope (freshness, confidence, quality verdict) so you can confirm the SDK is wired correctly in one call.freshnessStatusOf() returns one of "realtime" | "fresh" | "stale" | "unknown". Treat stale as a soft-error in your agent loop — re-fetch before acting on the data.
4. Stream events
Risk events are pushed over a WebSocket. The SDK does not yet ship a typedclient.riskEvents wrapper — connect with ws directly and send the channel-subscribe message.
factor_update (channel factors), alert_triggered (alerts), position_update (positions), apy_update (apy), market_event (events — subtypes include oracle_failure, exploit, upgrade, governance, liquidity_crunch). Full protocol reference: WebSockets API.
A typed
client.riskEvents.subscribe(...) wrapper is on the SDK roadmap — track via the changelog.5. Receive a webhook
Create the webhook subscription via the SDK, then mount a handler that parses the body:Errors and retries
The SDK retries429 and 5xx responses up to maxRetries times with exponential backoff (capped at 60s) and honors Retry-After on 429. Defaults: maxRetries = 3, timeout = 30_000 ms.
ForbiddenError, ValidationError, ServerError, plus the base AlterscopeError.
Reference
- Full SDK source + issues: github.com/alterscope/alterscope-typescript
- Runnable example used to verify this guide:
sdks/typescript/examples/quickstart.ts - Generated types for every endpoint:
import type { components, paths } from "@alterscope/sdk"
Next steps
Pricing & quotas
Free, Pro, Pro+, and Enterprise tiers — what each gets you.
Changelog
What changed in the API and SDKs, week by week.
API Reference
Every operation with try-it-out.
Recipes
End-to-end flows: depeg detection, scoring, treasury automation.