Organization sso API
This page documents the 13 gateway endpoints tagged organization sso in the gateway's OpenAPI document. Every example targets a gateway on http://localhost:4000 and authenticates with the SPANWAY_API_KEY environment variable, which holds the master key or a virtual key that has access to the route. Request and response fields are taken from the schema the running gateway publishes at /openapi.json, and the same document is bundled with this site as openapi.json.
| Method | Path | Summary |
|---|---|---|
| GET | /organization/sso/connection/list | List an organization's identity provider connections |
| POST | /organization/sso/connection/new | Add an identity provider to an organization |
| POST | /organization/sso/connection/update | Change, enable or disable an identity provider connection |
| POST | /organization/sso/connection/delete | Remove an identity provider connection |
| GET | /organization/sso/domain/list | List an organization's claimed email domains |
| POST | /organization/sso/domain/new | Claim an email domain for an organization |
| POST | /organization/sso/domain/update | Route a domain to one of the organization's connections |
| POST | /organization/sso/domain/verify | Verify a claimed domain by DNS, or attest it as a proxy admin |
| POST | /organization/sso/domain/delete | Release a claimed domain |
| GET | /organization/sso/scim_token/list | List an organization's SCIM tokens |
| POST | /organization/sso/scim_token/new | Mint an organization-scoped SCIM token |
| POST | /organization/sso/scim_token/delete | Revoke an organization's SCIM token |
| POST | /sso/org/discover | Find where a person with this email signs in |
Endpoints
GET /organization/sso/connection/list
List an organization's identity provider connections
Lists the identity provider connections an organization uses for single sign-on, with their group to team and role mappings and login paths. Client secrets are never returned. A proxy admin or an admin of that organization may call it. Nothing is changed.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
organization_id | query | string | Yes |
Example request:
curl -X GET "http://localhost:4000/organization/sso/connection/list?organization_id=organization_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The connections, secrets omitted | application/json array of ConnectionView |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller is neither a proxy admin nor an admin of this organization | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
POST /organization/sso/connection/new
Add an identity provider to an organization
Connects an organization to its own identity provider (OIDC or SAML) so its people sign in with their work accounts, and sets which team and role each new user gets from their identity provider groups. The response carries the login path to share with the organization. A proxy admin or an admin of that organization may call it, the change is written to the audit log, and the client secret is never returned.
Request body (application/json, schema NewConnectionRequest):
| Field | Type | Required | Description |
|---|---|---|---|
organization_id | string | Yes | The organization this applies to |
display_name | string | Yes | The name people see on the sign-in button |
idp | OidcSettings or SamlSettings | Yes | The identity provider settings, OIDC or SAML |
mapping | MappingRules | No | How identity provider groups become teams and roles |
enabled | boolean | No | Whether people can sign in through it yet |
Example request:
curl -X POST "http://localhost:4000/organization/sso/connection/new" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"organization_id": "org-examplecorp",
"display_name": "Examplecorp Okta",
"idp": {
"protocol": "oidc",
"issuer_url": "https://examplecorp.okta.com",
"client_id": "0oa1",
"client_secret": "..."
},
"mapping": {
"default_team_id": "team-examplecorp",
"role_mappings": {
"gateway-admins": "org_admin"
}
}
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The stored connection and its login path | application/json ConnectionView |
| 400 | A mapped team is not in the organization, or an OIDC connection has no client secret | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license or Cloud plan does not include organization_sso, or the caller may not manage this organization | application/json ErrorDetail |
| 404 | No organization with this id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
connection_id | string | Yes | The id of the connection |
organization_id | string | Yes | The organization it belongs to |
display_name | string | Yes | The name people see on the sign-in button |
enabled | boolean | Yes | Whether people can sign in through it |
idp | OidcSettingsView or SamlSettingsView | Yes | The identity provider settings, secrets left out |
mapping | MappingRules | Yes | How identity provider groups become teams and roles |
login_path | string | Yes | The gateway path that starts a sign-in through this connection |
created_at | string or null | Yes | When the connection was added |
updated_at | string or null | Yes | When it was last changed |
POST /organization/sso/connection/update
Change, enable or disable an identity provider connection
Changes an organization's identity provider connection, or turns it on or off. Omit idp.client_secret to keep the stored one. A proxy admin or an admin of that organization may call it, and the change is written to the audit log.
Request body (application/json, schema UpdateConnectionRequest):
| Field | Type | Required | Description |
|---|---|---|---|
connection_id | string | Yes | The connection to change |
display_name | string or null | No | A new name for the sign-in button |
idp | OidcSettings or SamlSettings or null | No | New identity provider settings, leave client_secret out to keep it |
mapping | MappingRules or null | No | New group to team and role mappings |
enabled | boolean or null | No | Turn the connection on or off |
Example request:
curl -X POST "http://localhost:4000/organization/sso/connection/update" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"connection_id": "conn_01J...",
"enabled": false
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The connection after the change | application/json ConnectionView |
| 400 | A mapped team is not in the organization, or a switch to OIDC has no client secret | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license or Cloud plan does not include organization_sso, or the caller may not manage this organization | application/json ErrorDetail |
| 404 | No connection with this id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
connection_id | string | Yes | The id of the connection |
organization_id | string | Yes | The organization it belongs to |
display_name | string | Yes | The name people see on the sign-in button |
enabled | boolean | Yes | Whether people can sign in through it |
idp | OidcSettingsView or SamlSettingsView | Yes | The identity provider settings, secrets left out |
mapping | MappingRules | Yes | How identity provider groups become teams and roles |
login_path | string | Yes | The gateway path that starts a sign-in through this connection |
created_at | string or null | Yes | When the connection was added |
updated_at | string or null | Yes | When it was last changed |
POST /organization/sso/connection/delete
Remove an identity provider connection
Remove an identity provider connection. Domains routed to it fall back to the organization's other connections, and users it created keep their accounts. A proxy admin or an admin of that organization may call it, and the change is written to the audit log.
Request body (application/json, schema ConnectionIdRequest):
| Field | Type | Required | Description |
|---|---|---|---|
connection_id | string | Yes | The connection to remove |
Example request:
curl -X POST "http://localhost:4000/organization/sso/connection/delete" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"connection_id": "conn_01J..."
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The connection that was removed | application/json ConnectionView |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller is neither a proxy admin nor an admin of this organization | application/json ErrorDetail |
| 404 | No connection with this id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
connection_id | string | Yes | The id of the connection |
organization_id | string | Yes | The organization it belongs to |
display_name | string | Yes | The name people see on the sign-in button |
enabled | boolean | Yes | Whether people can sign in through it |
idp | OidcSettingsView or SamlSettingsView | Yes | The identity provider settings, secrets left out |
mapping | MappingRules | Yes | How identity provider groups become teams and roles |
login_path | string | Yes | The gateway path that starts a sign-in through this connection |
created_at | string or null | Yes | When the connection was added |
updated_at | string or null | Yes | When it was last changed |
GET /organization/sso/domain/list
List an organization's claimed email domains
Lists the email domains an organization has claimed, whether each is verified, and the DNS TXT record that proves ownership of each. A proxy admin or an admin of that organization may call it. Nothing is changed.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
organization_id | query | string | Yes |
Example request:
curl -X GET "http://localhost:4000/organization/sso/domain/list?organization_id=organization_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The claims with their DNS records | application/json array of DomainView |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller is neither a proxy admin nor an admin of this organization | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
POST /organization/sso/domain/new
Claim an email domain for an organization
Claim an email domain for an organization. Several organizations may hold a pending claim, it routes sign-ins only once verified, and the first verification removes every other organization's pending claim. Publish the TXT record from the response, then call the verify route. A proxy admin or an admin of that organization may call it, and the claim is written to the audit log.
Request body (application/json, schema NewDomainRequest):
| Field | Type | Required | Description |
|---|---|---|---|
organization_id | string | Yes | The organization this applies to |
domain | string | Yes | The email domain, such as example.com |
connection_id | string or null | No | The connection to send its sign-ins to, the first enabled one when left out |
Example request:
curl -X POST "http://localhost:4000/organization/sso/domain/new" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"organization_id": "org-examplecorp",
"domain": "examplecorp.com"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The pending claim and the TXT record to publish | application/json DomainView |
| 400 | The connection is not in the organization, or the domain is not valid | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license or Cloud plan does not include organization_sso, or the caller may not manage this organization | application/json ErrorDetail |
| 404 | No organization with this id | application/json ErrorDetail |
| 409 | Another organization verified this domain, or this one already claimed it | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
domain | string | Yes | The claimed email domain |
organization_id | string | Yes | The organization that claimed it |
connection_id | string or null | Yes | The connection its sign-ins go to |
verified | boolean | Yes | Whether ownership was proven |
verified_at | string or null | Yes | When ownership was proven |
verification_record_name | string | Yes | The DNS TXT record name to publish |
verification_record_value | string | Yes | The value the TXT record must hold |
POST /organization/sso/domain/update
Route a domain to one of the organization's connections
Routes sign-ins from a claimed domain to one of the organization's connections, or to its first enabled connection when connection_id is null. A proxy admin or an admin of that organization may call it, and the change is written to the audit log.
Request body (application/json, schema UpdateDomainRequest):
| Field | Type | Required | Description |
|---|---|---|---|
organization_id | string | Yes | The organization this applies to |
domain | string | Yes | The email domain, such as example.com |
connection_id | string or null | No | The connection to send its sign-ins to, null for the first enabled one |
Example request:
curl -X POST "http://localhost:4000/organization/sso/domain/update" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"organization_id": "org-examplecorp",
"domain": "examplecorp.com",
"connection_id": "conn_01J..."
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The domain with its new connection | application/json DomainView |
| 400 | The connection is not in the organization | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller is neither a proxy admin nor an admin of this organization | application/json ErrorDetail |
| 404 | The organization has not claimed this domain | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
domain | string | Yes | The claimed email domain |
organization_id | string | Yes | The organization that claimed it |
connection_id | string or null | Yes | The connection its sign-ins go to |
verified | boolean | Yes | Whether ownership was proven |
verified_at | string or null | Yes | When ownership was proven |
verification_record_name | string | Yes | The DNS TXT record name to publish |
verification_record_value | string | Yes | The value the TXT record must hold |
POST /organization/sso/domain/verify
Verify a claimed domain by DNS, or attest it as a proxy admin
Verifies a claimed domain by looking up its DNS TXT record, so sign-ins with that domain start going to the organization's identity provider. A proxy admin may attest ownership instead of the DNS check. Answers 503 when DNS cannot be reached. A proxy admin or an admin of that organization may call it, and the change is written to the audit log.
Request body (application/json, schema VerifyDomainRequest):
| Field | Type | Required | Description |
|---|---|---|---|
organization_id | string | Yes | The organization this applies to |
domain | string | Yes | The email domain, such as example.com |
attest | boolean | No | Skip the DNS check and vouch for the domain, proxy admins only |
Example request:
curl -X POST "http://localhost:4000/organization/sso/domain/verify" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"organization_id": "org-examplecorp",
"domain": "examplecorp.com"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The verified domain | application/json DomainView |
| 400 | The TXT record was not found | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller may not manage this organization, or attested without being a proxy admin | application/json ErrorDetail |
| 404 | The organization has not claimed this domain | application/json ErrorDetail |
| 409 | Another organization verified this domain first | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 503 | The DNS lookup failed. Try again, or a proxy admin can attest instead | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
domain | string | Yes | The claimed email domain |
organization_id | string | Yes | The organization that claimed it |
connection_id | string or null | Yes | The connection its sign-ins go to |
verified | boolean | Yes | Whether ownership was proven |
verified_at | string or null | Yes | When ownership was proven |
verification_record_name | string | Yes | The DNS TXT record name to publish |
verification_record_value | string | Yes | The value the TXT record must hold |
POST /organization/sso/domain/delete
Release a claimed domain
Releases an email domain the organization claimed. People with that domain no longer get routed to the organization's identity provider and fall back to the gateway-wide sign-in options. A proxy admin or an admin of that organization may call it, and the change is written to the audit log.
Request body (application/json, schema DomainRequest):
| Field | Type | Required | Description |
|---|---|---|---|
organization_id | string | Yes | The organization this applies to |
domain | string | Yes | The email domain, such as example.com |
Example request:
curl -X POST "http://localhost:4000/organization/sso/domain/delete" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"organization_id": "org-examplecorp",
"domain": "examplecorp.com"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The claim that was released | application/json DomainView |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller is neither a proxy admin nor an admin of this organization | application/json ErrorDetail |
| 404 | The organization has not claimed this domain | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
domain | string | Yes | The claimed email domain |
organization_id | string | Yes | The organization that claimed it |
connection_id | string or null | Yes | The connection its sign-ins go to |
verified | boolean | Yes | Whether ownership was proven |
verified_at | string or null | Yes | When ownership was proven |
verification_record_name | string | Yes | The DNS TXT record name to publish |
verification_record_value | string | Yes | The value the TXT record must hold |
GET /organization/sso/scim_token/list
List an organization's SCIM tokens
Lists the SCIM tokens an organization's identity provider uses to create and remove its users and groups automatically. Key values are never returned. A proxy admin or an admin of that organization may call it. Nothing is changed.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
organization_id | query | string | Yes |
Example request:
curl -X GET "http://localhost:4000/organization/sso/scim_token/list?organization_id=organization_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The tokens, without their key values | application/json array of ScimTokenView |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller is neither a proxy admin nor an admin of this organization | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
POST /organization/sso/scim_token/new
Mint an organization-scoped SCIM token
Creates a SCIM token for an organization's identity provider, so it can create and remove that organization's users and groups automatically and nothing outside it. The key is shown once, so store it in the identity provider right away. A proxy admin or an admin of that organization may call it, and the change is written to the audit log.
Request body (application/json, schema ScimTokenRequest):
| Field | Type | Required | Description |
|---|---|---|---|
organization_id | string | Yes | The organization this applies to |
key_alias | string | No | A name for the token, shown in the token list |
Example request:
curl -X POST "http://localhost:4000/organization/sso/scim_token/new" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"organization_id": "org-examplecorp",
"key_alias": "Examplecorp Okta SCIM"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The token, with its key shown this once | application/json ScimTokenCreated |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license or Cloud plan does not include organization_sso, or the caller may not manage this organization | application/json ErrorDetail |
| 404 | No organization with this id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | No database connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
token_id | string | Yes | The id of the token |
key_alias | string or null | Yes | The name of the token |
organization_id | string | Yes | The organization the token is limited to |
created_at | string or null | Yes | When the token was made |
key | string | Yes | The token itself, shown only this once |
scim_base_path | string | Yes | The SCIM address to give the identity provider |
POST /organization/sso/scim_token/delete
Revoke an organization's SCIM token
Revokes one of an organization's SCIM tokens, so the identity provider holding it can no longer create, change or remove users. Users and groups it already created stay. A proxy admin or an admin of that organization may call it, and the revocation is written to the audit log.
Request body (application/json, schema ScimTokenDeleteRequest):
| Field | Type | Required | Description |
|---|---|---|---|
organization_id | string | Yes | The organization this applies to |
token_id | string | Yes | The token to revoke |
Example request:
curl -X POST "http://localhost:4000/organization/sso/scim_token/delete" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"organization_id": "org-examplecorp",
"token_id": "key_01J..."
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The revoked token | application/json ScimTokenView |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller is neither a proxy admin nor an admin of this organization | application/json ErrorDetail |
| 404 | No SCIM token with that id in this organization | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
token_id | string | Yes | The id of the token |
key_alias | string or null | Yes | The name of the token |
organization_id | string | Yes | The organization the token is limited to |
created_at | string or null | Yes | When the token was made |
POST /sso/org/discover
Find where a person with this email signs in
Where a person with this email address signs in: their organization's identity provider, the gateway-wide SSO, or a password. The answer depends only on the email domain, never on whether the person has an account.
Request body (application/json, schema DiscoverRequest):
| Field | Type | Required | Description |
|---|---|---|---|
email | string | Yes |
Example request:
curl -X POST "http://localhost:4000/sso/org/discover" \
-H "Content-Type: application/json" \
-d '{
"email": "jane@examplecorp.com"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | org_sso with the organization's login path, global_sso with the gateway-wide path, or password | application/json OrgSsoDiscovery or GlobalSsoDiscovery or PasswordDiscovery |
| 422 | Validation Error | application/json HTTPValidationError |
| 429 | More than 30 lookups in a minute from this client address | application/json ErrorDetail |