Skip to main content

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.

MethodPathSummary
GET/organization/sso/connection/listList an organization's identity provider connections
POST/organization/sso/connection/newAdd an identity provider to an organization
POST/organization/sso/connection/updateChange, enable or disable an identity provider connection
POST/organization/sso/connection/deleteRemove an identity provider connection
GET/organization/sso/domain/listList an organization's claimed email domains
POST/organization/sso/domain/newClaim an email domain for an organization
POST/organization/sso/domain/updateRoute a domain to one of the organization's connections
POST/organization/sso/domain/verifyVerify a claimed domain by DNS, or attest it as a proxy admin
POST/organization/sso/domain/deleteRelease a claimed domain
GET/organization/sso/scim_token/listList an organization's SCIM tokens
POST/organization/sso/scim_token/newMint an organization-scoped SCIM token
POST/organization/sso/scim_token/deleteRevoke an organization's SCIM token
POST/sso/org/discoverFind 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:

NameInTypeRequiredDescription
organization_idquerystringYes

Example request:

curl -X GET "http://localhost:4000/organization/sso/connection/list?organization_id=organization_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200The connections, secrets omittedapplication/json array of ConnectionView
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller is neither a proxy admin nor an admin of this organizationapplication/json ErrorDetail
422Validation Errorapplication/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):

FieldTypeRequiredDescription
organization_idstringYesThe organization this applies to
display_namestringYesThe name people see on the sign-in button
idpOidcSettings or SamlSettingsYesThe identity provider settings, OIDC or SAML
mappingMappingRulesNoHow identity provider groups become teams and roles
enabledbooleanNoWhether 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:

StatusDescriptionBody
200The stored connection and its login pathapplication/json ConnectionView
400A mapped team is not in the organization, or an OIDC connection has no client secretapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The license or Cloud plan does not include organization_sso, or the caller may not manage this organizationapplication/json ErrorDetail
404No organization with this idapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError

Response fields (200):

FieldTypeRequiredDescription
connection_idstringYesThe id of the connection
organization_idstringYesThe organization it belongs to
display_namestringYesThe name people see on the sign-in button
enabledbooleanYesWhether people can sign in through it
idpOidcSettingsView or SamlSettingsViewYesThe identity provider settings, secrets left out
mappingMappingRulesYesHow identity provider groups become teams and roles
login_pathstringYesThe gateway path that starts a sign-in through this connection
created_atstring or nullYesWhen the connection was added
updated_atstring or nullYesWhen 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):

FieldTypeRequiredDescription
connection_idstringYesThe connection to change
display_namestring or nullNoA new name for the sign-in button
idpOidcSettings or SamlSettings or nullNoNew identity provider settings, leave client_secret out to keep it
mappingMappingRules or nullNoNew group to team and role mappings
enabledboolean or nullNoTurn 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:

StatusDescriptionBody
200The connection after the changeapplication/json ConnectionView
400A mapped team is not in the organization, or a switch to OIDC has no client secretapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The license or Cloud plan does not include organization_sso, or the caller may not manage this organizationapplication/json ErrorDetail
404No connection with this idapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError

Response fields (200):

FieldTypeRequiredDescription
connection_idstringYesThe id of the connection
organization_idstringYesThe organization it belongs to
display_namestringYesThe name people see on the sign-in button
enabledbooleanYesWhether people can sign in through it
idpOidcSettingsView or SamlSettingsViewYesThe identity provider settings, secrets left out
mappingMappingRulesYesHow identity provider groups become teams and roles
login_pathstringYesThe gateway path that starts a sign-in through this connection
created_atstring or nullYesWhen the connection was added
updated_atstring or nullYesWhen 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):

FieldTypeRequiredDescription
connection_idstringYesThe 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:

StatusDescriptionBody
200The connection that was removedapplication/json ConnectionView
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller is neither a proxy admin nor an admin of this organizationapplication/json ErrorDetail
404No connection with this idapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError

Response fields (200):

FieldTypeRequiredDescription
connection_idstringYesThe id of the connection
organization_idstringYesThe organization it belongs to
display_namestringYesThe name people see on the sign-in button
enabledbooleanYesWhether people can sign in through it
idpOidcSettingsView or SamlSettingsViewYesThe identity provider settings, secrets left out
mappingMappingRulesYesHow identity provider groups become teams and roles
login_pathstringYesThe gateway path that starts a sign-in through this connection
created_atstring or nullYesWhen the connection was added
updated_atstring or nullYesWhen 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:

NameInTypeRequiredDescription
organization_idquerystringYes

Example request:

curl -X GET "http://localhost:4000/organization/sso/domain/list?organization_id=organization_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200The claims with their DNS recordsapplication/json array of DomainView
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller is neither a proxy admin nor an admin of this organizationapplication/json ErrorDetail
422Validation Errorapplication/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):

FieldTypeRequiredDescription
organization_idstringYesThe organization this applies to
domainstringYesThe email domain, such as example.com
connection_idstring or nullNoThe 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:

