Access groups API
This page documents the 10 gateway endpoints tagged access_groups 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 | /v1/access_group | List access groups |
| POST | /v1/access_group | Create an access group |
| GET | /v1/access_group/{access_group_id} | Get an access group |
| PUT | /v1/access_group/{access_group_id} | Update an access group |
| DELETE | /v1/access_group/{access_group_id} | Delete an access group |
| GET | /v1/unified_access_group | List access groups (alias of /v1/access_group) |
| POST | /v1/unified_access_group | Create an access group (alias of /v1/access_group) |
| GET | /v1/unified_access_group/{access_group_id} | Get an access group (alias of /v1/access_group) |
| PUT | /v1/unified_access_group/{access_group_id} | Update an access group (alias of /v1/access_group) |
| DELETE | /v1/unified_access_group/{access_group_id} | Delete an access group (alias of /v1/access_group) |
Endpoints
GET /v1/access_group
List access groups
Every access group, newest first, with the names of the teams, keys, servers and agents it refers to. Use it to see who can reach which models and tools through a group. Proxy admins and admin viewers. Nothing is changed.
Example request:
curl -X GET "http://localhost:4000/v1/access_group" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Every access group, newest first | application/json array of AccessGroupResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | Only proxy admins may change access groups, and only proxy admins and admin viewers may read them | application/json ErrorDetail |
| 500 | The gateway runs without a database | application/json ErrorDetail |
POST /v1/access_group
Create an access group
Create a named bundle of models, MCP servers and agents, and attach it to teams and keys. Members of an attached team, and attached keys, may use everything in the group without listing it on each key. Proxy admins only. The name must be unique, so a name already in use answers 409, and an unknown team id answers 400. The new group is recorded in the audit log.
Request body (application/json, schema AccessGroupCreateRequest):
| Field | Type | Required | Description |
|---|---|---|---|
access_agent_ids | array of string or null | No | Agent ids the group grants |
access_group_name | string | Yes | A unique name for the group, for example support-tools |
access_mcp_server_ids | array of string or null | No | MCP server ids the group grants |
access_model_names | array of string or null | No | Model names the group grants |
assigned_key_ids | array of string or null | No | Virtual keys, by hashed token, that get it |
assigned_team_ids | array of string or null | No | Teams whose members get the group |
description | string or null | No | What the group is for, shown in the Admin UI |
Example request:
curl -X POST "http://localhost:4000/v1/access_group" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"access_agent_ids": [
"agent-triage"
],
"access_group_name": "support-tools",
"access_mcp_server_ids": [
"mcp-ticketing"
],
"access_model_names": [
"claude-haiku-5-5"
],
"assigned_team_ids": [
"team-support"
],
"description": "Models and MCP servers the support desk may use"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 201 | The new access group | application/json AccessGroupResponse |
| 400 | A team id in assigned_team_ids does not exist | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | Only proxy admins may change access groups, and only proxy admins and admin viewers may read them | application/json ErrorDetail |
| 409 | Another group already has that name | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway runs without a database | application/json ErrorDetail |
GET /v1/access_group/{access_group_id}
Get an access group
One access group with the names of the teams, keys, servers and agents it refers to. A name is null when the id no longer resolves. Proxy admins and admin viewers. Nothing is changed, and an unknown id answers 404.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
access_group_id | path | string | Yes |
Example request:
curl -X GET "http://localhost:4000/v1/access_group/access_group_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The access group | application/json AccessGroupResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | Only proxy admins may change access groups, and only proxy admins and admin viewers may read them | application/json ErrorDetail |
| 404 | No access group has that id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway runs without a database | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
access_agent_ids | array of string | Yes | Access Agent Ids |
access_agents | array of AccessGroupResource | Yes | Access Agents |
access_group_id | string | Yes | Access Group Id |
access_group_name | string | Yes | Access Group Name |
access_mcp_server_ids | array of string | Yes | Access Mcp Server Ids |
access_mcp_servers | array of AccessGroupResource | Yes | Access Mcp Servers |
access_model_names | array of string | Yes | Access Model Names |
assigned_key_ids | array of string | Yes | Assigned Key Ids |
assigned_keys | array of AccessGroupResource | Yes | Assigned Keys |
assigned_team_ids | array of string | Yes | Assigned Team Ids |
assigned_teams | array of AccessGroupResource | Yes | Assigned Teams |
created_at | string | Yes | Created At |
created_by | string or null | No | Created By |
description | string or null | No | Description |
updated_at | string | Yes | Updated At |
updated_by | string or null | No | Updated By |
PUT /v1/access_group/{access_group_id}
Update an access group
Replace the fields sent and leave the others alone. Sending a list replaces that list, so send the full set of teams or keys you want attached. Teams and keys that are added or removed see the change on their next request. Proxy admins only. The change is recorded in the audit log, a new name already in use answers 409 and an unknown team id answers 400.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
access_group_id | path | string | Yes |
Request body (application/json, schema AccessGroupUpdateRequest):
| Field | Type | Required | Description |
|---|---|---|---|
access_agent_ids | array of string or null | No | Replaces the granted agent ids |
access_group_name | string or null | No | A new unique name for the group |
access_mcp_server_ids | array of string or null | No | Replaces the granted MCP server ids |
access_model_names | array of string or null | No | Replaces the granted model names |
assigned_key_ids | array of string or null | No | Replaces the virtual keys that get the group |
assigned_team_ids | array of string or null | No | Replaces the teams that get the group |
description | string or null | No | What the group is for, shown in the Admin UI |
Example request:
curl -X PUT "http://localhost:4000/v1/access_group/access_group_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"access_model_names": [
"claude-haiku-5-5",
"claude-sonnet-5-5"
],
"assigned_team_ids": [
"team-support",
"team-success"
],
"description": "Models and MCP servers the support desk may use"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The access group after the change | application/json AccessGroupResponse |
| 400 | A team id in assigned_team_ids does not exist | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | Only proxy admins may change access groups, and only proxy admins and admin viewers may read them | application/json ErrorDetail |
| 404 | No access group has that id | application/json ErrorDetail |
| 409 | Another group already has that name | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway runs without a database | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
access_agent_ids | array of string | Yes | Access Agent Ids |
access_agents | array of AccessGroupResource | Yes | Access Agents |
access_group_id | string | Yes | Access Group Id |
access_group_name | string | Yes | Access Group Name |
access_mcp_server_ids | array of string | Yes | Access Mcp Server Ids |
access_mcp_servers | array of AccessGroupResource | Yes | Access Mcp Servers |
access_model_names | array of string | Yes | Access Model Names |
assigned_key_ids | array of string | Yes | Assigned Key Ids |
assigned_keys | array of AccessGroupResource | Yes | Assigned Keys |
assigned_team_ids | array of string | Yes | Assigned Team Ids |
assigned_teams | array of AccessGroupResource | Yes | Assigned Teams |
created_at | string | Yes | Created At |
created_by | string or null | No | Created By |
description | string or null | No | Description |
updated_at | string | Yes | Updated At |
updated_by | string or null | No | Updated By |
DELETE /v1/access_group/{access_group_id}
Delete an access group
Remove the group and detach it from every team, key and agent that used it. Those callers lose the group's models and servers on their next request. Proxy admins only. The deletion cannot be undone and is recorded in the audit log with the group as it was.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
access_group_id | path | string | Yes |
Example request:
curl -X DELETE "http://localhost:4000/v1/access_group/access_group_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 204 | The group was deleted and detached from every team, key and agent | |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | Only proxy admins may change access groups, and only proxy admins and admin viewers may read them | application/json ErrorDetail |
| 404 | No access group has that id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway runs without a database, or the delete failed for another reason and nothing was removed | application/json ErrorDetail |
| 503 | The database failed while the group was being deleted, nothing was removed | application/json ErrorDetail |
GET /v1/unified_access_group
List access groups (alias of /v1/access_group)
Every access group, newest first, with the names of the teams, keys, servers and agents it refers to. Use it to see who can reach which models and tools through a group. Proxy admins and admin viewers. Nothing is changed. This is the same operation as the matching /v1/access_group route.
Example request:
curl -X GET "http://localhost:4000/v1/unified_access_group" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Every access group, newest first | application/json array of AccessGroupResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | Only proxy admins may change access groups, and only proxy admins and admin viewers may read them | application/json ErrorDetail |
| 500 | The gateway runs without a database | application/json ErrorDetail |
POST /v1/unified_access_group
Create an access group (alias of /v1/access_group)
Create a named bundle of models, MCP servers and agents, and attach it to teams and keys. Members of an attached team, and attached keys, may use everything in the group without listing it on each key. Proxy admins only. The name must be unique, so a name already in use answers 409, and an unknown team id answers 400. The new group is recorded in the audit log. This is the same operation as the matching /v1/access_group route.
Request body (application/json, schema AccessGroupCreateRequest):
| Field | Type | Required | Description |
|---|---|---|---|
access_agent_ids | array of string or null | No | Agent ids the group grants |
access_group_name | string | Yes | A unique name for the group, for example support-tools |
access_mcp_server_ids | array of string or null | No | MCP server ids the group grants |
access_model_names | array of string or null | No | Model names the group grants |
assigned_key_ids | array of string or null | No | Virtual keys, by hashed token, that get it |
assigned_team_ids | array of string or null | No | Teams whose members get the group |
description | string or null | No | What the group is for, shown in the Admin UI |
Example request:
curl -X POST "http://localhost:4000/v1/unified_access_group" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"access_agent_ids": [
"agent-triage"
],
"access_group_name": "support-tools",
"access_mcp_server_ids": [
"mcp-ticketing"
],
"access_model_names": [
"claude-haiku-5-5"
],
"assigned_team_ids": [
"team-support"
],
"description": "Models and MCP servers the support desk may use"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 201 | The new access group | application/json AccessGroupResponse |
| 400 | A team id in assigned_team_ids does not exist | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | Only proxy admins may change access groups, and only proxy admins and admin viewers may read them | application/json ErrorDetail |
| 409 | Another group already has that name | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway runs without a database | application/json ErrorDetail |
GET /v1/unified_access_group/{access_group_id}
Get an access group (alias of /v1/access_group)
One access group with the names of the teams, keys, servers and agents it refers to. A name is null when the id no longer resolves. Proxy admins and admin viewers. Nothing is changed, and an unknown id answers 404. This is the same operation as the matching /v1/access_group route.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
access_group_id | path | string | Yes |
Example request:
curl -X GET "http://localhost:4000/v1/unified_access_group/access_group_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The access group | application/json AccessGroupResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | Only proxy admins may change access groups, and only proxy admins and admin viewers may read them | application/json ErrorDetail |
| 404 | No access group has that id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway runs without a database | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
access_agent_ids | array of string | Yes | Access Agent Ids |
access_agents | array of AccessGroupResource | Yes | Access Agents |
access_group_id | string | Yes | Access Group Id |
access_group_name | string | Yes | Access Group Name |
access_mcp_server_ids | array of string | Yes | Access Mcp Server Ids |
access_mcp_servers | array of AccessGroupResource | Yes | Access Mcp Servers |
access_model_names | array of string | Yes | Access Model Names |
assigned_key_ids | array of string | Yes | Assigned Key Ids |
assigned_keys | array of AccessGroupResource | Yes | Assigned Keys |
assigned_team_ids | array of string | Yes | Assigned Team Ids |
assigned_teams | array of AccessGroupResource | Yes | Assigned Teams |
created_at | string | Yes | Created At |
created_by | string or null | No | Created By |
description | string or null | No | Description |
updated_at | string | Yes | Updated At |
updated_by | string or null | No | Updated By |
PUT /v1/unified_access_group/{access_group_id}
Update an access group (alias of /v1/access_group)
Replace the fields sent and leave the others alone. Sending a list replaces that list, so send the full set of teams or keys you want attached. Teams and keys that are added or removed see the change on their next request. Proxy admins only. The change is recorded in the audit log, a new name already in use answers 409 and an unknown team id answers 400. This is the same operation as the matching /v1/access_group route.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
access_group_id | path | string | Yes |
Request body (application/json, schema AccessGroupUpdateRequest):
| Field | Type | Required | Description |
|---|---|---|---|
access_agent_ids | array of string or null | No | Replaces the granted agent ids |
access_group_name | string or null | No | A new unique name for the group |
access_mcp_server_ids | array of string or null | No | Replaces the granted MCP server ids |
access_model_names | array of string or null | No | Replaces the granted model names |
assigned_key_ids | array of string or null | No | Replaces the virtual keys that get the group |
assigned_team_ids | array of string or null | No | Replaces the teams that get the group |
description | string or null | No | What the group is for, shown in the Admin UI |
Example request:
curl -X PUT "http://localhost:4000/v1/unified_access_group/access_group_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"access_model_names": [
"claude-haiku-5-5",
"claude-sonnet-5-5"
],
"assigned_team_ids": [
"team-support",
"team-success"
],
"description": "Models and MCP servers the support desk may use"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The access group after the change | application/json AccessGroupResponse |
| 400 | A team id in assigned_team_ids does not exist | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | Only proxy admins may change access groups, and only proxy admins and admin viewers may read them | application/json ErrorDetail |
| 404 | No access group has that id | application/json ErrorDetail |
| 409 | Another group already has that name | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway runs without a database | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
access_agent_ids | array of string | Yes | Access Agent Ids |
access_agents | array of AccessGroupResource | Yes | Access Agents |
access_group_id | string | Yes | Access Group Id |
access_group_name | string | Yes | Access Group Name |
access_mcp_server_ids | array of string | Yes | Access Mcp Server Ids |
access_mcp_servers | array of AccessGroupResource | Yes | Access Mcp Servers |
access_model_names | array of string | Yes | Access Model Names |
assigned_key_ids | array of string | Yes | Assigned Key Ids |
assigned_keys | array of AccessGroupResource | Yes | Assigned Keys |
assigned_team_ids | array of string | Yes | Assigned Team Ids |
assigned_teams | array of AccessGroupResource | Yes | Assigned Teams |
created_at | string | Yes | Created At |
created_by | string or null | No | Created By |
description | string or null | No | Description |
updated_at | string | Yes | Updated At |
updated_by | string or null | No | Updated By |
DELETE /v1/unified_access_group/{access_group_id}
Delete an access group (alias of /v1/access_group)
Remove the group and detach it from every team, key and agent that used it. Those callers lose the group's models and servers on their next request. Proxy admins only. The deletion cannot be undone and is recorded in the audit log with the group as it was. This is the same operation as the matching /v1/access_group route.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
access_group_id | path | string | Yes |
Example request:
curl -X DELETE "http://localhost:4000/v1/unified_access_group/access_group_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 204 | The group was deleted and detached from every team, key and agent | |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | Only proxy admins may change access groups, and only proxy admins and admin viewers may read them | application/json ErrorDetail |
| 404 | No access group has that id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway runs without a database, or the delete failed for another reason and nothing was removed | application/json ErrorDetail |
| 503 | The database failed while the group was being deleted, nothing was removed | application/json ErrorDetail |