Skip to main content

SSO Settings API

This page documents the 6 gateway endpoints tagged SSO Settings 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/get/internal_user_settingsRead the defaults applied to new SSO users
GET/get/default_team_settingsRead the defaults applied to new teams
PATCH/update/internal_user_settingsChange the defaults applied to new internal users
PATCH/update/default_team_settingsChange the defaults applied to new teams
GET/get/sso_settingsRead the Admin UI single sign-on configuration
PATCH/update/sso_settingsStore the Admin UI single sign-on configuration

Endpoints​

GET /get/internal_user_settings​

Read the defaults applied to new SSO users

Shows the defaults every user created by single sign-on receives: role, budget, budget period, models and teams. The answer carries the stored values and a description of every field so the Admin UI can show them. Proxy admins and admin viewers may read it, other keys get 401, and it changes nothing.

Docs

Example request:

curl -X GET "http://localhost:4000/get/internal_user_settings" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200The stored defaults with a description of every field for the Admin UIapplication/json InternalUserSettingsResponse
401No valid key or Admin UI session was presentedapplication/json ProxyError

Response fields (200):

FieldTypeRequiredDescription
valuesobjectYesValues
field_schemaobjectYesField Schema

GET /get/default_team_settings​

Read the defaults applied to new teams

Shows the defaults (spanway_settings.default_team_params) applied to every new team for fields the create request leaves out. models only applies to teams created automatically from single sign-on groups. The answer carries the stored values and a description of every field. Proxy admins and admin viewers may read it, other keys get 401, and it changes nothing.

Docs (https://docs.spanway.ai/docs/proxy/team_sso)

Example request:

curl -X GET "http://localhost:4000/get/default_team_settings" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200The stored defaults with a description of every field for the Admin UIapplication/json DefaultTeamSettingsResponse
401No valid key or Admin UI session was presentedapplication/json ProxyError

Response fields (200):

FieldTypeRequiredDescription
valuesobjectYesValues
field_schemaobjectYesField Schema

PATCH /update/internal_user_settings​

Change the defaults applied to new internal users

Sets the role, budget, budget period, models and teams every new internal user receives, whether single sign-on, /user/new or bulk create made the account. Existing users are not changed. The settings are saved to the database config, applied at once and written to the audit log. Only proxy admins may call it.

Docs

Request body (application/json, schema DefaultInternalUserParams):

FieldTypeRequiredDescription
user_roleenum: "proxy_admin", "proxy_admin_viewer", "internal_user", "internal_user_viewer" or nullNoDefault role assigned to new users created
max_budgetnumber or nullNoDefault maximum budget (in USD) for new users created
budget_durationstring or nullNoDefault budget duration for new users (e.g. 'daily', 'weekly', 'monthly')
modelsarray of string or nullNoDefault list of models that new users can access
teamsarray of string or array of NewUserRequestTeam or nullNoDefault teams for new users created

Example request:

curl -X PATCH "http://localhost:4000/update/internal_user_settings" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"user_role": "internal_user",
"max_budget": 50,
"budget_duration": "30d"
}'

Responses:

StatusDescriptionBody
200The defaults now in forceapplication/json SettingsUpdated
400A default team does not existapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The key is not a proxy admin keyapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway runs without a database, or store_model_in_db is offapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
messagestringYesMessage
status"success"YesStatus
settingsobjectYesSettings

PATCH /update/default_team_settings​

Change the defaults applied to new teams

Sets spanway_settings.default_team_params, the defaults applied to every new team for fields the create request leaves out. models only applies to teams created automatically from single sign-on groups. Existing teams are not changed. The settings are saved, applied at once and written to the audit log. Only proxy admins may call it.

Docs (https://docs.spanway.ai/docs/proxy/team_sso)

Request body (application/json, schema DefaultTeamSSOParams):

FieldTypeRequiredDescription
modelsarray of stringNoDefault list of models for teams automatically created via SSO Groups
max_budgetnumber or nullNoDefault maximum budget (in USD) for new teams, when not explicitly provided
budget_durationstring or nullNoDefault budget duration for new teams, when not explicitly provided (e.g. '24h', '7d', '30d')
tpm_limitinteger or nullNoDefault tpm limit for new teams, when not explicitly provided
rpm_limitinteger or nullNoDefault rpm limit for new teams, when not explicitly provided
team_member_permissionsarray of KeyManagementRoutes or nullNoDefault permissions granted to members of newly created teams (e.g. /key/generate, /key/update, /key/delete). /key/info and /key/health are always included.
organization_idstring or nullNoDefault organization for new teams created without an explicit organization

Example request:

curl -X PATCH "http://localhost:4000/update/default_team_settings" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"models": [
"claude-sonnet"
],
"max_budget": 200,
"budget_duration": "30d"
}'

