Skip to main content

Internal User management API

This page documents the 11 gateway endpoints tagged Internal User management 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
POST/user/newCreate an internal user
GET/user/infoGet a user with their keys and teams
GET/v2/user/infoGet a user's profile and limits
POST/user/updateUpdate an internal user
POST/user/bulk_updateUpdate several users at once
GET/user/listList internal users
POST/user/deleteDelete internal users
POST/user/password/changeChange your own password
POST/management/v1/users/bulkCreate several users at once
POST/management/v1/users/bulk_deleteDelete several users at once
GET/user/available_usersSeats used and remaining under the license

Endpoints​

POST /user/new​

Create an internal user

Creates a person who can sign in to the Admin UI and call models, with an optional budget, model list and teams, and by default a first key. Proxy admins and organization admins may call it, and only proxy admins may create proxy admins or admin viewers. The new user is written to the audit log.

Use this to create a new INTERNAL user with a budget. Internal Users can access Spanway Admin UI to make keys, request access to models. This creates a new user and generates a new api key for the new user. The new api key is returned.

Returns user id, budget + new key.

What to send:

  • user_id: Specify a user id. If not set, a unique id will be generated.
  • user_alias: A descriptive name for you to know who this user id refers to.
  • teams: specify a list of team id's a user belongs to.
  • user_email: Specify a user email.
  • send_invite_email: Specify if an invite email should be sent.
  • user_role: One of "proxy_admin", "proxy_admin_viewer", "internal_user" or "internal_user_viewer". See https://docs.spanway.ai/docs/proxy/users#roles
  • max_budget: Specify max budget for a given user.
  • budget_duration: Budget is reset at the end of specified duration. If not set, budget is never reset. You can set duration as seconds ("30s"), minutes ("30m"), hours ("30h"), days ("30d"), months ("1mo").
  • models: Model_name's a user is allowed to call. (if empty, key is allowed to call all models). Set to ['no-default-models'] to block all model access. Restricting user to only team-based model access.
  • tpm_limit: Specify tpm limit for a given user (Tokens per minute)
  • rpm_limit: Specify rpm limit for a given user (Requests per minute)
  • auto_create_key: Default=True. Flag used for returning a key as part of the /user/new response
  • aliases: Model aliases for the user - Docs
  • config: [DEPRECATED PARAM] User-specific config.
  • allowed_cache_controls: List of allowed cache control values. Example - ["no-cache", "no-store"]. See all values - https://docs.spanway.ai/docs/proxy/caching#turn-on--off-caching-per-request
  • blocked: Stored for compatibility, but the gateway does not act on it for users. Block the user's keys instead.
  • guardrails: Stored for compatibility, but the gateway does not act on it for users.
  • policies: List of policy names to apply to the user. Policies define guardrails, conditions, and inheritance rules.
  • permissions: Stored for compatibility, but the gateway does not act on it for users.
  • metadata: Metadata for user, store information for user. Example metadata = {"team": "core-infra", "app": "app2", "email": "user@example.com" }
  • max_parallel_requests: Rate limit a user based on the number of parallel requests. Raises 429 error, if user's parallel requests > x.
  • model_max_budget: Model-specific max budget for user. Docs
  • budget_fallbacks: Per-model fallback chain tried in order when that model's own model_max_budget is exceeded, e.g. {"gpt-4o": ["gpt-4o-mini"]}.
  • model_rpm_limit: Model-specific rpm limit for user. Docs
  • mcp_rpm_limit: Per-MCP-server rpm limit, keyed by MCP server name {"jira": 100, "slack": 200}. Enforced for keys and teams only; values set on a user are stored but not enforced per user.
  • tag_rpm_limit: Per-request-tag rpm limit, keyed by request tag {"cell-1": 1000, "cell-2": 500}. Enforced for keys only; values set on a user are stored but not enforced per user.
  • model_tpm_limit: Model-specific tpm limit for user. Docs
  • spend: Amount spent by user. Default is 0. Will be updated by proxy whenever user is used. You can set duration as seconds ("30s"), minutes ("30m"), hours ("30h"), days ("30d"), months ("1mo").
  • agent_id: The agent id associated with the user.
  • team_id: [DEPRECATED PARAM] The team id of the user. Default is None.
  • duration: Duration for the key auto-created on /user/new. Default is None.
  • key_alias: Alias for the key auto-created on /user/new. Default is None.
  • sso_user_id: The id of the user in the SSO provider.
  • object_permission: internal user-specific object permission. Example - {"vector_stores": ["vector_store_1"], "mcp_servers": ["jira"], "mcp_tool_permissions": {"jira": ["list_issues"]}}. The MCP grants act as a ceiling on every key this user holds. IF null or {} then no object permission.
  • prompts: List of allowed prompts for the user. If specified, the user will only be able to use these specific prompts.
  • organizations: List of organization id's the user is a member of
  • budget_limits: List of concurrent budget windows for the user. Each window specifies a budget_limit, time_period, and optional budget_duration. Example - [{"budget_limit": 10.0, "time_period": "1d"}, {"budget_limit": 50.0, "time_period": "7d"}].
  • password: Not supported; any value is rejected with a 422. Users set their own password through an invitation link (POST /invitation/new). What you get back:
  • key: The generated API key for the user
  • expires: When the key expires.
  • user_id: Unique user id, used for tracking spend across multiple keys for the same user.
  • max_budget: Max budget for the user, or null for no limit.