StatusDescriptionBody
200The pending claim and the TXT record to publishapplication/json DomainView
400The connection is not in the organization, or the domain is not validapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The license or Cloud plan does not include organization_sso, or the caller may not manage this organizationapplication/json ErrorDetail
404No organization with this idapplication/json ErrorDetail
409Another organization verified this domain, or this one already claimed itapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError

Response fields (200):

FieldTypeRequiredDescription
domainstringYesThe claimed email domain
organization_idstringYesThe organization that claimed it
connection_idstring or nullYesThe connection its sign-ins go to
verifiedbooleanYesWhether ownership was proven
verified_atstring or nullYesWhen ownership was proven
verification_record_namestringYesThe DNS TXT record name to publish
verification_record_valuestringYesThe 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):

FieldTypeRequiredDescription
organization_idstringYesThe organization this applies to
domainstringYesThe email domain, such as example.com
connection_idstring or nullNoThe 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:

StatusDescriptionBody
200The domain with its new connectionapplication/json DomainView
400The connection is not in the organizationapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller is neither a proxy admin nor an admin of this organizationapplication/json ErrorDetail
404The organization has not claimed this domainapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError

Response fields (200):

FieldTypeRequiredDescription
domainstringYesThe claimed email domain
organization_idstringYesThe organization that claimed it
connection_idstring or nullYesThe connection its sign-ins go to
verifiedbooleanYesWhether ownership was proven
verified_atstring or nullYesWhen ownership was proven
verification_record_namestringYesThe DNS TXT record name to publish
verification_record_valuestringYesThe 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):

FieldTypeRequiredDescription
organization_idstringYesThe organization this applies to
domainstringYesThe email domain, such as example.com
attestbooleanNoSkip 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:

StatusDescriptionBody
200The verified domainapplication/json DomainView
400The TXT record was not foundapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller may not manage this organization, or attested without being a proxy adminapplication/json ErrorDetail
404The organization has not claimed this domainapplication/json ErrorDetail
409Another organization verified this domain firstapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
503The DNS lookup failed. Try again, or a proxy admin can attest insteadapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
domainstringYesThe claimed email domain
organization_idstringYesThe organization that claimed it
connection_idstring or nullYesThe connection its sign-ins go to
verifiedbooleanYesWhether ownership was proven
verified_atstring or nullYesWhen ownership was proven
verification_record_namestringYesThe DNS TXT record name to publish
verification_record_valuestringYesThe 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):

FieldTypeRequiredDescription
organization_idstringYesThe organization this applies to
domainstringYesThe 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:

StatusDescriptionBody
200The claim that was releasedapplication/json DomainView
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller is neither a proxy admin nor an admin of this organizationapplication/json ErrorDetail
404The organization has not claimed this domainapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError

Response fields (200):

FieldTypeRequiredDescription
domainstringYesThe claimed email domain
organization_idstringYesThe organization that claimed it
connection_idstring or nullYesThe connection its sign-ins go to
verifiedbooleanYesWhether ownership was proven
verified_atstring or nullYesWhen ownership was proven
verification_record_namestringYesThe DNS TXT record name to publish
verification_record_valuestringYesThe 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:

NameInTypeRequiredDescription
organization_idquerystringYes

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:

StatusDescriptionBody
200The tokens, without their key valuesapplication/json array of ScimTokenView
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller is neither a proxy admin nor an admin of this organizationapplication/json ErrorDetail
422Validation Errorapplication/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):

FieldTypeRequiredDescription
organization_idstringYesThe organization this applies to
key_aliasstringNoA 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:

StatusDescriptionBody
200The token, with its key shown this onceapplication/json ScimTokenCreated
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The license or Cloud plan does not include organization_sso, or the caller may not manage this organizationapplication/json ErrorDetail
404No organization with this idapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500No database connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
token_idstringYesThe id of the token
key_aliasstring or nullYesThe name of the token
organization_idstringYesThe organization the token is limited to
created_atstring or nullYesWhen the token was made
keystringYesThe token itself, shown only this once
scim_base_pathstringYesThe 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):

FieldTypeRequiredDescription
organization_idstringYesThe organization this applies to
token_idstringYesThe 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:

StatusDescriptionBody
200The revoked tokenapplication/json ScimTokenView
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller is neither a proxy admin nor an admin of this organizationapplication/json ErrorDetail
404No SCIM token with that id in this organizationapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError

Response fields (200):

FieldTypeRequiredDescription
token_idstringYesThe id of the token
key_aliasstring or nullYesThe name of the token
organization_idstringYesThe organization the token is limited to
created_atstring or nullYesWhen 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):

FieldTypeRequiredDescription
emailstringYesEmail

Example request:

curl -X POST "http://localhost:4000/sso/org/discover" \
-H "Content-Type: application/json" \
-d '{
"email": "jane@examplecorp.com"
}'

Responses:

StatusDescriptionBody
200org_sso with the organization's login path, global_sso with the gateway-wide path, or passwordapplication/json OrgSsoDiscovery or GlobalSsoDiscovery or PasswordDiscovery
422Validation Errorapplication/json HTTPValidationError
429More than 30 lookups in a minute from this client addressapplication/json ErrorDetail