Responses:

StatusDescriptionBody
200The defaults now in forceapplication/json SettingsUpdated
400The default organization does not existapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The key is not a proxy admin keyapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway runs without a database, or store_model_in_db is offapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
messagestringYesMessage
status"success"YesStatus
settingsobjectYesSettings

GET /get/sso_settings​

Read the Admin UI single sign-on configuration

Shows the single sign-on configuration the gateway uses for the Admin UI: the stored row wins, then the process environment, then each field's default. provenance says per field whether the value came from db, env, default or is unset, client secrets are masked, and field_schema describes every field. Proxy admins and admin viewers may read it, other keys get 401, and it changes nothing.

Docs

Example request:

curl -X GET "http://localhost:4000/get/sso_settings" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200The effective configuration with secrets masked and the source of every valueapplication/json SSOSettingsResponse
401No valid key or Admin UI session was presentedapplication/json ProxyError
500The gateway runs without a database, or store_model_in_db is offapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
valuesobjectYesValues
field_schemaobjectYesField Schema
provenanceobjectNoProvenance

PATCH /update/sso_settings​

Store the Admin UI single sign-on configuration

Save the single sign-on configuration for the whole gateway: the provider's client credentials and endpoints, the proxy base URL, the proxy admin email, the UI access mode and the role and team mappings. Fields left out of the body keep their stored value and a field sent as null is cleared. Secrets are encrypted before they are stored, the change applies without a restart and is written to the audit log. Needs a database with store_model_in_db and a proxy admin.

Docs

Request body (application/json, schema SSOConfig):

FieldTypeRequiredDescription
google_client_idstring or nullNoGoogle OAuth Client ID for SSO authentication
google_client_secretstring or nullNoGoogle OAuth Client Secret for SSO authentication
microsoft_client_idstring or nullNoMicrosoft OAuth Client ID for SSO authentication
microsoft_client_secretstring or nullNoMicrosoft OAuth Client Secret for SSO authentication
microsoft_tenantstring or nullNoMicrosoft Azure Tenant ID for SSO authentication
generic_client_idstring or nullNoGeneric OAuth Client ID for SSO authentication (used for Okta and other providers)
generic_client_secretstring or nullNoGeneric OAuth Client Secret for SSO authentication
generic_authorization_endpointstring or nullNoAuthorization endpoint URL for generic OAuth provider
generic_token_endpointstring or nullNoToken endpoint URL for generic OAuth provider
generic_userinfo_endpointstring or nullNoUser info endpoint URL for generic OAuth provider
generic_scopestring or nullNoSpace-separated OAuth scopes requested from the generic provider, e.g. 'openid email profile'
saml_idp_metadata_urlstring or nullNoURL of the SAML IdP metadata to fetch and parse for SSO authentication
saml_idp_metadata_xmlstring or nullNoInline SAML IdP metadata XML, used when a metadata URL is not available
saml_sp_entity_idstring or nullNoSAML Service Provider entityID; defaults to the proxy's /sso/saml/metadata URL
saml_allow_unsolicitedstring or nullNo'true' to accept IdP-initiated (unsolicited) SAML responses, which cannot be browser-bound against login CSRF
proxy_base_urlstring or nullNoBase URL of the proxy server for SSO redirects
user_emailstring or nullNoEmail of the proxy admin user
ui_access_modeAccessControl_UI_AccessMode or string or nullNoAccess mode for the UI
role_mappingsRoleMappings or nullNoConfiguration for mapping SSO groups to Spanway roles based on group claims in the SSO token
team_mappingsTeamMappings or nullNoConfiguration for mapping SSO JWT fields to team IDs. Takes precedence over config file settings.

Example request:

curl -X PATCH "http://localhost:4000/update/sso_settings" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"generic_client_id": "0oa1examplecorp",
"generic_client_secret": "...",
"generic_authorization_endpoint": "https://login.example.com/oauth2/v1/authorize",
"generic_token_endpoint": "https://login.example.com/oauth2/v1/token",
"generic_userinfo_endpoint": "https://login.example.com/oauth2/v1/userinfo",
"generic_scope": "openid email profile groups",
"proxy_base_url": "https://gateway.example.com",
"user_email": "admin@example.com",
"team_mappings": {
"team_ids_jwt_field": "groups"
}
}'

Responses:

StatusDescriptionBody
200The configuration as storedapplication/json SettingsUpdated
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The key is not a proxy admin keyapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway runs without a database, or store_model_in_db is offapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
messagestringYesMessage
status"success"YesStatus
settingsobjectYesSettings