Usage Example

curl -X POST "http://localhost:4000/user/new" -H "Content-Type: application/json" -H "Authorization: Bearer $SPANWAY_MASTER_KEY" -d '{
"user_email": "dev@example.com",
"user_role": "internal_user",
"max_budget": 25,
"budget_duration": "30d"
}'

Request body (application/json, schema NewUserRequest):

FieldTypeRequiredDescription
key_aliasstring or nullNoKey Alias
durationstring or nullNoDuration
modelsarray of any or nullNoModels
spendnumber or nullNoSpend
max_budgetnumber or nullNoMax Budget
user_idstring or nullNoUser Id
team_idstring or nullNoTeam Id
agent_idstring or nullNoAgent Id
max_parallel_requestsinteger or nullNoMost requests that may run at the same time. One more gets a 429. Empty means no cap.
metadataobject or nullNoMetadata
tpm_limitinteger or nullNoMost tokens per minute. Going over gets a 429. Empty means no cap.
rpm_limitinteger or nullNoMost requests per minute. Going over gets a 429. Empty means no cap.
budget_durationstring or nullNoBudget Duration
budget_limitsarray of BudgetLimitEntry or nullNoBudget Limits
allowed_cache_controlsarray of any or nullNoAllowed Cache Controls
configobject or nullNoConfig
permissionsobject or nullNoStored for compatibility, but the gateway does not act on it for users.
model_max_budgetobject or nullNoModel Max Budget
budget_fallbacksobject or nullNoBudget Fallbacks
model_rpm_limitobject or nullNoRequests per minute for each model, as model name to a whole number
model_tpm_limitobject or nullNoTokens per minute for each model, as model name to a whole number
mcp_rpm_limitobject or nullNoMcp Rpm Limit
tag_rpm_limitobject or nullNoTag Rpm Limit
guardrailsarray of string or nullNoStored for compatibility, but the gateway does not act on it for users.
policiesarray of string or nullNoPolicies
promptsarray of string or nullNoPrompts
blockedboolean or nullNoStored for compatibility, but the gateway does not act on it for users.
aliasesobject or nullNoAliases
object_permissionSpanway_ObjectPermissionBase or nullNo
user_emailstring or nullNoUser Email
user_aliasstring or nullNoUser Alias
user_roleenum: "proxy_admin", "proxy_admin_viewer", "internal_user", "internal_user_viewer" or nullNoUser Role
teamsarray of string or array of NewUserRequestTeam or nullNoTeams
auto_create_keybooleanNoAuto Create Key
send_invite_emailboolean or nullNoSend Invite Email
sso_user_idstring or nullNoSso User Id
organizationsarray of string or nullNoOrganizations
passwordstring or nullNoPassword

Example request:

curl -X POST "http://localhost:4000/user/new" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"user_email": "dev@example.com",
"user_role": "internal_user",
"max_budget": 25,
"budget_duration": "30d",
"models": [
"claude-sonnet-5-5"
]
}'

Responses:

StatusDescriptionBody
200Successful Responseapplication/json NewUserResponse
400A field breaks a rule, or the gateway has no databaseapplication/json ProxyError
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The license allows no more users, or only proxy admins may create administrative usersapplication/json ProxyError
409Another user already has that user_id or emailapplication/json ProxyError
422Validation Errorapplication/json HTTPValidationError
500The database or another step failed unexpectedly. The gateway log has the causeapplication/json ProxyError

Response fields (200):

