Skip to main content
EndstateClient takes a secret key (end_sk_...) and reaches every operation in the spec. It runs on your server only.
Never construct EndstateClient in browser or Electron-renderer code. A secret key grants full access to your organization. For the browser, see Browser.

Resources

Every operation is grouped by resource. Each method has its own reference page with the endpoint it calls, the credential it needs, and its retry class.

Waiting for work to finish

Issuance and provisioning are asynchronous. Rather than writing your own poll loop, use the waitUntil helpers - they share one polling primitive with exponential backoff, and they throw EndstateTerminalStateError when something settles in a failed state instead of polling until your budget runs out.
Each accepts { timeoutMs, intervalMs, maxIntervalMs, signal, onPoll }.

Pagination

A list call is both awaitable and iterable. Await it for one page exactly as the API returns it; iterate it for items across every page, following next_cursor for you.
Cursors are opaque - pass next_cursor back unchanged and never parse one.

Issuing a session for a browser

A secret key may verify a tap on your server and hand the resulting session token to a page. Unlike a publishable key, it may also set ttl.
The page adopts it with endstate.session(token). See Tap sessions.

Environments

baseUrl is explicit and defaults to production. The SDK does not infer an environment from your credential’s prefix.
See Environments for what each one is for.

Anything a method does not cover

Every operation in the spec is reachable by id, typed to the credential you constructed the client with, so a new endpoint is usable before a convenience method exists for it.
The operation ids are the same ones in the API reference, and OPERATIONS exports the full table if you need to inspect it at runtime.