API reference

Reference for every public endpoint of the Discence REST API: authentication, workspaces, agents, threads, uploads, webhooks, and billing. The machine-readable contract is the OpenAPI 3.1 document.

Download the OpenAPI specification (JSON) · OpenAPI 3.1 · base /api/v1

Authentication

Session cookie

Sign in with email and password (POST /api/auth/sign-in/email) or through OAuth 2.0 with a configured provider (POST /api/auth/sign-in/social, then the provider callback). Both issue the better-auth.session_token cookie, valid seven days.

Single sign-on (SAML 2.0 / OIDC)

Workspaces that federate identity sign in through a SAML 2.0 or OIDC provider registered by a super administrator. POST /api/auth/sign-in/sso with the provider's id, domain, or the user's email returns the identity provider URL to redirect to; its callback issues the same session cookie. Group claims from the provider map to application roles on every sign-in.

API keys

Workspace admins create keys with POST /api/v1/api-keys. Send the key in the x-api-key header or as a Bearer token. The full value is shown once at creation; the platform stores only its SHA-256 hash. A key acts with its creator's current role in the workspace.

Workspace selection

Members of several workspaces pick one per request with the x-workspace-id header. API keys are bound to their workspace and ignore this header.

Errors

Failures return an error object. Validation failures add a details list and use status 400; 401 means missing or invalid credentials, 403 an insufficient role, 404 a missing resource.

{ "error": "Validation failed", "details": [{ "field": "name", "message": "Required" }] }

Webhooks

Register endpoints with POST /api/v1/webhooks to subscribe to workspace events. Each registration stores a secret reserved for signing outbound X-Hub-Signature-256 deliveries.

File transfer

Uploads use three steps: declare the file with POST /api/v1/uploads, stream bytes to the returned putUrl, then confirm with POST /api/v1/uploads/<id>/complete.

Endpoints

Authentication

MethodPathDescriptionAccess
POST/api/auth/sign-up/emailCreate an account with email and passwordPublic
POST/api/auth/sign-in/emailSign in with email and passwordPublic
POST/api/auth/sign-in/socialStart an OAuth 2.0 sign-in flowPublic
GET/api/auth/callback/{provider}OAuth 2.0 provider redirect targetPublic
POST/api/auth/sign-in/ssoStart a SAML 2.0 or OIDC single sign-on flowPublic
GET/api/auth/sso/callback/{providerId}OIDC provider redirect targetPublic
POST/api/auth/sso/saml2/callback/{providerId}SAML 2.0 assertion consumer servicePublic
GET/api/auth/sso/saml2/sp/metadataSAML 2.0 service-provider metadataPublic
GET/api/auth/get-sessionReturn the current session and userSigned-in user
POST/api/auth/sign-outEnd the sessionSigned-in user

Learning

MethodPathDescriptionAccess
POST/api/v1/learn/progressRecord a learner activity eventSigned-in user

System

MethodPathDescriptionAccess
GET/api/v1/healthService liveness probePublic
GET/api/v1/cron/healthCron pipeline liveness probePublic
POST/api/v1/cron/healthDrain a batch of pending outbox jobsCron secret
GET/api/v1/openapi.jsonThis OpenAPI 3.1 documentPublic
GET/api/v1/flagsList feature flagsSigned-in user
POST/api/v1/flagsSet a feature flagSigned-in user
POST/api/v1/jobs/demoEnqueue a demo job on the outbox queueSigned-in user

Agents

MethodPathDescriptionAccess
GET/api/v1/agentsList workspace agentsWorkspace member
POST/api/v1/agentsCreate an agentWorkspace member
GET/api/v1/agents/{id}Get an agentWorkspace member
DELETE/api/v1/agents/{id}Delete an agentWorkspace member

Audit

MethodPathDescriptionAccess
GET/api/v1/audit-logsList workspace audit log entriesWorkspace member
GET/api/v1/audit-logs/{id}Get an audit log entryWorkspace member

Billing