FieldTypeRequiredDescription
key_aliasstring or nullNoKey Alias
durationstring or nullNoDuration
modelsarray of any or nullNoModels
spendnumber or nullNoSpend
max_budgetnumber or nullNoMax Budget
user_idstring or nullNoUser Id
team_idstring or nullNoTeam Id
agent_idstring or nullNoAgent Id
max_parallel_requestsinteger or nullNoMost requests that may run at the same time. One more gets a 429. Empty means no cap.
metadataobject or nullNoMetadata
tpm_limitinteger or nullNoMost tokens per minute. Going over gets a 429. Empty means no cap.
rpm_limitinteger or nullNoMost requests per minute. Going over gets a 429. Empty means no cap.
budget_durationstring or nullNoBudget Duration
budget_limitsarray of BudgetLimitEntry or nullNoBudget Limits
allowed_cache_controlsarray of any or nullNoAllowed Cache Controls
configobject or nullNoConfig
permissionsobject or nullNoPermissions
model_max_budgetobject or nullNoModel Max Budget
budget_fallbacksobject or nullNoBudget Fallbacks
model_rpm_limitobject or nullNoRequests per minute for each model, as model name to a whole number
model_tpm_limitobject or nullNoTokens per minute for each model, as model name to a whole number
mcp_rpm_limitobject or nullNoMcp Rpm Limit
tag_rpm_limitobject or nullNoTag Rpm Limit
guardrailsarray of string or nullNoGuardrails
policiesarray of string or nullNoPolicies
promptsarray of string or nullNoPrompts
blockedboolean or nullNoBlocked
aliasesobject or nullNoAliases
object_permissionSpanway_ObjectPermissionBase or nullNo
keystringYesKey
tpd_limitinteger or nullNoTpd Limit
default_estimated_output_tokensinteger or nullNoDefault Estimated Output Tokens
default_estimated_output_tokens_per_modelobject or nullNoDefault Estimated Output Tokens Per Model
budget_idstring or nullNoBudget Id
end_user_budget_idstring or nullNoEnd User Budget Id
tagsarray of string or nullNoTags
disable_global_guardrailsboolean or nullNoDisable Global Guardrails
enable_prompt_cachingboolean or nullNoEnable Prompt Caching
provider_preferencesobject or nullNoProvider Preferences
data_policyobject or nullNoData Policy
throttle_on_budget_exceededboolean or nullNoThrottle On Budget Exceeded
enforced_paramsarray of string or nullNoEnforced Params
allowed_routesarray of any or nullNoAllowed Routes
allowed_passthrough_routesarray of any or nullNoAllowed Passthrough Routes
denied_passthrough_routesarray of string or nullNoDenied Passthrough Routes
allowed_ipsarray of string or nullNoAllowed Ips
allowed_vector_store_indexesarray of AllowedVectorStoreIndexItem or nullNoAllowed Vector Store Indexes
rpm_limit_typeenum: "guaranteed_throughput", "best_effort_throughput", "dynamic" or nullNoguaranteed refuses limits above the team's, dynamic enforces only on model errors
tpm_limit_typeenum: "guaranteed_throughput", "best_effort_throughput", "dynamic" or nullNoguaranteed refuses limits above the team's, dynamic enforces only on model errors
router_settingsUpdateRouterConfig or nullNo
access_group_idsarray of string or nullNoAccess Group Ids
key_namestring or nullNoKey Name
key_typestring or nullNoKey Type
expiresstring or nullNoExpires
token_idstring or nullNoToken Id
organization_idstring or nullNoOrganization Id
project_idstring or nullNoProject Id
spanway_budget_tableany or nullNoSpanway Budget Table
tokenstring or nullNoToken
created_bystring or nullNoCreated By
updated_bystring or nullNoUpdated By
created_atstring or nullNoCreated At
updated_atstring or nullNoUpdated At
user_emailstring or nullNoUser Email
user_roleenum: "proxy_admin", "proxy_admin_viewer", "internal_user", "internal_user_viewer" or nullNoUser Role
teamsarray of any or nullNoTeams
user_aliasstring or nullNoUser Alias

GET /user/info​

Get a user with their keys and teams

Shows one internal user with their settings, spend, keys and teams. Leave user_id out to read your own user; admins may read anyone, and proxy admins who leave it out get every user. Other keys may only read their own user. Use /user/list to page through users. Nothing changes.

Example request

curl -X GET 'http://localhost:4000/user/info?user_id=user%40example.com' --header "Authorization: Bearer $SPANWAY_MASTER_KEY"

Parameters:

NameInTypeRequiredDescription
user_idquerystring or nullNoUser ID in the request parameters

