@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.
Named SDK types use camelCase keys - chipId, externalId, sessionToken,
hasMore, nextCursor - while the wire keeps the API’s snake_case names. Only
the keys differ: string values, error codes, and REST paths are the ones in the
API reference. components["schemas"] and
request() are the wire, for when you need it as-is.
Install
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.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.

