Team management API
This page documents the 36 gateway endpoints tagged team 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.
| Method | Path | Summary |
|---|---|---|
| GET | /team/daily/activity/aggregated | Daily activity per team |
| GET | /team/daily/activity/aggregated/keys | Keys ranked by spend for a team |
| GET | /team/daily/activity/aggregated/search | Search the keys with activity for a team |
| GET | /team/daily/activity/aggregated/model_top_keys | Top keys for one model in a team |
| GET | /team/daily/activity/export | Download team daily activity as CSV or JSON |
| POST | /team/new | Create a team |
| POST | /team/update | Update a team |
| PATCH | /team/{team_id} | Update a team by id |
| POST | /team/member_add | Add members to a team |
| POST | /team/member_delete | Remove a member from a team |
| POST | /team/member_update | Change a member's role or budget in a team |
| POST | /team/{team_id}/member/{user_id}/reset_spend | Reset a member's spend in a team |
| POST | /team/{team_id}/member/{user_id}/reset_budget | Reset a member's budget to the team default |
| POST | /team/bulk_member_add | Add many members to a team at once |
| POST | /team/delete | Delete teams |
| GET | /team/info | Get a team with its keys and members |
| GET | /team/{team_id}/members/me | Your own membership in a team |
| POST | /team/block | Block a team |
| POST | /team/unblock | Unblock a team |
| GET | /team/metadata_schema | Fields allowed in team metadata |
| GET | /team/available | Teams the caller may join |
| GET | /v2/team/list | List teams with paging and filters |
| GET | /team/list | List teams |
| POST | /team/model/add | Add models to a team |
| POST | /team/model/delete | Remove models from a team |
| GET | /team/permissions_list | What members of a team may do with keys |
| POST | /team/permissions_update | Set what members of a team may do with keys |
| POST | /team/permissions_bulk_update | Add member permissions to many teams |
| GET | /team/daily/activity | Daily spend and usage of a team |
| GET | /team/spend/by_user | Spend per member of a team |
| POST | /management/v1/teams/{team_id}/members/bulk_delete | Remove many members from a team at once |
| POST | /management/v1/teams/{team_id}/members/bulk_update | Change many members' budgets in a team at once |
| GET | /team/{team_id}/callback | Logging callbacks of a team |
| POST | /team/{team_id}/callback | Add a logging callback to a team |
| DELETE | /team/{team_id}/callback/{callback_name} | Remove a logging callback from a team |
| POST | /team/{team_id}/disable_logging | Turn off logging callbacks for a team |
Endpoints
GET /team/daily/activity/aggregated
Daily activity per team
Spend, tokens and requests per day for the teams you can see, with a breakdown per team, in one answer with nothing to page. Filter with team_ids or exclude_team_ids (comma separated), start_date and end_date (YYYY-MM-DD), model and api_key. timezone is the offset in minutes from UTC, the way a browser reports it with Date.getTimezoneOffset().
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
api_key_limit | query | integer | No | How many top keys to return |
team_ids | query | string or null | No | |
start_date | query | string or null | No | |
end_date | query | string or null | No | |
model | query | string or null | No | |
api_key | query | string or null | No | |
exclude_team_ids | query | string or null | No | |
timezone | query | integer or null | No |
Example request:
curl -X GET "http://localhost:4000/team/daily/activity/aggregated" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json SpendAnalyticsPaginatedResponse |
| 400 | The date range is invalid | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller may not read this scope | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The analytics query failed, the gateway log has the cause | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
results | array of DailySpendData | Yes | Results |
metadata | DailySpendMetadata | No |
GET /team/daily/activity/aggregated/keys
Keys ranked by spend for a team
One page of the virtual keys that spent the most inside the team scope and date range, with the spend, tokens and request counts of each. offset and limit page through the list and total_api_keys says how many keys there are in all. Docs (https://docs.spanway.ai/docs/proxy/spend_logs_export)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
offset | query | integer | No | How many rows to skip, for paging |
limit | query | integer | No | How many rows to return |
team_ids | query | string or null | No | |
start_date | query | string or null | No | |
end_date | query | string or null | No | |
model | query | string or null | No | |
api_key | query | string or null | No | |
exclude_team_ids | query | string or null | No | |
timezone | query | integer or null | No |
Example request:
curl -X GET "http://localhost:4000/team/daily/activity/aggregated/keys" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json DailyActivityKeyPageResponse |
| 400 | The date range is invalid | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller may not read this scope | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The analytics query failed, the gateway log has the cause | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
api_keys | array of KeySpendActivityRow | Yes | Api Keys |
total_api_keys | integer | Yes | Total Api Keys |
offset | integer | Yes | Offset |
limit | integer | Yes | Limit |
GET /team/daily/activity/aggregated/search
Search the keys with activity for a team
Find virtual keys with activity inside the team scope and date range whose alias, hash, user id or email matches the search text, each with its spend, tokens and request counts. This is the key search box of the Usage page. Docs (https://docs.spanway.ai/docs/proxy/spend_logs_export)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
search | query | string | Yes | Text to find in key aliases and key hashes |
limit | query | integer | No | How many rows to return |
team_ids | query | string or null | No | |
start_date | query | string or null | No | |
end_date | query | string or null | No | |
model | query | string or null | No | |
api_key | query | string or null | No | |
exclude_team_ids | query | string or null | No | |
timezone | query | integer or null | No |
Example request:
curl -X GET "http://localhost:4000/team/daily/activity/aggregated/search?search=string" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json DailyActivityKeySearchResponse |
| 400 | The date range is invalid | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller may not read this scope | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The analytics query failed, the gateway log has the cause | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
api_keys | array of KeyActivityRow | Yes | Api Keys |
GET /team/daily/activity/aggregated/model_top_keys
Top keys for one model in a team
The virtual keys that spent the most on one model inside the team scope and date range. by_model_group tells whether model was matched as the public model group or as the individual deployment. Docs (https://docs.spanway.ai/docs/proxy/spend_logs_export)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
model_group | query | string | Yes | The model or model group to rank keys for |
by_model_group | query | boolean | No | Match model_group as a model group, not a model |
limit | query | integer | No | How many rows to return |
team_ids | query | string or null | No | |
start_date | query | string or null | No | |
end_date | query | string or null | No | |
model | query | string or null | No | |
api_key | query | string or null | No | |
exclude_team_ids | query | string or null | No | |
timezone | query | integer or null | No |
Example request:
curl -X GET "http://localhost:4000/team/daily/activity/aggregated/model_top_keys?model_group=claude-sonnet-5-5" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json ModelTopKeysResponse |
| 400 | The date range is invalid | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller may not read this scope | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The analytics query failed, the gateway log has the cause | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model |
by_model_group | boolean | Yes | By Model Group |
api_keys | array of KeySpendActivityRow | Yes | Api Keys |
GET /team/daily/activity/export
Download team daily activity as CSV or JSON
Stream one row per day for each team in the range, with requests, tokens and spend. export_type picks the breakdown: daily, daily_with_keys, daily_with_models or daily_with_users. format is csv (the default) or json. The file name carries the entity, the range and the breakdown. This is the Export Data dialog of the Usage page. Docs (https://docs.spanway.ai/docs/proxy/spend_logs_export)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
export_type | query | ExportType | No | The breakdown of each row |
format | query | enum: "csv", "json" | No | csv or json |
team_ids | query | string or null | No | |
start_date | query | string or null | No | |
end_date | query | string or null | No | |
model | query | string or null | No | |
api_key | query | string or null | No | |
exclude_team_ids | query | string or null | No | |
timezone | query | integer or null | No |
Example request:
curl -X GET "http://localhost:4000/team/daily/activity/export" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Streamed daily activity export | text/csv string |
| 400 | Bad Request | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller may not read this scope | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The analytics query failed, the gateway log has the cause | application/json ErrorDetail |
POST /team/new
Create a team
Allow users to create a new team. Apply user permissions to their team.
What to send:
team_alias: User defined team aliasteam_id: The team id of the user. If none passed, we'll generate it.members_with_roles: A list of users and their roles in the team. Get user_id when making a new user via/user/new.team_member_permissions: A list of routes that non-admin team members can access. example: ["/key/generate", "/key/update", "/key/delete"]metadata: Metadata for team, store information for team. Example metadata = {"extra_info": "some info"}model_rpm_limit: The RPM (Requests Per Minute) limit for this team - applied across all keys for this team.model_tpm_limit: The TPM (Tokens Per Minute) limit for this team - applied across all keys for this team.default_estimated_output_tokens: Expected output tokens reserved for TPM limiting when a request omits max_tokens, for keys on this team that do not set their own. Positive integer.default_estimated_output_tokens_per_model: Per-model override of the above. Example: {"gpt-4": 4096, "gpt-3.5-turbo": 1024}mcp_rpm_limit: Per-MCP-server RPM limit for this team, keyed by MCP server name (alias if set, else the configured name). Example: {"jira": 100, "slack": 200}. Applied across all keys for this team.tpm_limit: The TPM (Tokens Per Minute) limit for this team - all keys with this team_id will have at max this TPM limitrpm_limit: The RPM (Requests Per Minute) limit for this team - all keys associated with this team_id will have at max this RPM limittpd_limit: The TPD (Tokens Per Day) limit for this team. Batch submissions are charged against it instead of tpm_limit/rpm_limitmax_parallel_requests: Most requests all keys of this team may have in flight at once (429 beyond)rpm_limit_type: The type of RPM limit enforcement. Use "guaranteed_throughput" to raise an error if overallocating RPM, or "best_effort_throughput" for best effort enforcement.tpm_limit_type: The type of TPM limit enforcement. Use "guaranteed_throughput" to raise an error if overallocating TPM, or "best_effort_throughput" for best effort enforcement.max_budget: The maximum budget allocated to the team - all keys for this team_id will have at max this max_budgetsoft_budget: The soft budget threshold for the team. If max_budget is set, soft_budget must be strictly lower than max_budget. Can be set independently if max_budget is not set.budget_duration: The duration of the budget for the team. Doc heremodels: A list of models associated with the team - all keys for this team_id will have at most, these models. If empty, assumes all models are allowed.blocked: Flag indicating if the team is blocked or not - will stop all calls from keys with this team_id.members: Control team members via/team/member/addand/team/member/delete.tags: Tags for tracking spend and/or doing tag-based routing.prompts: List of prompts that the team is allowed to use.organization_id: The organization id of the team. Default is None. Create via/organization/new.model_aliases: Model aliases for the team. Docsmodel_max_budget: Per-model max budget every key on the team inherits unless the key sets its own for that model. Example: {"gpt-4o": {"max_budget": 10, "budget_duration": "1d"}}guardrails: Guardrails for the team. Docspolicies: Policies for the team. Docsdisable_global_guardrails: Whether to disable global guardrails for the team. Proxy admin only.require_trace_id: Reject LLM, MCP and agent requests from this team that carry no trace ID.provider_preferences: Default provider preferences (order, only, ignore, sort, max_price, allow_fallbacks) for this team's chat, responses, messages, completions and embeddings requests. Keys and requests can narrow them but never widen them. Proxy admin only. Stored in metadata.object_permission: team-specific object permission. Example - {"vector_stores": ["vector_store_1", "vector_store_2"], "agents": ["agent_1", "agent_2"], "agent_access_groups": ["dev_group"]}. IF null or {} then no object permission.team_member_budget: The maximum budget allocated to an individual team member.team_member_budget_duration: The duration of the budget for the team member. Doc hereteam_member_model_max_budget: Per-model budgets shared by team members without an override.team_member_rpm_limit: The RPM (Requests Per Minute) limit for individual team members.team_member_tpm_limit: The TPM (Tokens Per Minute) limit for individual team members.team_member_key_duration: The duration for a team member's key. e.g. "1d", "1w", "1mo"allowed_passthrough_routes: List of allowed pass through routes for the team.denied_passthrough_routes: List of pass through routes the team's keys may not call, even if allowed. Applies together with each key'sdenied_passthrough_routes.allowed_vector_store_indexes: List of allowed vector store indexes for the key. Example - [{"index_name": "my-index", "index_permissions": ["write", "read"]}]. If specified, the key will only be able to use these specific vector store indexes. Create index, using/v1/indexesendpoint.secret_manager_settings: Secret manager settings for the team. Docsrouter_settings: team-specific router settings. Example - {"model_group_retry_policy": {"gpt-4": {"RateLimitErrorRetries": 5}}}. IF null or {} then no router settings.access_group_ids: List of access group IDs to associate with the team. Access groups define which models the team can access. Example - ["access_group_1", "access_group_2"].enforced_file_expires_after: Enforced file expiration policy for the team. Keys created under this team will inherit this policy for file uploads. Example - {"anchor": "created_at", "days": 30}.enforced_batch_output_expires_after: Enforced batch output file expiration policy for the team. Keys created under this team will inherit this policy for batch output files. Example - {"anchor": "created_at", "days": 30}.budget_limits: List of concurrent budget windows for the team. 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"}].default_team_member_models: Default models assigned to new team members when they join this team. Must be a subset of the team's models.
What you get back:
team_id: Unique team id, used for tracking spend across multiple keys for the same team.
_deprecated_params:
admins: A list of user_id's for the admin roleusers: A list of user_id's for the user roleallowed_ips: IP addresses or CIDR ranges the team's keys may be used from, at most 256 entries. A request from any other client address is refused. Example - ["10.0.0.5", "10.0.0.0/8", "2001:db8::/32"]data_policy: Data policy every request on the team's keys must satisfy: require_zdr, forbid_training, restrict_code_traffic, scan_content_for_code and allowed_regions. The router drops every deployment that does not meet it. Example - {"require_zdr": true, "allowed_regions": ["eu"]}
Example Request:
curl --location 'http://0.0.0.0:4000/team/new' --header "Authorization: Bearer $SPANWAY_MASTER_KEY" --header 'Content-Type: application/json' --data '{
"team_alias": "my-new-team_2",
"members_with_roles": [{"role": "admin", "user_id": "user-1234"},
{"role": "user", "user_id": "user-2434"}]
}'
curl --location 'http://0.0.0.0:4000/team/new' --header "Authorization: Bearer $SPANWAY_MASTER_KEY" --header 'Content-Type: application/json' --data '{
"team_alias": "QA Prod Bot",
"max_budget": 0.000000001,
"budget_duration": "1d"
}'
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
spanway-changed-by | header | string or null | No | The 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 NewTeamRequest):
| Field | Type | Required | Description |
|---|---|---|---|
team_alias | string or null | No | A readable name for the team |
team_id | string or null | No | Team Id |
organization_id | string or null | No | The organization the team belongs to |
admins | array of string | No | User ids of the team's admins |
members | array of string | No | User ids of the team's members |
members_with_roles | array of Member | No | Every member with their role in the team, admin or user |
team_member_permissions | array of string or null | No | Key actions ordinary members may take on the team's keys |
metadata | object or null | No | Free-form labels for the team, such as a cost center |
tpm_limit | integer or null | No | Most tokens per minute all of the team's keys may use together |
rpm_limit | integer or null | No | Most requests per minute all of the team's keys may send together |
tpd_limit | integer or null | No | Most tokens per day all of the team's keys may use together |
max_budget | number or null | No | Requests fail once the team's spend passes this, in USD |
soft_budget | number or null | No | An alert fires when the team's spend reaches this, in USD |
budget_duration | string or null | No | How often the team's spend resets, for example 30d |
budget_limits | array of BudgetLimitEntry or null | No | Extra budget windows, each with its own limit and reset schedule |
models | array of string | No | Models the team's keys may call, empty for every model |
blocked | boolean | No | True when every request made with the team's keys is refused |
router_settings | UpdateRouterConfig or null | No | Router Settings |
access_group_ids | array of string or null | No | Access groups whose models, MCP servers and agents the team may use |
default_team_member_models | array of string or null | No | Models a new member may use when none are set for them |
model_aliases | object or null | No | Model Aliases |
model_max_budget | object or null | No | Max budget per model for every key on the team, overridable per key (e.g. {'gpt-4o': {'max_budget': 10, 'budget_duration': '1d'}}) |
tags | array of any or null | No | Tags |
guardrails | array of string or null | No | Guardrails |
policies | array of string or null | No | Policies |
prompts | array of string or null | No | Prompts |
object_permission | Spanway_ObjectPermissionBase or null | No | |
allowed_passthrough_routes | array of any or null | No | Allowed Passthrough Routes |
denied_passthrough_routes | array of string or null | No | Denied Passthrough Routes |
allowed_ips | array of string or null | No | Allowed Ips |
disable_global_guardrails | boolean or null | No | Disable Global Guardrails |
require_trace_id | boolean or null | No | Require Trace Id |
provider_preferences | object or null | No | Provider Preferences |
data_policy | object or null | No | Data Policy |
max_parallel_requests | integer or null | No | Most requests the whole team may have in flight at once, beyond it a 429 |
secret_manager_settings | object or null | No | Secret Manager Settings |
model_rpm_limit | object or null | No | Requests per minute for each model, shared by the team's keys |
rpm_limit_type | enum: "guaranteed_throughput", "best_effort_throughput" or null | No | guaranteed_throughput refuses a rpm_limit that would overbook the organization's RPM |
tpm_limit_type | enum: "guaranteed_throughput", "best_effort_throughput" or null | No | guaranteed_throughput refuses a tpm_limit that would overbook the organization's TPM |
model_tpm_limit | object or null | No | Tokens per minute for each model, shared by the team's keys |
default_estimated_output_tokens | integer or null | No | Default Estimated Output Tokens |
default_estimated_output_tokens_per_model | object or null | No | Default Estimated Output Tokens Per Model |
mcp_rpm_limit | object or null | No | Mcp Rpm Limit |
team_member_budget | number or null | No | Team Member Budget |
team_member_rpm_limit | integer or null | No | Team Member Rpm Limit |
team_member_tpm_limit | integer or null | No | Team Member Tpm Limit |
team_member_key_duration | string or null | No | Team Member Key Duration |
team_member_budget_duration | string or null | No | Team Member Budget Duration |
team_member_model_max_budget | object or null | No | Team Member Model Max Budget |
allowed_vector_store_indexes | array of AllowedVectorStoreIndexItem or null | No | Allowed Vector Store Indexes |
enforced_batch_output_expires_after | object or null | No | Enforced Batch Output Expires After |
enforced_file_expires_after | object or null | No | Enforced File Expires After |
Example request:
curl -X POST "http://localhost:4000/team/new" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"team_alias": "data-science",
"max_budget": 500,
"budget_duration": "30d",
"soft_budget": 400,
"tpm_limit": 200000,
"rpm_limit": 600,
"max_parallel_requests": 20,
"models": [
"claude-sonnet-5-5",
"claude-haiku-5-5"
],
"members_with_roles": [
{
"role": "admin",
"user_id": "user-123"
}
]
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json Spanway_TeamTable |
| 400 | The team id is taken or reserved, or a budget value is invalid | application/json ProxyError |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license allows no more teams, or the caller may not create teams | application/json ProxyError |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
team_alias | string or null | No | A readable name for the team |
team_id | string | Yes | The team's unique id |
organization_id | string or null | No | The organization the team belongs to |
admins | array of string | No | User ids of the team's admins |
members | array of string | No | User ids of the team's members |
members_with_roles | array of Member | No | Every member with their role in the team, admin or user |
team_member_permissions | array of string or null | No | Key actions ordinary members may take on the team's keys |
metadata | object or null | No | Free-form labels for the team, such as a cost center |
tpm_limit | integer or null | No | Most tokens per minute all of the team's keys may use together |
rpm_limit | integer or null | No | Most requests per minute all of the team's keys may send together |
tpd_limit | integer or null | No | Most tokens per day all of the team's keys may use together |
max_budget | number or null | No | Requests fail once the team's spend passes this, in USD |
soft_budget | number or null | No | An alert fires when the team's spend reaches this, in USD |
budget_duration | string or null | No | Budget Duration |
budget_limits | array of BudgetLimitEntry or null | No | Extra budget windows, each with its own limit and reset schedule |
models | array of string | No | Models the team's keys may call, empty for every model |
blocked | boolean | No | True when every request made with the team's keys is refused |
router_settings | object or null | No | Routing settings that apply to the team's requests |
access_group_ids | array of string or null | No | Access groups whose models, MCP servers and agents the team may use |
default_team_member_models | array of string or null | No | Models a new member may use when none are set for them |
spend | number or null | No | What the team has spent in the current budget period, in USD |
max_parallel_requests | integer or null | No | Most requests the team's keys may have in flight at once |
budget_reset_at | string or null | No | When the team's spend next resets |
model_id | integer or null | No | Model Id |
model_spend | object or null | No | Model Spend |
model_max_budget | object or null | No | Model Max Budget |
policies | array of string or null | No | Policies |
allow_team_guardrail_config | boolean or null | No | Allow Team Guardrail Config |
spanway_model_table | Spanway_ModelTable or null | No | |
object_permission | Spanway_ObjectPermissionTable or null | No | |
object_permission_id | string or null | No | Object Permission Id |
updated_at | string or null | No | Updated At |
created_at | string or null | No | Created At |
POST /team/update
Update a team
Use /team/member_add AND /team/member/delete to add/remove new team members
You can now update team budget / rate limits via /team/update
What to send:
team_id: The team id of the user. Required param.team_alias: User defined team aliasteam_member_permissions: A list of routes that non-admin team members can access. example: ["/key/generate", "/key/update", "/key/delete"]metadata: Metadata for team, store information for team. Example metadata = {"team": "core-infra", "app": "app2", "email": "user@example.com" }tpm_limit: The TPM (Tokens Per Minute) limit for this team - all keys with this team_id will have at max this TPM limitrpm_limit: The RPM (Requests Per Minute) limit for this team - all keys associated with this team_id will have at max this RPM limittpd_limit: The TPD (Tokens Per Day) limit for this team. Batch submissions are charged against it instead of tpm_limit/rpm_limitmax_parallel_requests: Most requests all keys of this team may have in flight at once (429 beyond)max_budget: The maximum budget allocated to the team - all keys for this team_id will have at max this max_budgetsoft_budget: The soft budget threshold for the team. If max_budget is set (either in the request or existing), soft_budget must be strictly lower than max_budget. Can be set independently if max_budget is not set.budget_duration: The duration of the budget for the team. Doc heremodels: A list of models associated with the team - all keys for this team_id will have at most, these models. If empty, assumes all models are allowed.prompts: List of prompts that the team is allowed to use.blocked: Flag indicating if the team is blocked or not - will stop all calls from keys with this team_id.tags: Tags for tracking spend and/or doing tag-based routing.organization_id: The organization id of the team. Default is None. Create via/organization/new.model_aliases: Model aliases for the team. Docsmodel_max_budget: Per-model max budget every key on the team inherits unless the key sets its own for that model. Example: {"gpt-4o": {"max_budget": 10, "budget_duration": "1d"}}guardrails: Guardrails for the team. Docspolicies: Policies for the team. Docsdisable_global_guardrails: Whether to disable global guardrails for the team. Proxy admin only.require_trace_id: Reject LLM, MCP and agent requests from this team that carry no trace ID.provider_preferences: Default provider preferences (order, only, ignore, sort, max_price, allow_fallbacks) for this team's chat, responses, messages, completions and embeddings requests. Keys and requests can narrow them but never widen them. Proxy admin only. Stored in metadata.object_permission: team-specific object permission. Example - {"vector_stores": ["vector_store_1", "vector_store_2"], "agents": ["agent_1", "agent_2"], "agent_access_groups": ["dev_group"]}. IF null or {} then no object permission.team_member_budget: The maximum budget allocated to an individual team member.team_member_budget_duration: The duration of the budget for the team member. Doc hereteam_member_model_max_budget: Per-model budgets shared by team members without an override.team_member_rpm_limit: The RPM (Requests Per Minute) limit for individual team members.team_member_tpm_limit: The TPM (Tokens Per Minute) limit for individual team members.team_member_key_duration: The duration for a team member's key. e.g. "1d", "1w", "1mo"allowed_passthrough_routes: List of allowed pass through routes for the team.denied_passthrough_routes: List of pass through routes the team's keys may not call, even if allowed. Applies together with each key'sdenied_passthrough_routes.model_rpm_limit: The RPM (Requests Per Minute) limit per model for this team. Example: {"gpt-4": 100, "gpt-3.5-turbo": 200}model_tpm_limit: The TPM (Tokens Per Minute) limit per model for this team. Example: {"gpt-4": 10000, "gpt-3.5-turbo": 20000}default_estimated_output_tokens: Expected output tokens reserved for TPM limiting when a request omits max_tokens, for keys on this team that do not set their own. Positive integer.default_estimated_output_tokens_per_model: Per-model override of the above. Example: {"gpt-4": 4096, "gpt-3.5-turbo": 1024}mcp_rpm_limit: Per-MCP-server RPM limit for this team, keyed by MCP server name (alias if set, else the configured name). Example: {"jira": 100, "slack": 200}. Applied across all keys for this team. Example - update team TPM Limitallowed_vector_store_indexes: List of allowed vector store indexes for the key. Example - [{"index_name": "my-index", "index_permissions": ["write", "read"]}]. If specified, the key will only be able to use these specific vector store indexes. Create index, using/v1/indexesendpoint.secret_manager_settings: Secret manager settings for the team. Docsrouter_settings: team-specific router settings. Example - {"model_group_retry_policy": {"gpt-4": {"RateLimitErrorRetries": 5}}}. IF null or {} then no router settings.access_group_ids: List of access group IDs to associate with the team. Access groups define which models the team can access. Example - ["access_group_1", "access_group_2"].enforced_file_expires_after: Enforced file expiration policy for the team. Keys created under this team will inherit this policy for file uploads. Example - {"anchor": "created_at", "days": 30}.enforced_batch_output_expires_after: Enforced batch output file expiration policy for the team. Keys created under this team will inherit this policy for batch output files. Example - {"anchor": "created_at", "days": 30}.budget_limits: List of concurrent budget windows for the team. 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"}].default_team_member_models: Default models assigned to new team members when they join this team. Must be a subset of the team's models.
curl --location 'http://0.0.0.0:4000/team/update' --header "Authorization: Bearer $SPANWAY_MASTER_KEY" --header 'Content-Type: application/json' --data-raw '{
"team_id": "8d916b1c-510d-4894-a334-1c16a93344f5",
"tpm_limit": 100
}'
Example - Update Team max_budget budget
curl --location 'http://0.0.0.0:4000/team/update' --header "Authorization: Bearer $SPANWAY_MASTER_KEY" --header 'Content-Type: application/json' --data-raw '{
"team_id": "8d916b1c-510d-4894-a334-1c16a93344f5",
"max_budget": 10
}'
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
spanway-changed-by | header | string or null | No | The 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 UpdateTeamRequest):
| Field | Type | Required | Description |
|---|---|---|---|
team_id | string | Yes | Team Id |
team_alias | string or null | No | Team Alias |
organization_id | string or null | No | Organization Id |
metadata | object or null | No | Metadata |
tpm_limit | integer or null | No | Most tokens per minute all of the team's keys may use together |
rpm_limit | integer or null | No | Most requests per minute all of the team's keys may send together |
tpd_limit | integer or null | No | Tpd Limit |
max_parallel_requests | integer or null | No | Most requests the whole team may have in flight at once, beyond it a 429 |
max_budget | number or null | No | Max Budget |
soft_budget | number or null | No | Soft Budget |
models | array of any or null | No | Models |
blocked | boolean or null | No | Blocked |
budget_duration | string or null | No | Budget Duration |
tags | array of any or null | No | Tags |
model_aliases | object or null | No | Model Aliases |
guardrails | array of string or null | No | Guardrails |
policies | array of string or null | No | Policies |
object_permission | Spanway_ObjectPermissionBase or null | No | |
disable_global_guardrails | boolean or null | No | Disable Global Guardrails |
require_trace_id | boolean or null | No | Require Trace Id |
provider_preferences | object or null | No | Provider Preferences |
data_policy | object or null | No | Data Policy |
team_member_budget | number or null | No | Team Member Budget |
team_member_budget_duration | string or null | No | Team Member Budget Duration |
team_member_model_max_budget | object or null | No | Team Member Model Max Budget |
team_member_rpm_limit | integer or null | No | Team Member Rpm Limit |
team_member_tpm_limit | integer or null | No | Team Member Tpm Limit |
team_member_key_duration | string or null | No | Team Member Key Duration |
allowed_passthrough_routes | array of any or null | No | Allowed Passthrough Routes |
denied_passthrough_routes | array of string or null | No | Denied Passthrough Routes |
allowed_ips | array of string or null | No | Allowed Ips |
secret_manager_settings | object or null | No | Secret Manager Settings |
prompts | array of string or null | No | Prompts |
model_rpm_limit | object or null | No | Requests per minute for each model, shared by the team's keys |
model_tpm_limit | object or null | No | Tokens per minute for each model, shared by the team's keys |
default_estimated_output_tokens | integer or null | No | Default Estimated Output Tokens |
default_estimated_output_tokens_per_model | object or null | No | Default Estimated Output Tokens Per Model |
mcp_rpm_limit | object or null | No | Mcp Rpm Limit |
allowed_vector_store_indexes | array of AllowedVectorStoreIndexItem or null | No | Allowed Vector Store Indexes |
enforced_batch_output_expires_after | object or null | No | Enforced Batch Output Expires After |
enforced_file_expires_after | object or null | No | Enforced File Expires After |
router_settings | UpdateRouterConfig or null | No | Router Settings |
access_group_ids | array of string or null | No | Access Group Ids |
budget_limits | array of BudgetLimitEntry or null | No | Budget Limits |
default_team_member_models | array of string or null | No | Default Team Member Models |
model_max_budget | object or null | No | Max budget per model for every key on the team, overridable per key (e.g. {'gpt-4o': {'max_budget': 10, 'budget_duration': '1d'}}) |
Example request:
curl -X POST "http://localhost:4000/team/update" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"team_id": "team-ds",
"max_budget": 800,
"tpm_limit": 200000,
"max_parallel_requests": 20
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The team after the change | application/json TeamUpdateResponse |
| 400 | A budget value is invalid or no team id was sent | application/json ProxyError |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | A team admin sent a field proxy admins have not opened to team admins | application/json ProxyError |
| 404 | No team has that team_id | application/json ProxyError |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
team_id | string | Yes | The team that changed |
data | Spanway_TeamTable | Yes | The team after the change |
PATCH /team/{team_id}
Update a team by id
Partially update a team using RFC 7386 JSON Merge Patch semantics.
team_id is taken from the path; a team_id in the body is accepted only when it
matches. metadata is merged with the team's stored metadata rather than replacing
it: an omitted key is preserved, key: null deletes it, and any other value
overwrites (recursing into nested objects). Every other field behaves exactly like
POST /team/update (omitted preserves, a value overwrites). Returns the full
updated team.
curl --location --request PATCH 'http://0.0.0.0:4000/team/8d916b1c-510d-4894-a334-1c16a93344f5' --header "Authorization: Bearer $SPANWAY_MASTER_KEY" --header 'Content-Type: application/json' --data-raw '{
"metadata": {"cost_center": "1234", "deprecated_key": null}
}'
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
team_id | path | string | Yes | |
spanway-changed-by | header | string or null | No | The 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 PatchTeamRequest):
| Field | Type | Required | Description |
|---|---|---|---|
team_id | string or null | No | Team Id |
team_alias | string or null | No | Team Alias |
organization_id | string or null | No | Organization Id |
metadata | object or null | No | Metadata |
tpm_limit | integer or null | No | Most tokens per minute all of the team's keys may use together |
rpm_limit | integer or null | No | Most requests per minute all of the team's keys may send together |
tpd_limit | integer or null | No | Tpd Limit |
max_parallel_requests | integer or null | No | Most requests the whole team may have in flight at once, beyond it a 429 |
max_budget | number or null | No | Max Budget |
soft_budget | number or null | No | Soft Budget |
models | array of any or null | No | Models |
blocked | boolean or null | No | Blocked |
budget_duration | string or null | No | Budget Duration |
tags | array of any or null | No | Tags |
model_aliases | object or null | No | Model Aliases |
guardrails | array of string or null | No | Guardrails |
policies | array of string or null | No | Policies |
object_permission | Spanway_ObjectPermissionBase or null | No | |
disable_global_guardrails | boolean or null | No | Disable Global Guardrails |
require_trace_id | boolean or null | No | Require Trace Id |
provider_preferences | object or null | No | Provider Preferences |
data_policy | object or null | No | Data Policy |
team_member_budget | number or null | No | Team Member Budget |
team_member_budget_duration | string or null | No | Team Member Budget Duration |
team_member_model_max_budget | object or null | No | Team Member Model Max Budget |
team_member_rpm_limit | integer or null | No | Team Member Rpm Limit |
team_member_tpm_limit | integer or null | No | Team Member Tpm Limit |
team_member_key_duration | string or null | No | Team Member Key Duration |
allowed_passthrough_routes | array of any or null | No | Allowed Passthrough Routes |
denied_passthrough_routes | array of string or null | No | Denied Passthrough Routes |
allowed_ips | array of string or null | No | Allowed Ips |
secret_manager_settings | object or null | No | Secret Manager Settings |
prompts | array of string or null | No | Prompts |
model_rpm_limit | object or null | No | Requests per minute for each model, shared by the team's keys |
model_tpm_limit | object or null | No | Tokens per minute for each model, shared by the team's keys |
default_estimated_output_tokens | integer or null | No | Default Estimated Output Tokens |
default_estimated_output_tokens_per_model | object or null | No | Default Estimated Output Tokens Per Model |
mcp_rpm_limit | object or null | No | Mcp Rpm Limit |
allowed_vector_store_indexes | array of AllowedVectorStoreIndexItem or null | No | Allowed Vector Store Indexes |
enforced_batch_output_expires_after | object or null | No | Enforced Batch Output Expires After |
enforced_file_expires_after | object or null | No | Enforced File Expires After |
router_settings | UpdateRouterConfig or null | No | Router Settings |
access_group_ids | array of string or null | No | Access Group Ids |
budget_limits | array of BudgetLimitEntry or null | No | Budget Limits |
default_team_member_models | array of string or null | No | Default Team Member Models |
model_max_budget | object or null | No | Max budget per model for every key on the team, overridable per key (e.g. {'gpt-4o': {'max_budget': 10, 'budget_duration': '1d'}}) |
Example request:
curl -X PATCH "http://localhost:4000/team/team_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"max_budget": 800,
"models": [
"claude-sonnet-5-5",
"gpt-6.1-sol"
]
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json Spanway_TeamTable |
| 400 | The body names another team or a budget value is invalid | application/json ProxyError |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | A team admin sent a field proxy admins have not opened to team admins | application/json ProxyError |
| 404 | No team has that team_id | application/json ProxyError |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
team_alias | string or null | No | A readable name for the team |
team_id | string | Yes | The team's unique id |
organization_id | string or null | No | The organization the team belongs to |
admins | array of string | No | User ids of the team's admins |
members | array of string | No | User ids of the team's members |
members_with_roles | array of Member | No | Every member with their role in the team, admin or user |
team_member_permissions | array of string or null | No | Key actions ordinary members may take on the team's keys |
metadata | object or null | No | Free-form labels for the team, such as a cost center |
tpm_limit | integer or null | No | Most tokens per minute all of the team's keys may use together |
rpm_limit | integer or null | No | Most requests per minute all of the team's keys may send together |
tpd_limit | integer or null | No | Most tokens per day all of the team's keys may use together |
max_budget | number or null | No | Requests fail once the team's spend passes this, in USD |
soft_budget | number or null | No | An alert fires when the team's spend reaches this, in USD |
budget_duration | string or null | No | Budget Duration |
budget_limits | array of BudgetLimitEntry or null | No | Extra budget windows, each with its own limit and reset schedule |
models | array of string | No | Models the team's keys may call, empty for every model |
blocked | boolean | No | True when every request made with the team's keys is refused |
router_settings | object or null | No | Routing settings that apply to the team's requests |
access_group_ids | array of string or null | No | Access groups whose models, MCP servers and agents the team may use |
default_team_member_models | array of string or null | No | Models a new member may use when none are set for them |
spend | number or null | No | What the team has spent in the current budget period, in USD |
max_parallel_requests | integer or null | No | Most requests the team's keys may have in flight at once |
budget_reset_at | string or null | No | When the team's spend next resets |
model_id | integer or null | No | Model Id |
model_spend | object or null | No | Model Spend |
model_max_budget | object or null | No | Model Max Budget |
policies | array of string or null | No | Policies |
allow_team_guardrail_config | boolean or null | No | Allow Team Guardrail Config |
spanway_model_table | Spanway_ModelTable or null | No | |
object_permission | Spanway_ObjectPermissionTable or null | No | |
object_permission_id | string or null | No | Object Permission Id |
updated_at | string or null | No | Updated At |
created_at | string or null | No | Created At |
POST /team/member_add
Add members to a team
Adds one or more people to a team, by user_id or user_email, so their keys can use the team's models and
budget. A user that does not exist yet is created. max_budget_in_team gives each new member a spending limit
inside the team. Proxy admins and the team's admins may call it, adding a member with the admin role needs an
Enterprise license, and the change is written to the audit log.
curl -X POST 'http://localhost:4000/team/member_add' \
-H "Authorization: Bearer $SPANWAY_MASTER_KEY" \
-H 'Content-Type: application/json' \
-d '{"team_id": "team-ds", "member": {"role": "user", "user_id": "user-123"}, "max_budget_in_team": 50}'
Request body (application/json, schema TeamMemberAddRequest):
| Field | Type | Required | Description |
|---|---|---|---|
member | array of Member or Member | Yes | Member object or list of member objects to add. Each member must include either user_id or user_email, and a role |
team_id | string | Yes | The ID of the team to add the member to |
max_budget_in_team | number or null | No | Maximum budget allocated to this user within the team. If not set, user has unlimited budget within team limits |
budget_duration | string or null | No | Duration after which this team member's budget resets (e.g. '1h', '24h', '7d', '30d'). If not set, the budget never resets. |
allowed_models | array of string or null | No | List of models this team member can access. If not set, inherits the team's default_team_member_models or all team models. |
Example request:
curl -X POST "http://localhost:4000/team/member_add" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"team_id": "team-ds",
"member": {
"role": "user",
"user_id": "user-123"
},
"max_budget_in_team": 50
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json TeamAddMemberResponse |
| 400 | No member was sent, or admin roles need an Enterprise license | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | Only proxy admins and the team's admins may add members | application/json ErrorDetail |
| 404 | No team has that team_id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
team_alias | string or null | No | A readable name for the team |
team_id | string | Yes | The team's unique id |
organization_id | string or null | No | The organization the team belongs to |
admins | array of string | No | User ids of the team's admins |
members | array of string | No | User ids of the team's members |
members_with_roles | array of Member | No | Every member with their role in the team, admin or user |
team_member_permissions | array of string or null | No | Key actions ordinary members may take on the team's keys |
metadata | object or null | No | Free-form labels for the team, such as a cost center |
tpm_limit | integer or null | No | Most tokens per minute all of the team's keys may use together |
rpm_limit | integer or null | No | Most requests per minute all of the team's keys may send together |
tpd_limit | integer or null | No | Most tokens per day all of the team's keys may use together |
max_budget | number or null | No | Requests fail once the team's spend passes this, in USD |
soft_budget | number or null | No | An alert fires when the team's spend reaches this, in USD |
budget_duration | string or null | No | Budget Duration |
budget_limits | array of BudgetLimitEntry or null | No | Extra budget windows, each with its own limit and reset schedule |
models | array of string | No | Models the team's keys may call, empty for every model |
blocked | boolean | No | True when every request made with the team's keys is refused |
router_settings | object or null | No | Routing settings that apply to the team's requests |
access_group_ids | array of string or null | No | Access groups whose models, MCP servers and agents the team may use |
default_team_member_models | array of string or null | No | Models a new member may use when none are set for them |
spend | number or null | No | What the team has spent in the current budget period, in USD |
max_parallel_requests | integer or null | No | Most requests the team's keys may have in flight at once |
budget_reset_at | string or null | No | When the team's spend next resets |
model_id | integer or null | No | Model Id |
model_spend | object or null | No | Model Spend |
model_max_budget | object or null | No | Model Max Budget |
policies | array of string or null | No | Policies |
allow_team_guardrail_config | boolean or null | No | Allow Team Guardrail Config |
spanway_model_table | Spanway_ModelTable or null | No | |
object_permission | Spanway_ObjectPermissionTable or null | No | |
object_permission_id | string or null | No | Object Permission Id |
updated_at | string or null | No | Updated At |
created_at | string or null | No | Created At |
updated_users | array of Spanway_UserTable | Yes | Updated Users |
updated_team_memberships | array of Spanway_TeamMembership | Yes | Updated Team Memberships |
POST /team/member_delete
Remove a member from a team
Removes a member from a team, by user_id or user_email, together with their budget in the team. The team and its keys stay. Proxy admins and the team's admins may call it, an unknown team answers 404, and the change is written to the audit log.
curl -X POST 'http://localhost:4000/team/member_delete' \
-H "Authorization: Bearer $SPANWAY_MASTER_KEY" \
-H 'Content-Type: application/json' \
-d '{"team_id": "team-ds", "user_id": "user-123"}'
Request body (application/json, schema TeamMemberDeleteRequest):
| Field | Type | Required | Description |
|---|---|---|---|
user_id | string or null | No | User Id |
user_email | string or null | No | User Email |
team_id | string | Yes | Team Id |
Example request:
curl -X POST "http://localhost:4000/team/member_delete" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"team_id": "team-ds",
"user_id": "user-123"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The team without the removed member | application/json Spanway_TeamTable |
| 400 | The request names no member, or the member is not on the team | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller is not a proxy admin or team admin, or member removal is turned off for team admins | application/json ErrorDetail |
| 404 | No team has that team_id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
team_alias | string or null | No | A readable name for the team |
team_id | string | Yes | The team's unique id |
organization_id | string or null | No | The organization the team belongs to |
admins | array of string | No | User ids of the team's admins |
members | array of string | No | User ids of the team's members |
members_with_roles | array of Member | No | Every member with their role in the team, admin or user |
team_member_permissions | array of string or null | No | Key actions ordinary members may take on the team's keys |
metadata | object or null | No | Free-form labels for the team, such as a cost center |
tpm_limit | integer or null | No | Most tokens per minute all of the team's keys may use together |
rpm_limit | integer or null | No | Most requests per minute all of the team's keys may send together |
tpd_limit | integer or null | No | Most tokens per day all of the team's keys may use together |
max_budget | number or null | No | Requests fail once the team's spend passes this, in USD |
soft_budget | number or null | No | An alert fires when the team's spend reaches this, in USD |
budget_duration | string or null | No | Budget Duration |
budget_limits | array of BudgetLimitEntry or null | No | Extra budget windows, each with its own limit and reset schedule |
models | array of string | No | Models the team's keys may call, empty for every model |
blocked | boolean | No | True when every request made with the team's keys is refused |
router_settings | object or null | No | Routing settings that apply to the team's requests |
access_group_ids | array of string or null | No | Access groups whose models, MCP servers and agents the team may use |
default_team_member_models | array of string or null | No | Models a new member may use when none are set for them |
spend | number or null | No | What the team has spent in the current budget period, in USD |
max_parallel_requests | integer or null | No | Most requests the team's keys may have in flight at once |
budget_reset_at | string or null | No | When the team's spend next resets |
model_id | integer or null | No | Model Id |
model_spend | object or null | No | Model Spend |
model_max_budget | object or null | No | Model Max Budget |
policies | array of string or null | No | Policies |
allow_team_guardrail_config | boolean or null | No | Allow Team Guardrail Config |
spanway_model_table | Spanway_ModelTable or null | No | |
object_permission | Spanway_ObjectPermissionTable or null | No | |
object_permission_id | string or null | No | Object Permission Id |
updated_at | string or null | No | Updated At |
created_at | string or null | No | Created At |
POST /team/member_update
Change a member's role or budget in a team
Changes one member's role or limits inside a team: role, max_budget_in_team, tpm_limit, rpm_limit,
max_parallel_requests (how many requests the member may have in flight at once in the team) and
budget_duration. Proxy admins and the team's admins may call it, making someone a team admin needs an Enterprise
license, and the change is written to the audit log.
curl -X POST 'http://localhost:4000/team/member_update' \
-H "Authorization: Bearer $SPANWAY_MASTER_KEY" \
-H 'Content-Type: application/json' \
-d '{"team_id": "team-ds", "user_id": "user-123", "role": "admin", "max_budget_in_team": 75}'
Request body (application/json, schema TeamMemberUpdateRequest):
| Field | Type | Required | Description |
|---|---|---|---|
user_id | string or null | No | User Id |
user_email | string or null | No | User Email |
team_id | string | Yes | Team Id |
max_budget_in_team | number or null | No | Max Budget In Team |
role | enum: "admin", "user" or null | No | Role |
tpm_limit | integer or null | No | Tokens per minute limit for this team member |
rpm_limit | integer or null | No | Requests per minute limit for this team member |
max_parallel_requests | integer or null | No | Most requests this team member may have in flight at once in the team |
budget_duration | string or null | No | Duration after which this team member's budget resets (e.g. '1h', '24h', '7d', '30d'). If not set, the budget never resets. |
allowed_models | array of string or null | No | List of models this team member can access. Pass an empty list to remove per-member model restrictions. |
temp_budget_increase | number or null | No | Temporary additive budget increase for this team member, active until temp_budget_expiry |
temp_budget_expiry | string or null | No | UTC expiry for temp_budget_increase |
model_max_budget | object or null | No | Per-model spend caps for this team member, each with its own budget_duration. Overrides the team's default per-model member budget. Pass an empty dict to fall back to the team default. |
Example request:
curl -X POST "http://localhost:4000/team/member_update" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"team_id": "team-ds",
"user_id": "user-123",
"role": "admin",
"max_budget_in_team": 75,
"max_parallel_requests": 4
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json TeamMemberUpdateResponse |
| 400 | The member is not on the team | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | Only proxy admins and the team's admins may change members | application/json ErrorDetail |
| 404 | No team has that team_id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
user_id | string | Yes | User Id |
user_email | string or null | No | User Email |
team_id | string | Yes | Team Id |
max_budget_in_team | number or null | No | Max Budget In Team |
tpm_limit | integer or null | No | Tpm Limit |
rpm_limit | integer or null | No | Rpm Limit |
max_parallel_requests | integer or null | No | Max Parallel Requests |
budget_duration | string or null | No | Budget Duration |
allowed_models | array of string or null | No | Allowed Models |
temp_budget_increase | number or null | No | Temp Budget Increase |
temp_budget_expiry | string or null | No | Temp Budget Expiry |
model_max_budget | object or null | No | Model Max Budget |
POST /team/{team_id}/member/{user_id}/reset_spend
Reset a member's spend in a team
Sets a team member's spend inside the team back to zero, or to reset_to, so a member who hit their team budget
can work again. This spend is tracked apart from the member's personal budget and the team's own budget, so
neither /user/update nor /team/update clears it. The change takes effect on the member's next request. Proxy
admins and the team's or organization's admins may call it, only a proxy admin may reset their own spend, and
the before and after values go to the audit log.
curl -X POST 'http://localhost:4000/team/team-ds/member/user-123/reset_spend' \
-H "Authorization: Bearer $SPANWAY_MASTER_KEY" \
-H 'Content-Type: application/json' \
-d '{"reset_to": 0}'
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
team_id | path | string | Yes | |
user_id | path | string | Yes |
Request body (application/json, schema ResetSpendRequest):
| Field | Type | Required | Description |
|---|---|---|---|
reset_to | number | Yes | Reset To |
Example request:
curl -X POST "http://localhost:4000/team/team_id-123/member/user_id-123/reset_spend" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"reset_to": 0
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The member's spend in the team before and after the reset | application/json TeamMemberResetSpendResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key's role, grants or license do not allow this action | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
team_id | string | Yes | The team the member belongs to |
user_id | string | Yes | The member whose spend was reset |
spend | number | Yes | The member's spend in the team after the reset, in USD |
previous_spend | number | Yes | The member's spend in the team before the reset, in USD |
max_budget | number or null | Yes | The member's budget in the team, null when none is set |
POST /team/{team_id}/member/{user_id}/reset_budget
Reset a member's budget to the team default
Puts a team member back on the team's default member budget (team_member_budget) by dropping the member's own
budget, so later team-wide budget changes reach them again. A team with no default leaves the member with no
budget. Spend is not touched. Proxy admins and the team's admins may call it, and the change is written to the
audit log.
curl -X POST 'http://localhost:4000/team/team-ds/member/user-123/reset_budget' \
-H "Authorization: Bearer $SPANWAY_MASTER_KEY"
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
team_id | path | string | Yes | |
user_id | path | string | Yes |
Request body (application/json, object):
Example request:
curl -X POST "http://localhost:4000/team/team_id-123/member/user_id-123/reset_budget" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json TeamMemberResetBudgetResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key's role, grants or license do not allow this action | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
team_id | string | Yes | Team Id |
user_id | string | Yes | User Id |
budget_id | string or null | Yes | Budget Id |
previous_budget_id | string or null | Yes | Previous Budget Id |
budget_source | enum: "team_default", "custom", "none" | Yes | Budget Source |
POST /team/bulk_member_add
Add many members to a team at once
Bulk add multiple members to a team at once.
This endpoint reuses the same logic as /team/member_add but provides a bulk-friendly response format.
What to send:
team_id: The ID of the team to add members tomembers: List of members to add to the teamall_users: Flag to add all users on Proxy to the teammax_budget_in_team: Maximum budget allocated to each user within the team
What you get back:
results: of individual member addition results- total_requested: Total number of members requested for addition
- successful_additions: Number of successful additions
- failed_additions: Number of failed additions
- updated_team: The updated team object
Example request:
curl --location 'http://0.0.0.0:4000/team/bulk_member_add' --header "Authorization: Bearer $SPANWAY_MASTER_KEY" --header 'Content-Type: application/json' --data '{
"team_id": "team-1234",
"members": [
{
"user_id": "user1",
"role": "user"
},
{
"user_email": "user2@example.com",
"role": "admin"
}
],
"max_budget_in_team": 100.0
}'
Request body (application/json, schema BulkTeamMemberAddRequest):
| Field | Type | Required | Description |
|---|---|---|---|
team_id | string | Yes | Team Id |
members | array of Member or null | No | Members |
all_users | boolean or null | No | All Users |
max_budget_in_team | number or null | No | Max Budget In Team |
Example request:
curl -X POST "http://localhost:4000/team/bulk_member_add" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"team_id": "team-ds",
"members": [
{
"role": "user",
"user_id": "user-123"
},
{
"role": "user",
"user_email": "ana@example.com"
}
],
"max_budget_in_team": 50
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json BulkTeamMemberAddResponse |
| 400 | The request is malformed or breaks a rule named in the detail | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key's role, grants or license do not allow this action | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
team_id | string | Yes | Team Id |
results | array of TeamMemberAddResult | Yes | Results |
total_requested | integer | Yes | Total Requested |
successful_additions | integer | Yes | Successful Additions |
failed_additions | integer | Yes | Failed Additions |
updated_team | object or null | No | Updated Team |
POST /team/delete
Delete teams
Deletes one or more teams and the keys that belong to them, so those keys stop working at once. The team rows are kept in the deleted teams list for reporting. Proxy admins may delete any team, team and organization admins the teams they manage, and the change is written to the audit log.
curl -X POST 'http://localhost:4000/team/delete' \
-H "Authorization: Bearer $SPANWAY_MASTER_KEY" \
-H 'Content-Type: application/json' \
-d '{"team_ids": ["team-ds"]}'
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
spanway-changed-by | header | string or null | No | The 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 DeleteTeamRequest):
| Field | Type | Required | Description |
|---|---|---|---|
team_ids | array of string | Yes | Team Ids |
Example request:
curl -X POST "http://localhost:4000/team/delete" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"team_ids": [
"team-ds"
]
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The teams that were deleted | application/json TeamDeleteResponse |
| 400 | No team id was sent | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | Only proxy admins and the team's admins may delete it | application/json ErrorDetail |
| 404 | No team has that team_id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
deleted_teams | array of string | Yes | The ids of the teams that were deleted |
GET /team/info
Get a team with its keys and members
Reads one team with its settings, budget, members, the keys that belong to it and each member's spend in the
team. Proxy admins and admin viewers can read any team, everyone else only teams they belong to or manage.
key_limit caps how many keys come back. Nothing changes.
curl 'http://localhost:4000/team/info?team_id=team-ds' \
-H "Authorization: Bearer sk-..."
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
team_id | query | string | No | Team ID in the request parameters |
key_limit | query | integer or null | No | Limit the number of keys returned |
Example request:
curl -X GET "http://localhost:4000/team/info" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The team with its keys and member budgets | application/json TeamInfoResponseObject |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | User=user-7 not authorized to access this team=team-ds or Team key for team=team-ops not authorized to access this team=team-ds | application/json ProxyError |
| 404 | Team not found, passed team_id=team-ds | application/json ProxyError |
| 422 | Malformed request. No team id passed in. | application/json ProxyError |
| 500 | Database not connected. Connect a database to your proxy - https://docs.spanway.ai/docs/simple_proxy#managing-auth---virtual-keys | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
team_id | string | Yes | Team Id |
team_info | TeamInfoResponseObjectTeamTable | Yes | |
keys | array of any | Yes | Keys |
team_memberships | array of TeamInfoMembership | Yes | Team Memberships |
GET /team/{team_id}/members/me
Your own membership in a team
Reads the caller's own membership in a team: their spend, budget, reset date, rate limits and role, without
showing other members. The caller comes from the key, so /members/me always means the caller. Any member may call
it, a caller who is not a member gets 404, and nothing changes.
curl 'http://localhost:4000/team/team-ds/members/me' \
-H "Authorization: Bearer sk-..."
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
team_id | path | string | Yes |
Example request:
curl -X GET "http://localhost:4000/team/team_id-123/members/me" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json TeamMemberInfoResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key's role, grants or license do not allow this action | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
user_id | string | Yes | User Id |
team_id | string | Yes | Team Id |
budget_id | string or null | No | Budget Id |
spend | number or null | No | Spend |
total_spend | number or null | No | Total Spend |
spanway_budget_table | Spanway_BudgetTableFull or Spanway_BudgetTable or null | No | Spanway Budget Table |
role | string or null | No | Role |
user_email | string or null | No | User Email |
team_alias | string or null | No | Team Alias |
POST /team/block
Block a team
Blocks a team: every request made with one of the team's keys is refused until the team is unblocked, which is the quick way to stop runaway spend or a leaked key. Proxy admins and the team's admins may call it, and the change is written to the audit log. The answer is the team with blocked set to true.
curl -X POST 'http://localhost:4000/team/block' \
-H "Authorization: Bearer $SPANWAY_MASTER_KEY" \
-H 'Content-Type: application/json' \
-d '{"team_id": "team-ds"}'
Request body (application/json, schema BlockTeamRequest):
| Field | Type | Required | Description |
|---|---|---|---|
team_id | string | Yes | Team Id |
Example request:
curl -X POST "http://localhost:4000/team/block" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"team_id": "team-ds"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The team, now blocked | application/json Spanway_TeamTable |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key's role, grants or license do not allow this action | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
team_alias | string or null | No | A readable name for the team |
team_id | string | Yes | The team's unique id |
organization_id | string or null | No | The organization the team belongs to |
admins | array of string | No | User ids of the team's admins |
members | array of string | No | User ids of the team's members |
members_with_roles | array of Member | No | Every member with their role in the team, admin or user |
team_member_permissions | array of string or null | No | Key actions ordinary members may take on the team's keys |
metadata | object or null | No | Free-form labels for the team, such as a cost center |
tpm_limit | integer or null | No | Most tokens per minute all of the team's keys may use together |
rpm_limit | integer or null | No | Most requests per minute all of the team's keys may send together |
tpd_limit | integer or null | No | Most tokens per day all of the team's keys may use together |
max_budget | number or null | No | Requests fail once the team's spend passes this, in USD |
soft_budget | number or null | No | An alert fires when the team's spend reaches this, in USD |
budget_duration | string or null | No | Budget Duration |
budget_limits | array of BudgetLimitEntry or null | No | Extra budget windows, each with its own limit and reset schedule |
models | array of string | No | Models the team's keys may call, empty for every model |
blocked | boolean | No | True when every request made with the team's keys is refused |
router_settings | object or null | No | Routing settings that apply to the team's requests |
access_group_ids | array of string or null | No | Access groups whose models, MCP servers and agents the team may use |
default_team_member_models | array of string or null | No | Models a new member may use when none are set for them |
spend | number or null | No | What the team has spent in the current budget period, in USD |
max_parallel_requests | integer or null | No | Most requests the team's keys may have in flight at once |
budget_reset_at | string or null | No | When the team's spend next resets |
model_id | integer or null | No | Model Id |
model_spend | object or null | No | Model Spend |
model_max_budget | object or null | No | Model Max Budget |
policies | array of string or null | No | Policies |
allow_team_guardrail_config | boolean or null | No | Allow Team Guardrail Config |
spanway_model_table | Spanway_ModelTable or null | No | |
object_permission | Spanway_ObjectPermissionTable or null | No | |
object_permission_id | string or null | No | Object Permission Id |
updated_at | string or null | No | Updated At |
created_at | string or null | No | Created At |
POST /team/unblock
Unblock a team
Unblocks a team so its keys work again. A team the gateway blocked by itself, for example after a security event, can only be unblocked by a proxy admin. Proxy admins and the team's admins may call it otherwise, and the change is written to the audit log.
curl -X POST 'http://localhost:4000/team/unblock' \
-H "Authorization: Bearer $SPANWAY_MASTER_KEY" \
-H 'Content-Type: application/json' \
-d '{"team_id": "team-ds"}'
Request body (application/json, schema BlockTeamRequest):
| Field | Type | Required | Description |
|---|---|---|---|
team_id | string | Yes | Team Id |
Example request:
curl -X POST "http://localhost:4000/team/unblock" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"team_id": "team-ds"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The team, no longer blocked | application/json Spanway_TeamTable |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key's role, grants or license do not allow this action | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
team_alias | string or null | No | A readable name for the team |
team_id | string | Yes | The team's unique id |
organization_id | string or null | No | The organization the team belongs to |
admins | array of string | No | User ids of the team's admins |
members | array of string | No | User ids of the team's members |
members_with_roles | array of Member | No | Every member with their role in the team, admin or user |
team_member_permissions | array of string or null | No | Key actions ordinary members may take on the team's keys |
metadata | object or null | No | Free-form labels for the team, such as a cost center |
tpm_limit | integer or null | No | Most tokens per minute all of the team's keys may use together |
rpm_limit | integer or null | No | Most requests per minute all of the team's keys may send together |
tpd_limit | integer or null | No | Most tokens per day all of the team's keys may use together |
max_budget | number or null | No | Requests fail once the team's spend passes this, in USD |
soft_budget | number or null | No | An alert fires when the team's spend reaches this, in USD |
budget_duration | string or null | No | Budget Duration |
budget_limits | array of BudgetLimitEntry or null | No | Extra budget windows, each with its own limit and reset schedule |
models | array of string | No | Models the team's keys may call, empty for every model |
blocked | boolean | No | True when every request made with the team's keys is refused |
router_settings | object or null | No | Routing settings that apply to the team's requests |
access_group_ids | array of string or null | No | Access groups whose models, MCP servers and agents the team may use |
default_team_member_models | array of string or null | No | Models a new member may use when none are set for them |
spend | number or null | No | What the team has spent in the current budget period, in USD |
max_parallel_requests | integer or null | No | Most requests the team's keys may have in flight at once |
budget_reset_at | string or null | No | When the team's spend next resets |
model_id | integer or null | No | Model Id |
model_spend | object or null | No | Model Spend |
model_max_budget | object or null | No | Model Max Budget |
policies | array of string or null | No | Policies |
allow_team_guardrail_config | boolean or null | No | Allow Team Guardrail Config |
spanway_model_table | Spanway_ModelTable or null | No | |
object_permission | Spanway_ObjectPermissionTable or null | No | |
object_permission_id | string or null | No | Object Permission Id |
updated_at | string or null | No | Updated At |
created_at | string or null | No | Created At |
GET /team/metadata_schema
Fields allowed in team metadata
Lists the team metadata fields an admin declared in general_settings.team_metadata_schema, so the Admin UI can
offer them in the team form. It answers an empty list when none are declared. The list is a guide only, the
gateway does not reject other keys. Any authenticated key may call it, and nothing changes.
Example request:
curl -X GET "http://localhost:4000/team/metadata_schema" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json TeamMetadataSchemaResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key's role, grants or license do not allow this action | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
fields | array of TeamMetadataFieldSchema | Yes | Fields |
GET /team/available
Teams the caller may join
Lists the teams an admin opened for self-service joining, through default_internal_user_params.available_teams
in the config, that the caller is not a member of yet. Any user may call it, it answers an empty list when no
team is open for joining, and nothing changes.
Example request:
curl -X GET "http://localhost:4000/team/available" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json array of Spanway_TeamTable |
| 400 | The gateway runs without a database | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 404 | The caller's key has no user | application/json ErrorDetail |
GET /v2/team/list
List teams with paging and filters
Get a paginated list of teams with filtering and sorting options.
What to send:
user_id
Only return teams which this user belongs to
organization_id
Only return teams which belong to this organization
team_id
Filter teams by exact team_id match
team_alias
Filter teams by partial team_alias match
page
The page number to return
page_size
The number of items per page
sort_by
Column to sort by (e.g. 'team_id', 'team_alias', 'created_at')
sort_order
Sort order ('asc' or 'desc')
status
Filter by status. Currently supports "deleted" to query deleted teams.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
user_id | query | string or null | No | Only return teams which this 'user_id' belongs to |
organization_id | query | string or null | No | Only return teams which this 'organization_id' belongs to |
team_id | query | string or null | No | Only return teams which this 'team_id' belongs to |
team_alias | query | string or null | No | Only return teams which this 'team_alias' belongs to. Supports partial matching. |
search | query | string or null | No | Combined search: matches teams whose 'team_id' matches the value OR whose 'team_alias' contains it (case-insensitive). |
search_team_id_match | query | enum: "exact", "prefix" | No | How 'search' matches 'team_id': 'exact' (default) or 'prefix' for a case-sensitive prefix match. |
page | query | integer | No | Page number for pagination |
page_size | query | integer | No | Number of teams per page |
sort_by | query | string or null | No | Column to sort by (e.g. 'team_id', 'team_alias', 'created_at') |
sort_order | query | string | No | Sort order ('asc' or 'desc') |
status | query | string or null | No | Filter by status (e.g. 'deleted') |
Example request:
curl -X GET "http://localhost:4000/v2/team/list" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json TeamListResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key's role, grants or license do not allow this action | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
teams | array of TeamListItem or Spanway_TeamTable or Spanway_DeletedTeamTable | Yes | Teams |
total | integer | Yes | Total |
page | integer | Yes | Page |
page_size | integer | Yes | Page Size |
total_pages | integer | Yes | Total Pages |
GET /team/list
List teams
Lists the teams the caller may see, each with its memberships and keys. Proxy admins and admin viewers see every
team, organization admins the teams of their organizations, and everyone else the teams they belong to.
user_id keeps only that user's teams and organization_id only one organization's, with default_organization
for teams outside any organization. Nothing changes. For large gateways use /v2/team/list, which pages.
curl 'http://localhost:4000/team/list' \
-H "Authorization: Bearer $SPANWAY_MASTER_KEY"
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
user_id | query | string or null | No | Only return teams which this 'user_id' belongs to |
organization_id | query | string or null | No |
Example request:
curl -X GET "http://localhost:4000/team/list" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The teams the caller may see, with their memberships and keys | application/json array of TeamListResponseObject |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key's role, grants or license do not allow this action | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
POST /team/model/add
Add models to a team
Adds models to the list a team may use, so every key of the team can call them. Proxy admins and the team's admins may call it, and the change is written to the audit log.
curl -X POST 'http://localhost:4000/team/model/add' \
-H "Authorization: Bearer $SPANWAY_MASTER_KEY" \
-H 'Content-Type: application/json' \
-d '{"team_id": "team-ds", "models": ["gpt-5.5"]}'
Request body (application/json, schema TeamModelAddRequest):
| Field | Type | Required | Description |
|---|---|---|---|
team_id | string | Yes | Team Id |
models | array of string | Yes | Models |
Example request:
curl -X POST "http://localhost:4000/team/model/add" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"team_id": "team-ds",
"models": [
"gpt-6.1-sol"
]
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The team with the models added | application/json Spanway_TeamTable |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | Only proxy admins and the team's admins may change the team's models | application/json ErrorDetail |
| 404 | No team has that team_id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
team_alias | string or null | No | A readable name for the team |
team_id | string | Yes | The team's unique id |
organization_id | string or null | No | The organization the team belongs to |
admins | array of string | No | User ids of the team's admins |
members | array of string | No | User ids of the team's members |
members_with_roles | array of Member | No | Every member with their role in the team, admin or user |
team_member_permissions | array of string or null | No | Key actions ordinary members may take on the team's keys |
metadata | object or null | No | Free-form labels for the team, such as a cost center |
tpm_limit | integer or null | No | Most tokens per minute all of the team's keys may use together |
rpm_limit | integer or null | No | Most requests per minute all of the team's keys may send together |
tpd_limit | integer or null | No | Most tokens per day all of the team's keys may use together |
max_budget | number or null | No | Requests fail once the team's spend passes this, in USD |
soft_budget | number or null | No | An alert fires when the team's spend reaches this, in USD |
budget_duration | string or null | No | Budget Duration |
budget_limits | array of BudgetLimitEntry or null | No | Extra budget windows, each with its own limit and reset schedule |
models | array of string | No | Models the team's keys may call, empty for every model |
blocked | boolean | No | True when every request made with the team's keys is refused |
router_settings | object or null | No | Routing settings that apply to the team's requests |
access_group_ids | array of string or null | No | Access groups whose models, MCP servers and agents the team may use |
default_team_member_models | array of string or null | No | Models a new member may use when none are set for them |
spend | number or null | No | What the team has spent in the current budget period, in USD |
max_parallel_requests | integer or null | No | Most requests the team's keys may have in flight at once |
budget_reset_at | string or null | No | When the team's spend next resets |
model_id | integer or null | No | Model Id |
model_spend | object or null | No | Model Spend |
model_max_budget | object or null | No | Model Max Budget |
policies | array of string or null | No | Policies |
allow_team_guardrail_config | boolean or null | No | Allow Team Guardrail Config |
spanway_model_table | Spanway_ModelTable or null | No | |
object_permission | Spanway_ObjectPermissionTable or null | No | |
object_permission_id | string or null | No | Object Permission Id |
updated_at | string or null | No | Updated At |
created_at | string or null | No | Created At |
POST /team/model/delete
Remove models from a team
Removes models from the list a team may use, so the team's keys can no longer call them. Proxy admins and the team's admins may call it, and the change is written to the audit log.
curl -X POST 'http://localhost:4000/team/model/delete' \
-H "Authorization: Bearer $SPANWAY_MASTER_KEY" \
-H 'Content-Type: application/json' \
-d '{"team_id": "team-ds", "models": ["gpt-5.5"]}'
Request body (application/json, schema TeamModelDeleteRequest):
| Field | Type | Required | Description |
|---|---|---|---|
team_id | string | Yes | Team Id |
models | array of string | Yes | Models |
Example request:
curl -X POST "http://localhost:4000/team/model/delete" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"team_id": "team-ds",
"models": [
"gpt-6.1-sol"
]
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The team with the models removed | application/json Spanway_TeamTable |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | Only proxy admins and the team's admins may change the team's models | application/json ErrorDetail |
| 404 | No team has that team_id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
team_alias | string or null | No | A readable name for the team |
team_id | string | Yes | The team's unique id |
organization_id | string or null | No | The organization the team belongs to |
admins | array of string | No | User ids of the team's admins |
members | array of string | No | User ids of the team's members |
members_with_roles | array of Member | No | Every member with their role in the team, admin or user |
team_member_permissions | array of string or null | No | Key actions ordinary members may take on the team's keys |
metadata | object or null | No | Free-form labels for the team, such as a cost center |
tpm_limit | integer or null | No | Most tokens per minute all of the team's keys may use together |
rpm_limit | integer or null | No | Most requests per minute all of the team's keys may send together |
tpd_limit | integer or null | No | Most tokens per day all of the team's keys may use together |
max_budget | number or null | No | Requests fail once the team's spend passes this, in USD |
soft_budget | number or null | No | An alert fires when the team's spend reaches this, in USD |
budget_duration | string or null | No | Budget Duration |
budget_limits | array of BudgetLimitEntry or null | No | Extra budget windows, each with its own limit and reset schedule |
models | array of string | No | Models the team's keys may call, empty for every model |
blocked | boolean | No | True when every request made with the team's keys is refused |
router_settings | object or null | No | Routing settings that apply to the team's requests |
access_group_ids | array of string or null | No | Access groups whose models, MCP servers and agents the team may use |
default_team_member_models | array of string or null | No | Models a new member may use when none are set for them |
spend | number or null | No | What the team has spent in the current budget period, in USD |
max_parallel_requests | integer or null | No | Most requests the team's keys may have in flight at once |
budget_reset_at | string or null | No | When the team's spend next resets |
model_id | integer or null | No | Model Id |
model_spend | object or null | No | Model Spend |
model_max_budget | object or null | No | Model Max Budget |
policies | array of string or null | No | Policies |
allow_team_guardrail_config | boolean or null | No | Allow Team Guardrail Config |
spanway_model_table | Spanway_ModelTable or null | No | |
object_permission | Spanway_ObjectPermissionTable or null | No | |
object_permission_id | string or null | No | Object Permission Id |
updated_at | string or null | No | Updated At |
created_at | string or null | No | Created At |
GET /team/permissions_list
What members of a team may do with keys
Shows which key actions ordinary members of a team may take on the team's keys, for example /key/generate or /key/info, next to every action that can be granted. Proxy admins, admin viewers and the team's admins may call it, and nothing changes.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
team_id | query | string | No | Team ID in the request parameters |
Example request:
curl -X GET "http://localhost:4000/team/permissions_list" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json GetTeamMemberPermissionsResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key's role, grants or license do not allow this action | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
team_id | string | Yes | Team Id |
team_member_permissions | array of string or null | No | Team Member Permissions |
all_available_permissions | array of string | Yes | All Available Permissions |
POST /team/permissions_update
Set what members of a team may do with keys
Sets which key actions ordinary members of a team may take on the team's keys, replacing the current list. For example, granting /key/generate lets members create their own keys for the team. Proxy admins and the team's admins may call it, and the before and after lists go to the audit log.
Request body (application/json, schema UpdateTeamMemberPermissionsRequest):
| Field | Type | Required | Description |
|---|---|---|---|
team_id | string | Yes | Team Id |
team_member_permissions | array of string | Yes | Team Member Permissions |
Example request:
curl -X POST "http://localhost:4000/team/permissions_update" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"team_id": "team-ds",
"team_member_permissions": [
"/key/generate",
"/key/update",
"/key/delete",
"/key/info",
"/key/health"
]
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json Spanway_TeamTable |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key's role, grants or license do not allow this action | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
team_alias | string or null | No | A readable name for the team |
team_id | string | Yes | The team's unique id |
organization_id | string or null | No | The organization the team belongs to |
admins | array of string | No | User ids of the team's admins |
members | array of string | No | User ids of the team's members |
members_with_roles | array of Member | No | Every member with their role in the team, admin or user |
team_member_permissions | array of string or null | No | Key actions ordinary members may take on the team's keys |
metadata | object or null | No | Free-form labels for the team, such as a cost center |
tpm_limit | integer or null | No | Most tokens per minute all of the team's keys may use together |
rpm_limit | integer or null | No | Most requests per minute all of the team's keys may send together |
tpd_limit | integer or null | No | Most tokens per day all of the team's keys may use together |
max_budget | number or null | No | Requests fail once the team's spend passes this, in USD |
soft_budget | number or null | No | An alert fires when the team's spend reaches this, in USD |
budget_duration | string or null | No | Budget Duration |
budget_limits | array of BudgetLimitEntry or null | No | Extra budget windows, each with its own limit and reset schedule |
models | array of string | No | Models the team's keys may call, empty for every model |
blocked | boolean | No | True when every request made with the team's keys is refused |
router_settings | object or null | No | Routing settings that apply to the team's requests |
access_group_ids | array of string or null | No | Access groups whose models, MCP servers and agents the team may use |
default_team_member_models | array of string or null | No | Models a new member may use when none are set for them |
spend | number or null | No | What the team has spent in the current budget period, in USD |
max_parallel_requests | integer or null | No | Most requests the team's keys may have in flight at once |
budget_reset_at | string or null | No | When the team's spend next resets |
model_id | integer or null | No | Model Id |
model_spend | object or null | No | Model Spend |
model_max_budget | object or null | No | Model Max Budget |
policies | array of string or null | No | Policies |
allow_team_guardrail_config | boolean or null | No | Allow Team Guardrail Config |
spanway_model_table | Spanway_ModelTable or null | No | |
object_permission | Spanway_ObjectPermissionTable or null | No | |
object_permission_id | string or null | No | Object Permission Id |
updated_at | string or null | No | Updated At |
created_at | string or null | No | Created At |
POST /team/permissions_bulk_update
Add member permissions to many teams
Adds key actions to the member permissions of many teams at once, either the teams in team_ids or every team
with apply_to_all_teams. Actions a team already grants are skipped and nothing is taken away. Proxy admins only,
and the change is written to the audit log.
Request body (application/json, schema BulkUpdateTeamMemberPermissionsRequest):
| Field | Type | Required | Description |
|---|---|---|---|
permissions | array of KeyManagementRoutes | Yes | Permissions |
team_ids | array of string or null | No | Team Ids |
apply_to_all_teams | boolean | No | Apply To All Teams |
Example request:
curl -X POST "http://localhost:4000/team/permissions_bulk_update" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"permissions": [
"/key/generate",
"/key/update"
],
"team_ids": [
"team-ds",
"team-nlp"
]
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json BulkUpdateTeamMemberPermissionsResponse |
| 400 | The request is malformed or breaks a rule named in the detail | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key's role, grants or license do not allow this action | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
message | string | Yes | Message |
teams_updated | integer | Yes | Teams Updated |
permissions_appended | array of string or null | No | Permissions Appended |
GET /team/daily/activity
Daily spend and usage of a team
Show spend, token counts and request counts per day for one or more teams, one page of days at a time.
Pass team_ids as a comma-separated list to pick teams, or leave it out to see every team you can read, and
exclude_team_ids to leave some out. start_date and end_date (YYYY-MM-DD) set the period, model and
api_key narrow it to one model or one key, and page and page_size (10 by default) page through the days.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
team_ids | query | string or null | No | |
start_date | query | string or null | No | |
end_date | query | string or null | No | |
model | query | string or null | No | |
api_key | query | string or null | No | |
page | query | integer | No | |
page_size | query | integer | No | |
exclude_team_ids | query | string or null | No |
Example request:
curl -X GET "http://localhost:4000/team/daily/activity" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json SpendAnalyticsPaginatedResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key's role, grants or license do not allow this action | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
results | array of DailySpendData | Yes | Results |
metadata | DailySpendMetadata | No |
GET /team/spend/by_user
Spend per member of a team
Shows how much each user spent inside the given teams between start_date and end_date, with token and request
counts, counted per request from the spend logs. Proxy admins may query any team. Team admins and members holding
the /team/daily/activity permission see every user of the requested teams, other members only their own row.
Nothing changes.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
team_ids | query | string or null | No | |
start_date | query | string or null | No | |
end_date | query | string or null | No |
Example request:
curl -X GET "http://localhost:4000/team/spend/by_user" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json TeamUserSpendResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key's role, grants or license do not allow this action | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
start_date | string | Yes | Start Date |
end_date | string | Yes | End Date |
results | array of TeamUserSpendRow | Yes | Results |
POST /management/v1/teams/{team_id}/members/bulk_delete
Remove many members from a team at once
Remove up to 500 members from one team in one call. Same authorization as
/team/member_delete: proxy admins, the team's admins, and admins of the team's
organization. Each member is named by exactly one of user_id or user_email;
unknown body fields are a 422 and an unknown team is a 404.
When disable_team_admin_delete_team_user is on, callers who are not proxy admins get a 403 problem whose detail
names that setting, and nothing is removed. The roster change is written to the audit log with the member list
before and after.
data holds one result per requested member, in request order. A row is
success: false with an error when it names nobody on the team or repeats an
earlier row. The roster is rewritten once, under the team's advisory lock, so a
concurrent member_add is never overwritten from a stale read.
Example curl:
curl --location 'http://0.0.0.0:4000/management/v1/teams/team-1/members/bulk_delete' --header "Authorization: Bearer $SPANWAY_MASTER_KEY" --header 'Content-Type: application/json' --data '{"members": [{"user_id": "user-1"}, {"user_email": "user-2@example.com"}]}'
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
team_id | path | string | Yes |
Request body (application/json, schema BulkTeamMemberDeleteRequest):
| Field | Type | Required | Description |
|---|---|---|---|
members | array of TeamMemberRef | Yes | Members |
Example request:
curl -X POST "http://localhost:4000/management/v1/teams/team_id-123/members/bulk_delete" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"members": [
{
"user_id": "user-123"
},
{
"user_email": "ana@example.com"
}
]
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json BulkTeamMemberDeleteResponse |
| 400 | Unknown query parameter | application/problem+json any |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | Forbidden | application/problem+json any |
| 404 | Team not found | application/problem+json any |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | Internal server error | application/problem+json any |
| 503 | Database not connected | application/problem+json any |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
data | array of TeamMemberDeleteResult | Yes | Data |
POST /management/v1/teams/{team_id}/members/bulk_update
Change many members' budgets in a team at once
Set per-member limits for up to 500 members of one team in one call. Same
authorization and member addressing as /team/member_update: proxy admins, the team's
admins, and admins of the team's organization, with each member named by exactly one of
user_id or user_email. Unknown body fields are a 422 and an unknown team is a 404.
Each row is a merge patch of that member's limits: a field left out is untouched, a field sent as null is cleared, and clearing the last limit drops the member back to the team default. A budget row shared by several memberships, the team default included, is copied for the member being patched rather than written in place, so one member's new cap never lands on anybody else.
data holds one result per requested member, in request order, carrying the limits in
force after the write. A row is success: false with an error when it names nobody on
the team or repeats an earlier row. Roles are not part of this route; /team/member_update
still owns them.
Example curl:
curl --location 'http://0.0.0.0:4000/management/v1/teams/team-1/members/bulk_update' --header "Authorization: Bearer $SPANWAY_MASTER_KEY" --header 'Content-Type: application/json' --data '{"members": [{"user_id": "user-1", "max_budget_in_team": 10}, {"user_email": "user-2@example.com", "max_budget_in_team": 10, "budget_duration": "30d"}]}'
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
team_id | path | string | Yes | |
spanway-changed-by | header | string or null | No | The 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 BulkTeamMemberBudgetUpdateRequest):
| Field | Type | Required | Description |
|---|---|---|---|
members | array of TeamMemberBudgetPatch | Yes | Members |
Example request:
curl -X POST "http://localhost:4000/management/v1/teams/team_id-123/members/bulk_update" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"members": [
{
"user_id": "user-123",
"max_budget_in_team": 50
},
{
"user_id": "user-456",
"max_budget_in_team": 50
}
]
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json BulkTeamMemberBudgetUpdateResponse |
| 400 | Unknown query parameter | application/problem+json any |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | Forbidden | application/problem+json any |
| 404 | Team not found | application/problem+json any |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | Internal server error | application/problem+json any |
| 503 | Database not connected | application/problem+json any |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
data | array of TeamMemberBudgetUpdateResult | Yes | Data |
GET /team/{team_id}/callback
Logging callbacks of a team
Shows which logging callbacks a team sends its successful and failed calls to and the settings each uses, with credentials masked as REDACTED. It covers callbacks added through this API or the Admin UI and teams still on the older callback_settings shape, using the same precedence as at request time. A key's own logging settings override the team's at request time and are not shown here. Proxy admins, admins of the team's organization and admins of the team may call it. Needs a license with scoped_integrations. Nothing is changed.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
team_id | path | string | Yes |
Example request:
curl -X GET "http://localhost:4000/team/team_id-123/callback" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The team's logging callbacks with credentials masked | application/json TeamCallbacksResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key's role, grants or license do not allow this action | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway has no database | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
status | "success" | Yes | Always success |
data | TeamCallbackSettings | Yes | The team's logging callbacks |
POST /team/{team_id}/callback
Add a logging callback to a team
Sends one team's request logs to its own observability account, for example its own Langfuse, Langsmith, Google Cloud Storage bucket or New Relic account, instead of or in addition to the gateway's. Choose whether successful calls, failed calls or both are sent with callback_type, and pass the destination's credentials in callback_vars. Credentials are stored encrypted and shown masked afterwards, and keys of the team start using the callback right away.
callback_name must be a callback that supports team credentials, such as langfuse, langfuse_otel, langsmith, gcs or newrelic. Common callback_vars are langfuse_public_key, langfuse_secret_key and langfuse_host for Langfuse, langsmith_api_key, langsmith_project and langsmith_base_url for Langsmith, gcs_bucket_name and gcs_path_service_account for Google Cloud Storage, and newrelic_api_key and newrelic_region for New Relic, which also needs the gateway to run with SPANWAY_OTEL_V2=true. capture_message_content set to no_content or span_only controls whether prompts and responses reach the destination.
Proxy admins, admins of the team's organization and admins of the team may call it. The change is written to the audit log, and the spanway-changed-by header records who the change was made for. Needs a license with scoped_integrations.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
team_id | path | string | Yes | |
spanway-changed-by | header | string or null | No | The 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 AddTeamCallback):
| Field | Type | Required | Description |
|---|---|---|---|
callback_name | string | Yes | The logging destination, such as langfuse, langsmith, gcs or newrelic |
callback_type | enum: "success", "failure", "success_and_failure" or null | No | Send successful calls, failed calls, or both |
callback_vars | object | Yes | The destination's credentials and settings, such as langfuse_public_key |
Example request:
curl -X POST "http://localhost:4000/team/team_id-123/callback" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"callback_name": "langfuse",
"callback_type": "success",
"callback_vars": {
"langfuse_public_key": "pk-lf-example",
"langfuse_secret_key": "sk-lf-example",
"langfuse_host": "https://cloud.langfuse.com"
}
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The team with its updated logging settings | application/json TeamCallbackAdded |
| 400 | The team does not exist, the callback is already registered for that event, or its settings are invalid | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key's role, grants or license do not allow this action | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway has no database | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
status | "success" | Yes | Always success |
data | Spanway_TeamTable | Yes | The team with its updated logging settings in metadata |
DELETE /team/{team_id}/callback/{callback_name}
Remove a logging callback from a team
Removes one logging callback from a team while its other callbacks keep running. Every entry registered under that callback_name is removed, for successful and failed calls alike. Answers 404 when the team does not exist or has no callback with that name, which is also the case for teams still on the older callback_settings shape, where disable_logging clears them. Proxy admins, admins of the team's organization and admins of the team may call it. The change is written to the audit log.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
team_id | path | string | Yes | |
callback_name | path | string | Yes | |
spanway-changed-by | header | string or null | No | The spanway-changed-by header enables tracking of actions performed by authorized users on behalf of other users, providing an audit trail for accountability |
Example request:
curl -X DELETE "http://localhost:4000/team/team_id-123/callback/callback_name-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The callbacks the team still has | application/json TeamCallbackDeleteResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key's role, grants or license do not allow this action | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway has no database | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
status | "success" | Yes | Always success |
message | string | Yes | What was removed |
data | TeamCallbackDeleteResponseData | Yes | The team's remaining callbacks |
POST /team/{team_id}/disable_logging
Turn off logging callbacks for a team
Turns off every logging callback of a team at once, for example when a team's observability account is being shut down. The registered callbacks and their credentials are cleared, so turning logging back on means adding them again. Proxy admins, admins of the team's organization and admins of the team may call it. The change is written to the audit log even though the team's own logging is now off.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
team_id | path | string | Yes | |
spanway-changed-by | header | string or null | No | The 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, object):
Example request:
curl -X POST "http://localhost:4000/team/team_id-123/disable_logging" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Logging is off for the team | application/json TeamCallbackDeleteResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key's role, grants or license do not allow this action | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway has no database | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
status | "success" | Yes | Always success |
message | string | Yes | What was removed |
data | TeamCallbackDeleteResponseData | Yes | The team's remaining callbacks |