Example request:

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

Responses:

StatusDescriptionBody
200Successful Responseapplication/json UserInfoResponse
401No valid key or Admin UI session was presentedapplication/json ErrorDetail
403The key's role, grants or license do not allow this actionapplication/json ErrorDetail
404No object with that id is visible to the callerapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError

Response fields (200):

FieldTypeRequiredDescription
user_idstring or nullYesUser Id
user_infoobject or BaseModel or nullYesUser Info
keysarray of anyYesKeys
teamsarray of anyYesTeams

GET /v2/user/info​

Get a user's profile and limits

Shows one user's profile, spend and limits without their keys or team objects, which makes it fast enough for pages that show many users. Admins may read anyone and other keys only their own user. Nothing changes.

Lightweight endpoint to get user info. Returns only the user object, without keys or team objects.

This is the v2 replacement for /user/info, designed to avoid the "god endpoint" problem where the old endpoint loaded all keys and teams into memory.

Note on spend: this is the user's running budget counter, which the budget reset job resets whenever budget_reset_at elapses (see budget_duration): to zero by default, or to the overage above max_budget when budget_rollover is enabled. It is NOT lifetime or per-period historical spend. For historical spend over a date range, use /user/daily/activity or /user/daily/activity/aggregated, which read daily spend records that only ever accumulate and are never reset. The two values are expected to diverge once a budget reset has occurred within the queried period.

Access control:

  • Proxy admins can query any user
  • Team admins can query users within their teams
  • Internal users can only query themselves (omit user_id or pass own)
  • Returns 404 for non-existent users or unauthorized access

Example request:

curl -X GET 'http://localhost:4000/v2/user/info?user_id=user123' \
--header "Authorization: Bearer $SPANWAY_MASTER_KEY"

Parameters:

NameInTypeRequiredDescription
user_idquerystring or nullNoUser ID in the request parameters

Example request:

curl -X GET "http://localhost:4000/v2/user/info" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200Successful Responseapplication/json UserInfoV2Response
401No valid key or Admin UI session was presentedapplication/json ErrorDetail
403The key's role, grants or license do not allow this actionapplication/json ErrorDetail
404No object with that id is visible to the callerapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError

Response fields (200):

FieldTypeRequiredDescription
user_idstringYesUser Id
user_emailstring or nullNoUser Email
user_aliasstring or nullNoUser Alias
user_rolestring or nullNoUser Role
custom_role_idstring or nullNoCustom Role Id
spendnumberNoSpend
max_budgetnumber or nullNoMax Budget
tpm_limitinteger or nullNoTpm Limit
rpm_limitinteger or nullNoRpm Limit
max_parallel_requestsinteger or nullNoMax Parallel Requests
modelsarray of stringNoModels
policiesarray of stringNoPolicies
budget_durationstring or nullNoBudget Duration
budget_reset_atstring or nullNoBudget Reset At
metadataobject or nullNoMetadata
created_atstring or nullNoCreated At
updated_atstring or nullNoUpdated At
sso_user_idstring or nullNoSso User Id
teamsarray of stringNoTeams
object_permissionSpanway_ObjectPermissionTable or nullNo
model_max_budgetobject or nullNoModel Max Budget
model_max_budget_usageobject or nullNoModel Max Budget Usage

POST /user/update​

Update an internal user

Change an internal user's role, budget, models or other settings. Fields you leave out keep their stored value.

curl --location 'http://0.0.0.0:4000/user/update' --header "Authorization: Bearer $SPANWAY_MASTER_KEY" --header 'Content-Type: application/json' --data '{
"user_id": "test-spanway-user-4",
"user_role": "proxy_admin_viewer"
}'

