API reference
Reference for every public endpoint of the Discence REST API: authentication, workspaces, uploads, learner progress, and API keys. 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" }] }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 |
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 |
Learning
| Method | Path | Description | Access |
|---|
| POST | /api/v1/learn/progress | Record a learner activity event | Signed-in user |
Contact
| Method | Path | Description | Access |
|---|
| POST | /api/v1/contact | Submit the public contact form | Public |
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 |
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 |
Audit
| Method | Path | Description | Access |
|---|
| GET | /api/v1/audit-logs | List workspace audit log entries | Workspace member |
| GET | /api/v1/audit-logs/{id} | Get one audit log entry | Workspace member |