Skip to main content
This page is the low-level reference behind the SDK components and clients. Most apps never call these endpoints directly — the SDK does — but you’ll need them when minting tokens or debugging.

Base URL & headers

All requests go to your Statisfy gateway (e.g. https://api.statisfy.app). Every SDK data request carries:

Authentication

There are two ways a bearer token comes into existence. The SDK accepts either — it just returns whatever getToken gives it.

POST /sdk/auth — exchange an identity for a session token (portal path)

Exchanges a signed-in user’s identity for a short-lived Statisfy session token. Not used in the vendored path. Request
entity_type must be "portal"; entity_id is the portal id, validated against the resolved tenant. Any other entity_type is rejected with unsupported_entity — there is no “latest published portal” fallback. Response 200
The minted token is an HS256 JWT signed with your tenant’s shared secret, carrying tenant_id, customer_id, portal_id, email, iss (statisfy-sdk), iat, and exp. The gateway scopes every subsequent request to that customer_id. Error codes

Project endpoints (/sdk/v1)

Authenticated by the session token’s own tenant_id + customer_id claims (token-only — the publishable key is not required here). All errors return { "detail": { "code": "...", "message": "..." } }.
These routes scope every query by the signed customer_id, so they require a portal-session token. A token minted by your own backend without that claim is rejected with 401 not_a_portal_session, even though it is validly signed and works for chat.
Comments posted through the SDK are always customer-visible (external), and an external session only ever sees external comments. Editing is author-only and text-only; it has no SDK client method in v0. For module=portal, the config response exposes the account’s onboarding project under the onboarding_project__c_ key. Error codes

Chat endpoints (/sdk/dw/v1)

Authenticated by the publishable key (resolves the tenant) plus the session/worker token.
The chat endpoints moved under the /sdk namespace (from /dw/v1/... to /sdk/dw/v1/...). The old /dw/v1/workers/... paths still work as a deprecated alias, but new integrations should use /sdk/dw/v1. The official SDK already calls the new paths — upgrade to pick them up automatically.

Streaming frames

/messages/stream emits these SSE frame types: The headless client (createDigitalWorkerClient) maps these frames to the streamMessage handler callbacks — see Digital Worker Chat.

TypeScript types

The package is fully typed. Public exports: Provider & chat
workerId is optional in the type because a portal component in config mode takes its worker from portal.runtime.json instead. Supply workerId for non-portal hosts and configId inside a portal — when both are set, configId wins and workerId is ignored with a dev-mode warning.
Forms & messages
Portal runtime config — see Portal Runtime Config
Project
The hook result types — UseProjectResult and UseCommentsResult — are documented field-by-field on the Project Module page.

Security notes

  • The publishable key is safe in client-side code; it only identifies the tenant and can’t authenticate on its own.
  • The session token is short-lived (default 1 hour) and scoped to a single customer. Re-mint it via /sdk/auth before expiry inside your getToken callback.
  • Cross-origin requests are scoped per publishable key — the gateway only accepts SDK requests from origins configured for your key.
  • The gateway derives customer_id from the signed token, never from client-supplied input, so a customer can only ever read or write their own project and conversations.