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
| Method | Path | Description | Access |
|---|
| POST | /api/auth/sign-up/email | Create an account with email and password | Public |
| POST | /api/auth/sign-in/email | Sign in with email and password | Public |
| POST | /api/auth/sign-in/social | Start an OAuth 2.0 sign-in flow | Public |
| GET | /api/auth/callback/{provider} | OAuth 2.0 provider redirect target | Public |
| POST | /api/auth/sign-in/sso | Start a SAML 2.0 or OIDC single sign-on flow | Public |
| GET | /api/auth/sso/callback/{providerId} | OIDC provider redirect target | Public |
| POST | /api/auth/sso/saml2/callback/{providerId} | SAML 2.0 assertion consumer service | Public |
| GET | /api/auth/sso/saml2/sp/metadata | SAML 2.0 service-provider metadata | Public |
| GET | /api/auth/get-session | Return the current session and user | Signed-in user |
| POST | /api/auth/sign-out | End the session | Signed-in user |
Learning
| Method | Path | Description | Access |
|---|
| POST | /api/v1/learn/progress | Record a learner activity event | Signed-in user |
System
| Method | Path | Description | Access |
|---|
| GET | /api/v1/health | Service liveness probe | Public |
| GET | /api/v1/cron/health | Cron pipeline liveness probe | Public |
| POST | /api/v1/cron/health | Drain a batch of pending outbox jobs | Cron secret |
| GET | /api/v1/openapi.json | This OpenAPI 3.1 document | Public |
| GET | /api/v1/flags | List feature flags | Signed-in user |
| POST | /api/v1/flags | Set a feature flag | Signed-in user |
| POST | /api/v1/jobs/demo | Enqueue a demo job on the outbox queue | Signed-in user |
Agents
| Method | Path | Description | Access |
|---|
| GET | /api/v1/agents | List workspace agents | Workspace member |
| POST | /api/v1/agents | Create an agent | Workspace member |
| GET | /api/v1/agents/{id} | Get an agent | Workspace member |
| DELETE | /api/v1/agents/{id} | Delete an agent | Workspace member |
Audit
| Method | Path | Description | Access |
|---|
| GET | /api/v1/audit-logs | List workspace audit log entries | Workspace member |
| GET | /api/v1/audit-logs/{id} | Get an audit log entry | Workspace member |
Billing
| Method | Path | Description | Access |
|---|
| POST | /api/v1/billing/checkout | Start a plan checkout | Workspace admin |
| GET | /api/v1/billing/info | Get the workspace billing record | Workspace member |
| POST | /api/v1/billing/portal | Create a billing portal session | Workspace admin |
| GET | /api/v1/billing/usage | Get usage and entitlements | Workspace member |
| POST | /api/v1/billing/webhook | Receive a billing provider event | Public ingress |
Contact
| Method | Path | Description | Access |
|---|
| POST | /api/v1/contact | Submit the public contact form | Public |
Items
| Method | Path | Description | Access |
|---|
| GET | /api/v1/items | List workspace items | Workspace member |
| POST | /api/v1/items | Create an item | Workspace member |
| GET | /api/v1/items/{id} | Get an item | Workspace member |
| DELETE | /api/v1/items/{id} | Delete an item | Workspace member |
Memory
| Method | Path | Description | Access |
|---|
| GET | /api/v1/memory | List agent memory entries | Workspace member |
| POST | /api/v1/memory | Store a memory entry | Workspace member |
| GET | /api/v1/memory/{id} | Get a memory entry | Workspace member |
| DELETE | /api/v1/memory/{id} | Delete a memory entry | Workspace member |
Notes
| Method | Path | Description | Access |
|---|
| GET | /api/v1/notes | List the caller's notes | Signed-in user |
| POST | /api/v1/notes | Create a note | Signed-in user |
| DELETE | /api/v1/notes | Delete a note | Signed-in user |
Settings
| Method | Path | Description | Access |
|---|
| GET | /api/v1/settings | List workspace settings | Workspace member |
| POST | /api/v1/settings | Set a workspace setting | Workspace member |
| GET | /api/v1/settings/{id} | Get a setting | Workspace member |
| DELETE | /api/v1/settings/{id} | Delete a setting | Workspace member |
Skills
| Method | Path | Description | Access |
|---|
| GET | /api/v1/skills | List agent skills | Workspace member |
| POST | /api/v1/skills | Create a skill | Workspace member |
| GET | /api/v1/skills/{id} | Get a skill | Workspace member |
| DELETE | /api/v1/skills/{id} | Delete a skill | Workspace member |
Threads
| Method | Path | Description | Access |
|---|
| GET | /api/v1/threads | List workspace threads | Workspace member |
| POST | /api/v1/threads | Open a thread | Workspace member |
| GET | /api/v1/threads/{id} | Get a thread | Workspace member |
| DELETE | /api/v1/threads/{id} | Delete a thread | Workspace member |
| GET | /api/v1/threads/{id}/messages | List a thread's messages | Workspace member |
| POST | /api/v1/threads/{id}/messages | Append a message | Workspace member |
Tools
| Method | Path | Description | Access |
|---|
| GET | /api/v1/tools | List workspace tools | Workspace member |
| POST | /api/v1/tools | Register a tool | Workspace member |
| GET | /api/v1/tools/{id} | Get a tool | Workspace member |
| DELETE | /api/v1/tools/{id} | Delete a tool | Workspace member |
Uploads
| Method | Path | Description | Access |
|---|
| GET | /api/v1/uploads | List the caller's uploads | Signed-in user |
| POST | /api/v1/uploads | Declare a file upload | Signed-in user |
| GET | /api/v1/uploads/{id}/content | Download file bytes | Signed-in user |
| PUT | /api/v1/uploads/{id}/content | Stream file bytes | Signed-in user |
| POST | /api/v1/uploads/{id}/complete | Mark an upload ready | Signed-in user |
Users
| Method | Path | Description | Access |
|---|
| GET | /api/v1/users | List workspace members | Workspace member |
Webhooks
| Method | Path | Description | Access |
|---|
| GET | /api/v1/webhooks | List webhook registrations | Workspace member |
| POST | /api/v1/webhooks | Register a webhook | Workspace member |
| GET | /api/v1/webhooks/{id} | Get a webhook registration | Workspace member |
| DELETE | /api/v1/webhooks/{id} | Delete a webhook registration | Workspace member |
Workspaces
| Method | Path | Description | Access |
|---|
| GET | /api/v1/workspace/current | Resolve the active workspace | Workspace member |
| GET | /api/v1/workspaces | List the caller's workspaces | Signed-in user |
| POST | /api/v1/workspaces | Create a workspace | Signed-in user |
| GET | /api/v1/workspaces/{id} | Get a workspace the caller belongs to | Signed-in user |
| GET | /api/v1/workspaces/{id}/members | List a workspace's members | Signed-in user |
API Keys
| Method | Path | Description | Access |
|---|
| GET | /api/v1/api-keys | List workspace API keys | Workspace admin |
| POST | /api/v1/api-keys | Create an API key | Workspace admin |
| DELETE | /api/v1/api-keys/{id} | Revoke an API key | Workspace admin |