What to send: - user_id: Specify a user id. If not set, a unique id will be generated. - user_email: Specify a user email. - password: Set the user's password (admin only). Must satisfy the configured password policy. The user is required to change it at their next login. Users change their own password with POST /user/password/change. - user_alias: A descriptive name for you to know who this user id refers to. - teams: specify a list of team id's a user belongs to. - send_invite_email: Specify if an invite email should be sent. - user_role: One of "proxy_admin", "proxy_admin_viewer", "internal_user" or "internal_user_viewer". See https://docs.spanway.ai/docs/proxy/users#roles - max_budget: Specify max budget for a given user. - budget_duration: Budget is reset at the end of specified duration. If not set, budget is never reset. You can set duration as seconds ("30s"), minutes ("30m"), hours ("30h"), days ("30d"), months ("1mo"). - models: Model_name's a user is allowed to call. (if empty, key is allowed to call all models) - tpm_limit: Specify tpm limit for a given user (Tokens per minute) - rpm_limit: Specify rpm limit for a given user (Requests per minute) - auto_create_key: Default=True. Flag used for returning a key as part of the /user/new response - aliases: Model aliases for the user - Docs - config: [DEPRECATED PARAM] User-specific config. - allowed_cache_controls: List of allowed cache control values. Example - ["no-cache", "no-store"]. See all values - https://docs.spanway.ai/docs/proxy/caching#turn-on--off-caching-per-request - blocked: Stored for compatibility, but the gateway does not act on it for users. Block the user's keys instead. - guardrails: Stored for compatibility, but the gateway does not act on it for users. - policies: List of policy names to apply to the user. Policies define guardrails, conditions, and inheritance rules. - permissions: Stored for compatibility, but the gateway does not act on it for users. - metadata: Metadata for user, store information for user. Example metadata = {"team": "core-infra", "app": "app2", "email": "user@example.com" } - max_parallel_requests: Rate limit a user based on the number of parallel requests. Raises 429 error, if user's parallel requests > x. - model_max_budget: Model-specific max budget for user. Docs - budget_fallbacks: Per-model fallback chain tried in order when that model's own model_max_budget is exceeded, e.g. {"gpt-4o": ["gpt-4o-mini"]}. - model_rpm_limit: Model-specific rpm limit for user. Docs - mcp_rpm_limit: Per-MCP-server rpm limit, keyed by MCP server name {"jira": 100, "slack": 200}. Enforced for keys and teams only; values set on a user are stored but not enforced per user. - tag_rpm_limit: Per-request-tag rpm limit, keyed by request tag {"cell-1": 1000, "cell-2": 500}. Enforced for keys only; values set on a user are stored but not enforced per user. - model_tpm_limit: Model-specific tpm limit for user. Docs - spend: Amount spent by user. Default is 0. Will be updated by proxy whenever user is used. You can set duration as seconds ("30s"), minutes ("30m"), hours ("30h"), days ("30d"), months ("1mo"). - agent_id: The agent id associated with the user. - team_id: [DEPRECATED PARAM] The team id of the user. Default is None. - object_permission: internal user-specific object permission. Example - {"vector_stores": ["vector_store_1"], "mcp_servers": ["jira"], "mcp_tool_permissions": {"jira": ["list_issues"]}}. The MCP grants act as a ceiling on every key this user holds. IF null or {} then no object permission. - prompts: List of allowed prompts for the user. If specified, the user will only be able to use these specific prompts. - budget_limits: List of concurrent budget windows for the user. Each window specifies a budget_limit, time_period, and optional budget_duration. Example - [{"budget_limit": 10.0, "time_period": "1d"}, {"budget_limit": 50.0, "time_period": "7d"}].

Request body (application/json, schema UpdateUserRequest):

FieldTypeRequiredDescription
key_aliasstring or nullNoKey Alias
durationstring or nullNoDuration
modelsarray of any or nullNoModels
spendnumber or nullNoSpend
max_budgetnumber or nullNoMax Budget
user_idstring or nullNoUser Id
team_idstring or nullNoTeam Id
agent_idstring or nullNoAgent Id
max_parallel_requestsinteger or nullNoMost requests that may run at the same time. One more gets a 429. Empty means no cap.
metadataobject or nullNoMetadata
tpm_limitinteger or nullNoMost tokens per minute. Going over gets a 429. Empty means no cap.
rpm_limitinteger or nullNoMost requests per minute. Going over gets a 429. Empty means no cap.
budget_durationstring or nullNoBudget Duration
budget_limitsarray of BudgetLimitEntry or nullNoBudget Limits
allowed_cache_controlsarray of any or nullNoAllowed Cache Controls
configobject or nullNoConfig
permissionsobject or nullNoStored for compatibility, but the gateway does not act on it for users.
model_max_budgetobject or nullNoModel Max Budget
budget_fallbacksobject or nullNoBudget Fallbacks
model_rpm_limitobject or nullNoRequests per minute for each model, as model name to a whole number
model_tpm_limitobject or nullNoTokens per minute for each model, as model name to a whole number
mcp_rpm_limitobject or nullNoMcp Rpm Limit
tag_rpm_limitobject or nullNoTag Rpm Limit
guardrailsarray of string or nullNoStored for compatibility, but the gateway does not act on it for users.
policiesarray of string or nullNoPolicies
promptsarray of string or nullNoPrompts
blockedboolean or nullNoStored for compatibility, but the gateway does not act on it for users.
aliasesobject or nullNoAliases
object_permissionSpanway_ObjectPermissionBase or nullNo
passwordstring or nullNoPassword
user_aliasstring or nullNoUser Alias
user_roleenum: "proxy_admin", "proxy_admin_viewer", "internal_user", "internal_user_viewer" or nullNoUser Role
user_emailstring or nullNoUser Email

