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 whatevergetToken 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
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": "..." } }.
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 & chatworkerId 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.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/authbefore expiry inside yourgetTokencallback. - Cross-origin requests are scoped per publishable key — the gateway only accepts SDK requests from origins configured for your key.
- The gateway derives
customer_idfrom the signed token, never from client-supplied input, so a customer can only ever read or write their own project and conversations.