MethodPathDescriptionAccess
POST/api/v1/billing/checkoutStart a plan checkoutWorkspace admin
GET/api/v1/billing/infoGet the workspace billing recordWorkspace member
POST/api/v1/billing/portalCreate a billing portal sessionWorkspace admin
GET/api/v1/billing/usageGet usage and entitlementsWorkspace member
POST/api/v1/billing/webhookReceive a billing provider eventPublic ingress

Contact

MethodPathDescriptionAccess
POST/api/v1/contactSubmit the public contact formPublic

Items

MethodPathDescriptionAccess
GET/api/v1/itemsList workspace itemsWorkspace member
POST/api/v1/itemsCreate an itemWorkspace member
GET/api/v1/items/{id}Get an itemWorkspace member
DELETE/api/v1/items/{id}Delete an itemWorkspace member

Memory

MethodPathDescriptionAccess
GET/api/v1/memoryList agent memory entriesWorkspace member
POST/api/v1/memoryStore a memory entryWorkspace member
GET/api/v1/memory/{id}Get a memory entryWorkspace member
DELETE/api/v1/memory/{id}Delete a memory entryWorkspace member

Notes

MethodPathDescriptionAccess
GET/api/v1/notesList the caller's notesSigned-in user
POST/api/v1/notesCreate a noteSigned-in user
DELETE/api/v1/notesDelete a noteSigned-in user

Settings

MethodPathDescriptionAccess
GET/api/v1/settingsList workspace settingsWorkspace member
POST/api/v1/settingsSet a workspace settingWorkspace member
GET/api/v1/settings/{id}Get a settingWorkspace member
DELETE/api/v1/settings/{id}Delete a settingWorkspace member

Skills

MethodPathDescriptionAccess
GET/api/v1/skillsList agent skillsWorkspace member
POST/api/v1/skillsCreate a skillWorkspace member
GET/api/v1/skills/{id}Get a skillWorkspace member
DELETE/api/v1/skills/{id}Delete a skillWorkspace member

Threads

MethodPathDescriptionAccess
GET/api/v1/threadsList workspace threadsWorkspace member
POST/api/v1/threadsOpen a threadWorkspace member
GET/api/v1/threads/{id}Get a threadWorkspace member
DELETE/api/v1/threads/{id}Delete a threadWorkspace member
GET/api/v1/threads/{id}/messagesList a thread's messagesWorkspace member
POST/api/v1/threads/{id}/messagesAppend a messageWorkspace member

Tools

MethodPathDescriptionAccess
GET/api/v1/toolsList workspace toolsWorkspace member
POST/api/v1/toolsRegister a toolWorkspace member
GET/api/v1/tools/{id}Get a toolWorkspace member
DELETE/api/v1/tools/{id}Delete a toolWorkspace member

Uploads

MethodPathDescriptionAccess
GET/api/v1/uploadsList the caller's uploadsSigned-in user
POST/api/v1/uploadsDeclare a file uploadSigned-in user
GET/api/v1/uploads/{id}/contentDownload file bytesSigned-in user
PUT/api/v1/uploads/{id}/contentStream file bytesSigned-in user
POST/api/v1/uploads/{id}/completeMark an upload readySigned-in user

Users

MethodPathDescriptionAccess
GET/api/v1/usersList workspace membersWorkspace member

Webhooks

MethodPathDescriptionAccess
GET/api/v1/webhooksList webhook registrationsWorkspace member
POST/api/v1/webhooksRegister a webhookWorkspace member
GET/api/v1/webhooks/{id}Get a webhook registrationWorkspace member
DELETE/api/v1/webhooks/{id}Delete a webhook registrationWorkspace member

Workspaces

MethodPathDescriptionAccess
GET/api/v1/workspace/currentResolve the active workspaceWorkspace member
GET/api/v1/workspacesList the caller's workspacesSigned-in user
POST/api/v1/workspacesCreate a workspaceSigned-in user
GET/api/v1/workspaces/{id}Get a workspace the caller belongs toSigned-in user
GET/api/v1/workspaces/{id}/membersList a workspace's membersSigned-in user

API Keys

MethodPathDescriptionAccess
GET/api/v1/api-keysList workspace API keysWorkspace admin
POST/api/v1/api-keysCreate an API keyWorkspace admin
DELETE/api/v1/api-keys/{id}Revoke an API keyWorkspace admin