Example request:

curl -X POST "http://localhost:4000/user/update" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"user_id": "user-123",
"user_role": "internal_user",
"max_budget": 50
}'

Responses:

StatusDescriptionBody
200The user after the updateapplication/json UserUpdateResponse
400The request is malformed or breaks a rule named in the detailapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ErrorDetail
403The key's role, grants or license do not allow this actionapplication/json ErrorDetail
404No object with that id is visible to the callerapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError

Response fields (200):

FieldTypeRequiredDescription
user_idstringYesThe id of the updated user
dataSpanway_UserTableYesThe user after the update, without the password

POST /user/bulk_update​

Update several users at once

Changes several users in one request, for example raising everyone's budget, either one entry per user or the same change for every user. Proxy admins and organization admins may call it, for the users they may change. Each user is updated on its own, so one failure does not stop the others, and every change is written to the audit log.

Bulk update multiple users at once.

This endpoint allows updating multiple users in a single request. Each user update is processed independently - if some updates fail, others will still succeed.

What to send:

  • users: List of specific user update requests
  • all_users: Set to true to update all users in the system
  • user_updates: Updates to apply when all_users=True

What you get back:

  • results: of individual update results
  • total_requested: Total number of users requested for update
  • successful_updates: Number of successful updates
  • failed_updates: Number of failed updates

Example request for specific users:

curl --location 'http://0.0.0.0:4000/user/bulk_update' --header "Authorization: Bearer $SPANWAY_MASTER_KEY" --header 'Content-Type: application/json' --data '{
"users": [
{
"user_id": "user1",
"user_role": "internal_user",
"max_budget": 100.0
},
{
"user_email": "user2@example.com",
"user_role": "internal_user_viewer",
"max_budget": 50.0
}
]
}'

Example request for all users:

curl --location 'http://0.0.0.0:4000/user/bulk_update' --header "Authorization: Bearer $SPANWAY_MASTER_KEY" --header 'Content-Type: application/json' --data '{
"all_users": true,
"user_updates": {
"user_role": "internal_user",
"max_budget": 50.0
}
}'

Parameters:

NameInTypeRequiredDescription
spanway-changed-byheaderstring or nullNoThe spanway-changed-by header enables tracking of actions performed by authorized users on behalf of other users, providing an audit trail for accountability

Request body (application/json, schema BulkUpdateUserRequest):

FieldTypeRequiredDescription
usersarray of UpdateUserRequest or nullNoUsers
all_usersboolean or nullNoAll Users
user_updatesUpdateUserRequestNoUserIDorEmail or nullNo

Example request:

curl -X POST "http://localhost:4000/user/bulk_update" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"users": [
{
"user_id": "user-123",
"max_budget": 50
},
{
"user_id": "user-456",
"max_budget": 50
}
]
}'

Responses:

StatusDescriptionBody
200Successful Responseapplication/json BulkUpdateUserResponse
400The request is malformed or breaks a rule named in the detailapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ErrorDetail
403The key's role, grants or license do not allow this actionapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
resultsarray of UserUpdateResultYesResults
total_requestedintegerYesTotal Requested
successful_updatesintegerYesSuccessful Updates
failed_updatesintegerYesFailed Updates

GET /user/list​

List internal users

Pages through internal users with their spend, limits and key counts, filtered by role, team, organization or a search term. Proxy admins and admin viewers see every user, and organization admins the users of their organizations. Nothing changes.

Get a paginated list of users with filtering and sorting options.

What to send: role Filter users by role. Can be one of: - proxy_admin - proxy_admin_viewer - internal_user - internal_user_viewer user_ids Get list of users by user_ids. Comma separated list of user_ids. sso_ids Get list of users by sso_ids. Comma separated list of sso_ids. user_email Filter users by partial email match search Combined search: matches users whose user_id or user_email contains the value (case-insensitive) team Filter users by team id. Will match if user has this team in their teams array. page The page number to return page_size The number of items per page sort_by Column to sort by (e.g. 'user_id', 'user_email', 'created_at', 'spend') sort_order Sort order ('asc' or 'desc')

