Client SDK
Call deployed Scrydon workflows and the platform data / AI / action surface from your own apps
The Client SDK (@scrydon/sdk) is for first-party apps acting on behalf of an end user. It authenticates with OAuth 2.0 + PKCE and exposes typed modules for workflows, chat, knowledge, storage, and the platform data / ai / action surface.
For server-to-server execution — backends, cron jobs, CI, internal services — call the workflow API directly with a static x-api-key. There is no separate server SDK; see Execution → Programmatic Execution.
What the SDK exposes
| Surface | What it does |
|---|---|
client.auth | OAuth 2.0 + PKCE: signIn() → handleCallback() → getSession() / signOut() / onAuthStateChange() |
client.workflows | trigger({ workflowId, inputs }), triggerAsync(...), getStatus(executionId) |
client.chat | Streaming chat against a deployed chat surface |
client.knowledge | query() / ingest() against the workspace KB |
client.storage | upload() / getUrl() for the workspace storage |
client.webhooks | In-process pub/sub for webhook payloads |
client.data | Platform data SDK — knowledge, memex, storage, memory |
client.ai | Platform ai SDK — capability-resolved LLM calls |
client.action | Platform action SDK — workflow execute, email send, SMS, function execute |
Authentication model
The Client SDK uses OAuth 2.0 with PKCE — no client secret in the browser, no static API key. The flow:
Generates the PKCE challenge, stores the verifier in sessionStorage, returns the https://scrydon.com/oauth/authorize?… URL. You navigate the user there.
They land on your redirectUri with ?code= and ?state= in the query string.
The SDK reads window.location.href (or whatever you pass), exchanges code for tokens, parses the ID token, and returns a ScrydonSession.
Every module call adds Authorization: Bearer <accessToken> automatically until the token expires.
const client = new ScrydonClient({
baseUrl: 'https://scrydon.com',
clientId: 'your-oauth-client-id',
redirectUri: 'https://your-app.com/auth/callback',
})
// Sign in
window.location.assign(await client.auth.signIn())
// On callback page
const session = await client.auth.handleCallback()
// → { user: { id, email, name? }, accessToken, expiresAt }When NOT to use this SDK
| You are… | Use instead |
|---|---|
| A backend service running on a schedule | Direct curl with x-api-key to /api/workflows/{id}/execute |
| A CI step or cron job | Same — x-api-key |
| Building an integration that other apps install | The Authoring SDK — defineVendor etc. |