Skip to main content
The Node SDK is the primary client library for server integrations. It’s typed, auto-retrying, auth-aware, and covers every endpoint.

Install

Initialize

The SDK picks the correct base URL from your key prefix — pk_test_* → sandbox, pk_live_* → production.

Resource clients

Every resource has its own client:

Protocol clients

Auto-retries

By default, network errors and 5xx responses retry with exponential backoff (3 attempts, 100ms → 400ms → 1600ms). Idempotent operations (GET, DELETE, plus POSTs with idempotency_key) are safe to retry. Non-idempotent POSTs retry only on network errors, never on 5xx. Tune:

Idempotency

Always set an idempotency key on writes you care about:
Keys are cached 24 hours. Repeated POSTs with the same key return the original result.

Error handling

The SDK throws typed errors:
Every thrown error has:
  • code — machine-readable error code
  • message — human-readable
  • status — HTTP status
  • details — contextual info (amount, limits, offending field)
  • requestId — for support tickets

Pagination

List endpoints return a page + continuation:
Or iterate via async iterator:

Persistent SSE

Open a push channel (requires agent auth):
Handles reconnection, Last-Event-ID replay, and session refresh.

LangChain integration

The SDK exports LangChain-compatible tools:
Gives any LangChain agent full Sly access with automatic permission filtering.

Webhook verification

See webhook verification.

Typescript types

All request + response shapes are exported:

Further reading