Parameters:

NameInTypeRequiredDescription
rolequerystring or nullNoFilter users by role
user_idsquerystring or nullNoGet list of users by user_ids
sso_user_idsquerystring or nullNoGet list of users by sso_user_id
user_emailquerystring or nullNoFilter users by partial email match
searchquerystring or nullNoCombined search: matches users whose 'user_id' or 'user_email' contains the value (case-insensitive).
teamquerystring or nullNoFilter users by team id
pagequeryintegerNoPage number
page_sizequeryintegerNoNumber of items per page
sort_byquerystring or nullNoColumn to sort by (e.g. 'user_id', 'user_email', 'created_at', 'spend')
sort_orderquerystringNoSort order ('asc' or 'desc')
organization_idsquerystring or nullNoFilter users by organization membership. Comma-separated list of org IDs.

Example request:

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

Responses:

StatusDescriptionBody
200Successful Responseapplication/json UserListResponse
400sort_by or sort_order is not one the list acceptsapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ErrorDetail
403The key's role, grants or license do not allow this actionapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
usersarray of Spanway_UserTableWithKeyCountYesUsers
totalintegerYesTotal
pageintegerYesPage
page_sizeintegerYesPage Size
total_pagesintegerYesTotal Pages

POST /user/delete​

Delete internal users

Deletes internal users together with their keys, invitation links and organization and team memberships, so they can no longer sign in or call models. Proxy admins may delete any user; organization admins only users of their organizations. Each deletion is written to the audit log when audit logging is on. Returns how many users were deleted.

curl --location 'http://0.0.0.0:4000/user/delete'
--header "Authorization: Bearer $SPANWAY_MASTER_KEY"
--header 'Content-Type: application/json'
--data-raw '{
"user_ids": ["45e3e396-ee08-4a61-a88e-16b3ce7e0849"]
}'

What to send:

  • user_ids: The list of user id's to be deleted.

Parameters:

NameInTypeRequiredDescription
spanway-changed-byheaderstring or nullNoThe spanway-changed-by header enables tracking of actions performed by authorized users on behalf of other users, providing an audit trail for accountability

Request body (application/json, schema DeleteUserRequest):

FieldTypeRequiredDescription
user_idsarray of stringYesUser Ids

Example request:

curl -X POST "http://localhost:4000/user/delete" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"user_ids": [
"user-123"
]
}'

Responses:

StatusDescriptionBody
200How many users were deletedapplication/json integer
400No user id was sentapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ErrorDetail
403The key's role, grants or license do not allow this actionapplication/json ErrorDetail
404No object with that id is visible to the callerapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The database is not connectedapplication/json ErrorDetail

POST /user/password/change​

Change your own password

Change the calling user's own password.

Use it when you sign in to the Admin UI with a username and password and want a new password. Only callable with the dashboard session issued by a username/password login; SSO sessions and virtual keys are rejected with 403. Requires the current password. The new password must differ from the current one and satisfy the configured password policy (general_settings.password_policy_*: minimum length, character classes, and, when enabled, breached-password screening via haveibeenpwned.com). A successful change lifts any pending forced password reset (password_reset_required) on the account, signs out every other dashboard session of the user, and writes an audit log entry that names the changed field but never the password.

What to send:

  • current_password: The user's current password.
  • new_password: The password to change to.

Request body (application/json, schema ChangePasswordRequest):

FieldTypeRequiredDescription
current_passwordstringYesCurrent Password
new_passwordstringYesNew Password

Example request:

curl -X POST "http://localhost:4000/user/password/change" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"current_password": "old-passphrase-2025",
"new_password": "longer-new-passphrase-2026"
}'

Responses:

StatusDescriptionBody
200The password was changed and every other dashboard session was signed outapplication/json ChangePasswordResponse
400Current password is incorrect.application/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
403Passwords can only be changed from a dashboard session created by logging in with a password.application/json ErrorDetail
422A field failed validation and the detail names itapplication/json ErrorDetail
500DB not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
user_idstringYesUser Id
messagestringYesMessage

POST /management/v1/users/bulk​

Create several users at once

Create up to 500 internal users in one request, optionally adding each one to teams, for example when onboarding a whole department. Proxy admins may create any user; organization and team admins only users they may grant the requested roles and teams to. Each created user is written to the audit log.

