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

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

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

Learning

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

Contact

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

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

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

Audit

MethodPathDescriptionAccess
GET/api/v1/audit-logsList workspace audit log entriesWorkspace member
GET/api/v1/audit-logs/{id}Get one audit log entryWorkspace member
    API reference – Credit Acumen