DocsREST API
SSO and SCIM API
Configure OIDC single sign-on, run the login flow, manage the SCIM token and use the SCIM 2.0 user endpoints.
SSO has been tested against an in-test OpenID provider only, not Okta, Entra or Google. SCIM has been verified in production. Concepts and caveats: SSO, SCIM.
SSO configuration
Session token required. GET needs viewer, PUT and DELETE need admin.
Read
GET /v1/orgs/:orgId/sso
{
"configured": true,
"issuer": "https://idp.acme.dev",
"clientId": "generic-translation",
"domains": ["acme.dev"],
"enforce": false,
"defaultRole": "member",
"redirectUri": "https://generic-translation-api.jacobfv123.workers.dev/v1/auth/sso/callback",
"hasClientSecret": true,
"scim": { "enabled": false, "createdAt": null }
}
When nothing is configured, configured is false, issuer and clientId are omitted, and redirectUri is still returned so you can register it first. The client secret is never returned.
Write
PUT /v1/orgs/:orgId/sso
{
"issuer": "https://idp.acme.dev",
"clientId": "generic-translation",
"clientSecret": "…",
"domains": ["acme.dev"],
"enforce": false,
"defaultRole": "member"
}
| Field | Rules |
|---|---|
issuer |
https URL, no query or fragment. |
clientId |
Required. |
clientSecret |
Optional and write-only. Omit to keep the stored secret. Needs the instance’s ENCRYPTION_KEY. |
domains |
1 to 50 domain names, lower-cased and de-duplicated. |
enforce |
Default false. |
defaultRole |
viewer, member (default) or admin. |
Returns the same object as GET. Errors: 400 invalid_request (including a public mail domain), 409 conflict (domain used by another organization), 501 sso_not_configured (a secret was sent but ENCRYPTION_KEY is not set).
Remove
DELETE /v1/orgs/:orgId/sso returns { "ok": true }. It deletes the configuration and the domain claims.
Login flow
These routes need no authentication. They are rate limited per IP like the other /v1/auth/* routes.
| Route | Behavior |
|---|---|
GET /v1/auth/sso/discover?email= |
{ "sso": true, "orgId": "…" } if the email’s domain belongs to an organization with SSO, else { "sso": false }. |
GET /v1/auth/sso/start?orgId=&returnTo=&email= |
302 to the provider. returnTo must be a path starting with a single /; otherwise it is dropped. email is an optional login hint. |
GET /v1/auth/sso/callback |
The provider’s redirect target. 302 to <dashboard>/sso/callback#token=gt-sess-…&orgId=…&returnTo=…, or #error=<code>&error_description=…. |
These routes redirect even on errors, because a browser is on the other end. For example, start with an unknown orgId redirects with #error=sso_not_configured instead of returning JSON. The error codes are listed on the SSO page.
Enforcement error
When SSO is enforced, POST /v1/auth/login returns 403 with code sso_required and details.orgId for members of the enforcing organization whose email domain matches. See what enforcement covers.
SCIM token
Session token, admin role.
| Route | Result |
|---|---|
POST /v1/orgs/:orgId/scim/token |
201 { "token": "gt-scim-…", "createdAt": "…" }. Shown once; replaces any earlier token. |
DELETE /v1/orgs/:orgId/scim/token |
{ "ok": true }. |
SCIM 2.0
Base: /scim/v2/:orgId. Header: Authorization: Bearer gt-scim-…. A missing or wrong token returns 401. Errors use the SCIM error schema (schemas, status, detail, optional scimType).
| Method and path | Notes |
|---|---|
GET /ServiceProviderConfig |
Patch and filter supported (max 200 results); bulk, sort, ETag and password change are not. |
GET /ResourceTypes, GET /Schemas |
One resource type (User) with the Generic Translation role extension. |
GET /Users |
Query: filter (one eq clause on userName, externalId, id or emails.value), startIndex (default 1), count (0 to 200, default 100). Returns a ListResponse. |
POST /Users |
201 with the user. Requires userName (or a primary email) that is an email address. |
GET /Users/:id |
404 if the user was not provisioned through SCIM in this organization. |
PUT /Users/:id |
Replaces the writable fields. |
PATCH /Users/:id |
Needs the PatchOp schema and a non-empty Operations array of add, replace or remove. |
DELETE /Users/:id |
204. Removes membership, revokes the user’s sessions and deletes the SCIM record. |
SCIM errors you can meet: 400 with scimType invalidSyntax, invalidValue (for example a role other than viewer, member, admin), invalidFilter, noTarget or mutability (last owner); 401; 404; 409 with uniqueness.
Something wrong or unclear on this page? Open an issue.