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.
| Method | Path | Summary |
|---|---|---|
| GET | /get/internal_user_settings | Read the defaults applied to new SSO users |
| GET | /get/default_team_settings | Read the defaults applied to new teams |
| PATCH | /update/internal_user_settings | Change the defaults applied to new internal users |
| PATCH | /update/default_team_settings | Change the defaults applied to new teams |
| GET | /get/sso_settings | Read the Admin UI single sign-on configuration |
| PATCH | /update/sso_settings | Store 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.
Example request:
curl -X GET "http://localhost:4000/get/internal_user_settings" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The stored defaults with a description of every field for the Admin UI | application/json InternalUserSettingsResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
values | object | Yes | Values |
field_schema | object | Yes | Field 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:
| Status | Description | Body |
|---|---|---|
| 200 | The stored defaults with a description of every field for the Admin UI | application/json DefaultTeamSettingsResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
values | object | Yes | Values |
field_schema | object | Yes | Field 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.
Request body (application/json, schema DefaultInternalUserParams):
| Field | Type | Required | Description |
|---|---|---|---|
user_role | enum: "proxy_admin", "proxy_admin_viewer", "internal_user", "internal_user_viewer" or null | No | Default role assigned to new users created |
max_budget | number or null | No | Default maximum budget (in USD) for new users created |
budget_duration | string or null | No | Default budget duration for new users (e.g. 'daily', 'weekly', 'monthly') |
models | array of string or null | No | Default list of models that new users can access |
teams | array of string or array of NewUserRequestTeam or null | No | Default 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:
| Status | Description | Body |
|---|---|---|
| 200 | The defaults now in force | application/json SettingsUpdated |
| 400 | A default team does not exist | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key is not a proxy admin key | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway runs without a database, or store_model_in_db is off | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
message | string | Yes | Message |
status | "success" | Yes | Status |
settings | object | Yes | Settings |
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):
| Field | Type | Required | Description |
|---|---|---|---|
models | array of string | No | Default list of models for teams automatically created via SSO Groups |
max_budget | number or null | No | Default maximum budget (in USD) for new teams, when not explicitly provided |
budget_duration | string or null | No | Default budget duration for new teams, when not explicitly provided (e.g. '24h', '7d', '30d') |
tpm_limit | integer or null | No | Default tpm limit for new teams, when not explicitly provided |
rpm_limit | integer or null | No | Default rpm limit for new teams, when not explicitly provided |
team_member_permissions | array of KeyManagementRoutes or null | No | Default 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_id | string or null | No | Default 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:
| Status | Description | Body |
|---|---|---|
| 200 | The defaults now in force | application/json SettingsUpdated |
| 400 | The default organization does not exist | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key is not a proxy admin key | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway runs without a database, or store_model_in_db is off | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
message | string | Yes | Message |
status | "success" | Yes | Status |
settings | object | Yes | Settings |
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.
Example request:
curl -X GET "http://localhost:4000/get/sso_settings" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The effective configuration with secrets masked and the source of every value | application/json SSOSettingsResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 500 | The gateway runs without a database, or store_model_in_db is off | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
values | object | Yes | Values |
field_schema | object | Yes | Field Schema |
provenance | object | No | Provenance |
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.
Request body (application/json, schema SSOConfig):
| Field | Type | Required | Description |
|---|---|---|---|
google_client_id | string or null | No | Google OAuth Client ID for SSO authentication |
google_client_secret | string or null | No | Google OAuth Client Secret for SSO authentication |
microsoft_client_id | string or null | No | Microsoft OAuth Client ID for SSO authentication |
microsoft_client_secret | string or null | No | Microsoft OAuth Client Secret for SSO authentication |
microsoft_tenant | string or null | No | Microsoft Azure Tenant ID for SSO authentication |
generic_client_id | string or null | No | Generic OAuth Client ID for SSO authentication (used for Okta and other providers) |
generic_client_secret | string or null | No | Generic OAuth Client Secret for SSO authentication |
generic_authorization_endpoint | string or null | No | Authorization endpoint URL for generic OAuth provider |
generic_token_endpoint | string or null | No | Token endpoint URL for generic OAuth provider |
generic_userinfo_endpoint | string or null | No | User info endpoint URL for generic OAuth provider |
generic_scope | string or null | No | Space-separated OAuth scopes requested from the generic provider, e.g. 'openid email profile' |
saml_idp_metadata_url | string or null | No | URL of the SAML IdP metadata to fetch and parse for SSO authentication |
saml_idp_metadata_xml | string or null | No | Inline SAML IdP metadata XML, used when a metadata URL is not available |
saml_sp_entity_id | string or null | No | SAML Service Provider entityID; defaults to the proxy's /sso/saml/metadata URL |
saml_allow_unsolicited | string or null | No | 'true' to accept IdP-initiated (unsolicited) SAML responses, which cannot be browser-bound against login CSRF |
proxy_base_url | string or null | No | Base URL of the proxy server for SSO redirects |
user_email | string or null | No | Email of the proxy admin user |
ui_access_mode | AccessControl_UI_AccessMode or string or null | No | Access mode for the UI |
role_mappings | RoleMappings or null | No | Configuration for mapping SSO groups to Spanway roles based on group claims in the SSO token |
team_mappings | TeamMappings or null | No | Configuration 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:
| Status | Description | Body |
|---|---|---|
| 200 | The configuration as stored | application/json SettingsUpdated |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key is not a proxy admin key | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway runs without a database, or store_model_in_db is off | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
message | string | Yes | Message |
status | "success" | Yes | Status |
settings | object | Yes | Settings |