Every entry in users takes the same fields as /user/new, with two differences: auto_create_key defaults to false (opt in per user to also get a virtual key back) and send_invite_email is not supported. Unknown fields are rejected with 422. Rows are validated together (duplicate ids or emails, unknown teams, roles the caller may not grant), inserted in one statement, and each referenced team is written once for all of its new members.

Rows fail independently: a bad row is reported in data with success: false and an error, and the other rows still get created. A user that was created but could not be added to one of its teams is reported with success: true, teams listing where they did land, and error naming the failed team. The whole request is refused with a 403 problem document only if creating the valid rows would exceed the license seat limit.

Example curl:

curl -X POST "http://localhost:4000/management/v1/users/bulk" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $SPANWAY_MASTER_KEY" \
-d '{
"users": [
{"user_email": "a@example.com", "user_role": "internal_user", "teams": ["team-1"]},
{"user_email": "b@example.com", "user_role": "internal_user", "auto_create_key": true}
]
}'

Returns data (one entry per input row, in order, with user_id, user_email, success, teams, key, error) and meta with total_requested, created and failed.

Request body (application/json, schema BulkNewUserRequest):

FieldTypeRequiredDescription
usersarray of BulkNewUserItemYesUsers

Example request:

curl -X POST "http://localhost:4000/management/v1/users/bulk" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"users": [
{
"user_email": "ana@example.com",
"user_role": "internal_user"
},
{
"user_email": "ben@example.com",
"user_role": "internal_user"
}
]
}'

Responses:

StatusDescriptionBody
200One result per input row, in order, and the totalsapplication/json BulkNewUserResponse
401No valid key or Admin UI session was presentedapplication/json ProxyError
403Creating the valid rows would exceed the license seat limit, served as application/problem+jsonapplication/json ProblemDetail
422Validation Errorapplication/json HTTPValidationError
500The database rejected the write, served as application/problem+jsonapplication/json ProblemDetail
503The gateway has no database connected, served as application/problem+jsonapplication/json ProblemDetail

Response fields (200):

FieldTypeRequiredDescription
dataarray of UserCreateResultYesData
metaBulkNewUserMetaYes

POST /management/v1/users/bulk_delete​

Delete several users at once

Delete up to 500 users in one call, taking each out of every team it belongs to, for example when people leave the company. Each deletion is written to the audit log. Same authorization as /user/delete: proxy admins may delete anyone, org admins only users inside organizations they administer. Unknown body fields are a 422.

data holds one result per requested user_id, in request order. A row is success: false with an error when the id is unknown, repeated in the request, or outside the caller's scope. Rows that pass those checks are deleted together, in one transaction, so either all of them go or none does.

Example curl:

curl --location 'http://0.0.0.0:4000/management/v1/users/bulk_delete' --header "Authorization: Bearer $SPANWAY_MASTER_KEY" --header 'Content-Type: application/json' --data '{"user_ids": ["user-1", "user-2"]}'

Parameters:

NameInTypeRequiredDescription
spanway-changed-byheaderstring or nullNoWho the caller is acting for; recorded on the audit log entries this call writes.

Request body (application/json, schema BulkDeleteUserRequest):

FieldTypeRequiredDescription
user_idsarray of stringYesUser Ids

Example request:

curl -X POST "http://localhost:4000/management/v1/users/bulk_delete" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"user_ids": [
"user-123",
"user-456"
]
}'

Responses:

StatusDescriptionBody
200One result per requested user id, in request orderapplication/json BulkDeleteUsersResponse
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller may not delete users, served as application/problem+jsonapplication/json ProblemDetail
422Validation Errorapplication/json HTTPValidationError
500The database rejected the delete, served as application/problem+jsonapplication/json ProblemDetail
503The gateway has no database connected, served as application/problem+jsonapplication/json ProblemDetail

Response fields (200):

FieldTypeRequiredDescription
dataarray of UserDeleteResultYesData

GET /user/available_users​

Seats used and remaining under the license

How many internal users and teams the license allows, how many exist, and how many more can be created. A limit that the license does not set is null. Needs an enterprise license.

Example request:

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

Responses:

StatusDescriptionBody
200Successful Responseapplication/json AvailableUsersResponse
401No valid key or Admin UI session was presentedapplication/json ErrorDetail
403The key's role, grants or license do not allow this actionapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
total_usersinteger or nullYesTotal Users
total_users_usedintegerYesTotal Users Used
total_users_remaininginteger or nullYesTotal Users Remaining
total_teamsinteger or nullYesTotal Teams
total_teams_usedintegerYesTotal Teams Used
total_teams_remaininginteger or nullYesTotal Teams Remaining