Skip to main content

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.

MethodPathSummary
GET/v1/access_groupList access groups
POST/v1/access_groupCreate 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_groupList access groups (alias of /v1/access_group)
POST/v1/unified_access_groupCreate 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:

StatusDescriptionBody
200Every access group, newest firstapplication/json array of AccessGroupResponse
401No valid key or Admin UI session was presentedapplication/json ProxyError
403Only proxy admins may change access groups, and only proxy admins and admin viewers may read themapplication/json ErrorDetail
500The gateway runs without a databaseapplication/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):

FieldTypeRequiredDescription
access_agent_idsarray of string or nullNoAgent ids the group grants
access_group_namestringYesA unique name for the group, for example support-tools
access_mcp_server_idsarray of string or nullNoMCP server ids the group grants
access_model_namesarray of string or nullNoModel names the group grants
assigned_key_idsarray of string or nullNoVirtual keys, by hashed token, that get it
assigned_team_idsarray of string or nullNoTeams whose members get the group
descriptionstring or nullNoWhat 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:

StatusDescriptionBody
201The new access groupapplication/json AccessGroupResponse
400A team id in assigned_team_ids does not existapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
403Only proxy admins may change access groups, and only proxy admins and admin viewers may read themapplication/json ErrorDetail
409Another group already has that nameapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway runs without a databaseapplication/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:

NameInTypeRequiredDescription
access_group_idpathstringYes

Example request:

curl -X GET "http://localhost:4000/v1/access_group/access_group_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200The access groupapplication/json AccessGroupResponse
401No valid key or Admin UI session was presentedapplication/json ProxyError
403Only proxy admins may change access groups, and only proxy admins and admin viewers may read themapplication/json ErrorDetail
404No access group has that idapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway runs without a databaseapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
access_agent_idsarray of stringYesAccess Agent Ids
access_agentsarray of AccessGroupResourceYesAccess Agents
access_group_idstringYesAccess Group Id
access_group_namestringYesAccess Group Name
access_mcp_server_idsarray of stringYesAccess Mcp Server Ids
access_mcp_serversarray of AccessGroupResourceYesAccess Mcp Servers
access_model_namesarray of stringYesAccess Model Names
assigned_key_idsarray of stringYesAssigned Key Ids
assigned_keysarray of AccessGroupResourceYesAssigned Keys
assigned_team_idsarray of stringYesAssigned Team Ids
assigned_teamsarray of AccessGroupResourceYesAssigned Teams
created_atstringYesCreated At
created_bystring or nullNoCreated By
descriptionstring or nullNoDescription
updated_atstringYesUpdated At
updated_bystring or nullNoUpdated 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:

NameInTypeRequiredDescription
access_group_idpathstringYes

Request body (application/json, schema AccessGroupUpdateRequest):

FieldTypeRequiredDescription
access_agent_idsarray of string or nullNoReplaces the granted agent ids
access_group_namestring or nullNoA new unique name for the group
access_mcp_server_idsarray of string or nullNoReplaces the granted MCP server ids
access_model_namesarray of string or nullNoReplaces the granted model names
assigned_key_idsarray of string or nullNoReplaces the virtual keys that get the group
assigned_team_idsarray of string or nullNoReplaces the teams that get the group
descriptionstring or nullNoWhat 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:

StatusDescriptionBody
200The access group after the changeapplication/json AccessGroupResponse
400A team id in assigned_team_ids does not existapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
403Only proxy admins may change access groups, and only proxy admins and admin viewers may read themapplication/json ErrorDetail
404No access group has that idapplication/json ErrorDetail
409Another group already has that nameapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway runs without a databaseapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
access_agent_idsarray of stringYesAccess Agent Ids
access_agentsarray of AccessGroupResourceYesAccess Agents
access_group_idstringYesAccess Group Id
access_group_namestringYesAccess Group Name
access_mcp_server_idsarray of stringYesAccess Mcp Server Ids
access_mcp_serversarray of AccessGroupResourceYesAccess Mcp Servers
access_model_namesarray of stringYesAccess Model Names
assigned_key_idsarray of stringYesAssigned Key Ids
assigned_keysarray of AccessGroupResourceYesAssigned Keys
assigned_team_idsarray of stringYesAssigned Team Ids
assigned_teamsarray of AccessGroupResourceYesAssigned Teams
created_atstringYesCreated At
created_bystring or nullNoCreated By
descriptionstring or nullNoDescription
updated_atstringYesUpdated At
updated_bystring or nullNoUpdated 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:

NameInTypeRequiredDescription
access_group_idpathstringYes

Example request:

curl -X DELETE "http://localhost:4000/v1/access_group/access_group_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
204The group was deleted and detached from every team, key and agent
401No valid key or Admin UI session was presentedapplication/json ProxyError
403Only proxy admins may change access groups, and only proxy admins and admin viewers may read themapplication/json ErrorDetail
404No access group has that idapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway runs without a database, or the delete failed for another reason and nothing was removedapplication/json ErrorDetail
503The database failed while the group was being deleted, nothing was removedapplication/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:

