Skip to main content
@endstate-sdk/core is the Endstate API in TypeScript. One build runs in Node 20+, edge runtimes, and the browser, with zero runtime dependencies and an Apache-2.0 license. Field names are the API’s own. What you read in the API reference is what you get in TypeScript: chip_id, external_id, session_token, has_more, next_cursor. Nothing is renamed, so you can move between the SDK and raw HTTP without translating.

Install

The package is ESM-only. VERSION exports the installed version, and the SDK sends it on the User-Agent outside the browser, so support can tell which version made a call.

Your first call

apiKey is typed `end_sk_${string}`, so a key read from the environment needs narrowing. secretKey() does it and throws a named EndstateConfigError at startup, rather than letting a missing or wrong-prefixed key surface as a 401 on your first call.

Pick your client

Which one you use is decided by where the code runs, not by what it does.

Server

EndstateClient with a secret key (end_sk_...). Every operation in the spec, the waitUntil helpers, pagination, and the typed escape hatch.

Browser

EndstatePublicClient with a publishable key (end_pk_...). Records taps; everything further is authorized by the tap itself.
A secret key grants full access to your organization. It belongs on your server and nowhere else - never in browser or Electron-renderer code, and never behind a public proxy endpoint.

Then

Tap sessions

Turn a tap into a session that can claim, transfer, and read a unit.

Errors and retries

Typed errors, which calls retry, and how idempotency keys are chosen.