StatusDescriptionBody
200Every access group, newest firstapplication/json array of AccessGroupResponse
401No valid key or Admin UI session was presentedapplication/json ProxyError
403Only proxy admins may change access groups, and only proxy admins and admin viewers may read themapplication/json ErrorDetail
500The gateway runs without a databaseapplication/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):

FieldTypeRequiredDescription
access_agent_idsarray of string or nullNoAgent ids the group grants
access_group_namestringYesA unique name for the group, for example support-tools
access_mcp_server_idsarray of string or nullNoMCP server ids the group grants
access_model_namesarray of string or nullNoModel names the group grants
assigned_key_idsarray of string or nullNoVirtual keys, by hashed token, that get it
assigned_team_idsarray of string or nullNoTeams whose members get the group
descriptionstring or nullNoWhat 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:

StatusDescriptionBody
201The new access groupapplication/json AccessGroupResponse
400A team id in assigned_team_ids does not existapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
403Only proxy admins may change access groups, and only proxy admins and admin viewers may read themapplication/json ErrorDetail
409Another group already has that nameapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway runs without a databaseapplication/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:

NameInTypeRequiredDescription
access_group_idpathstringYes

Example request:

curl -X GET "http://localhost:4000/v1/unified_access_group/access_group_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200The access groupapplication/json AccessGroupResponse
401No valid key or Admin UI session was presentedapplication/json ProxyError
403Only proxy admins may change access groups, and only proxy admins and admin viewers may read themapplication/json ErrorDetail
404No access group has that idapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway runs without a databaseapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
access_agent_idsarray of stringYesAccess Agent Ids
access_agentsarray of AccessGroupResourceYesAccess Agents
access_group_idstringYesAccess Group Id
access_group_namestringYesAccess Group Name
access_mcp_server_idsarray of stringYesAccess Mcp Server Ids
access_mcp_serversarray of AccessGroupResourceYesAccess Mcp Servers
access_model_namesarray of stringYesAccess Model Names
assigned_key_idsarray of stringYesAssigned Key Ids
assigned_keysarray of AccessGroupResourceYesAssigned Keys
assigned_team_idsarray of stringYesAssigned Team Ids
assigned_teamsarray of AccessGroupResourceYesAssigned Teams
created_atstringYesCreated At
created_bystring or nullNoCreated By
descriptionstring or nullNoDescription
updated_atstringYesUpdated At
updated_bystring or nullNoUpdated 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:

NameInTypeRequiredDescription
access_group_idpathstringYes

Request body (application/json, schema AccessGroupUpdateRequest):

FieldTypeRequiredDescription
access_agent_idsarray of string or nullNoReplaces the granted agent ids
access_group_namestring or nullNoA new unique name for the group
access_mcp_server_idsarray of string or nullNoReplaces the granted MCP server ids
access_model_namesarray of string or nullNoReplaces the granted model names
assigned_key_idsarray of string or nullNoReplaces the virtual keys that get the group
assigned_team_idsarray of string or nullNoReplaces the teams that get the group
descriptionstring or nullNoWhat 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:

StatusDescriptionBody
200The access group after the changeapplication/json AccessGroupResponse
400A team id in assigned_team_ids does not existapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
403Only proxy admins may change access groups, and only proxy admins and admin viewers may read themapplication/json ErrorDetail
404No access group has that idapplication/json ErrorDetail
409Another group already has that nameapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway runs without a databaseapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
access_agent_idsarray of stringYesAccess Agent Ids
access_agentsarray of AccessGroupResourceYesAccess Agents
access_group_idstringYesAccess Group Id
access_group_namestringYesAccess Group Name
access_mcp_server_idsarray of stringYesAccess Mcp Server Ids
access_mcp_serversarray of AccessGroupResourceYesAccess Mcp Servers
access_model_namesarray of stringYesAccess Model Names
assigned_key_idsarray of stringYesAssigned Key Ids
assigned_keysarray of AccessGroupResourceYesAssigned Keys
assigned_team_idsarray of stringYesAssigned Team Ids
assigned_teamsarray of AccessGroupResourceYesAssigned Teams
created_atstringYesCreated At
created_bystring or nullNoCreated By
descriptionstring or nullNoDescription
updated_atstringYesUpdated At
updated_bystring or nullNoUpdated 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:

NameInTypeRequiredDescription
access_group_idpathstringYes

Example request:

curl -X DELETE "http://localhost:4000/v1/unified_access_group/access_group_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
204The group was deleted and detached from every team, key and agent
401No valid key or Admin UI session was presentedapplication/json ProxyError
403Only proxy admins may change access groups, and only proxy admins and admin viewers may read themapplication/json ErrorDetail
404No access group has that idapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway runs without a database, or the delete failed for another reason and nothing was removedapplication/json ErrorDetail
503The database failed while the group was being deleted, nothing was removedapplication/json ErrorDetail