Agents API
This page documents the 18 gateway endpoints tagged agents 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 | /agent/daily/activity | Show daily spend and usage per agent |
| GET | /v1/agents | List the agents the caller can reach |
| POST | /v1/agents | Register an agent |
| GET | /v1/agents/identity/providers | List the identity provider issuers an agent can be bound to |
| POST | /v1/agents/make_public | Set the list of public agents |
| GET | /v1/agents/{agent_id} | Read one agent |
| PUT | /v1/agents/{agent_id} | Replace an agent |
| PATCH | /v1/agents/{agent_id} | Change some fields of an agent |
| DELETE | /v1/agents/{agent_id} | Delete an agent |
| GET | /v1/agents/{agent_id}/credentials | List an agent's stored credentials |
| POST | /v1/agents/{agent_id}/credentials | Store a credential for an agent |
| PUT | /v1/agents/{agent_id}/credentials/suspension | Suspend or resume all of an agent's stored credentials |
| DELETE | /v1/agents/{agent_id}/credentials/{credential_id} | Delete an agent's stored credential |
| POST | /v1/agents/{agent_id}/credentials/{credential_id}/revoke | Revoke an agent's stored credential |
| POST | /v1/agents/{agent_id}/credentials/{credential_id}/rotate | Rotate an agent's stored credential |
| GET | /v1/agents/{agent_id}/identity | Read an agent's identity binding and execution mode |
| POST | /v1/agents/{agent_id}/kill_switch | Stop an agent with its kill switch |
| POST | /v1/agents/{agent_id}/make_public | Make one agent public |
Endpoints
GET /agent/daily/activity
Show daily spend and usage per agent
Shows spend, tokens and request counts per day for the agents in agent_ids (comma separated), or for every
agent the caller may see when it is left out, between start_date and end_date (YYYY-MM-DD). Filter further
by model or api_key, leave agents out with exclude_agent_ids, and page with page and page_size. Proxy
admins and admin viewers see every agent. Other keys are refused unless allowed_routes or a custom role grants
the route, and then see only the agents they own or may call. Read only, nothing changes.
Docs (https://docs.spanway.ai/docs/proxy/agent_activity)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
agent_ids | query | string or null | No | Comma separated agent ids. Leave it out for every agent you may see |
start_date | query | string or null | No | First day of the range, YYYY-MM-DD |
end_date | query | string or null | No | Last day of the range, YYYY-MM-DD |
model | query | string or null | No | Only count requests to this model |
api_key | query | string or null | No | Only count requests made with this key's hash |
page | query | integer | No | Page number, starting at 1 |
page_size | query | integer | No | Days per page |
exclude_agent_ids | query | string or null | No | Comma separated agent ids to leave out of the totals |
Example request:
curl -X GET "http://localhost:4000/agent/daily/activity" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Spend and tokens per day | application/json SpendAnalyticsPaginatedResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | Agents are turned off for internal users in the Admin UI settings | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway has no database connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
results | array of DailySpendData | Yes | Results |
metadata | DailySpendMetadata | No |
GET /v1/agents
List the agents the caller can reach
Lists the A2A agents registered on the gateway that the caller's key, team and access groups may call, with
their agent card, limits, spend and, for proxy admins, the keys bound to them. Any key may call it; secrets in
spanway_params are always redacted and keys and headers are shown to proxy admins only. Nothing changes.
Example usage:
curl -X GET "http://localhost:4000/v1/agents" -H "Content-Type: application/json" -H "Authorization: Bearer your-key" ```
Pass `?health_check=true` to filter out agents whose URL is unreachable:
```text
curl -X GET "http://localhost:4000/v1/agents?health_check=true" -H "Content-Type: application/json" -H "Authorization: Bearer your-key" ```
Pass `?query=<task>` to get the best matching agents ranked by semantic similarity:
```text
curl -X GET "http://localhost:4000/v1/agents?query=translate+a+PDF+document&top_k=5" -H "Content-Type: application/json" -H "Authorization: Bearer your-key" ```
Returns the list of agents the key can see.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
health_check | query | boolean | No | When true, performs a GET request to each agent's URL. Agents with reachable URLs (HTTP status < 500) and agents without a URL are returned; unreachable agents are filtered out. |
query | query | string or null | No | Describe the task in natural language to rank the agents you can reach by semantic similarity over their name, description, and skills. Each result carries a search_score. Requires spanway_settings.agent_search_embedding |
top_k | query | integer | No | With query: the maximum number of ranked agents to return. |
Example request:
curl -X GET "http://localhost:4000/v1/agents" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The agents the key can see | application/json array of AgentResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | Agents are turned off for internal users in the Admin UI settings | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | Reading the agents failed | application/json ErrorDetail |
POST /v1/agents
Register an agent
Registers an A2A agent on the gateway so teams can call it through /a2a/{agent_id} with gateway keys, limits,
logging and guardrails. When an agent card is sent, its URL is rewritten to point at the gateway. Proxy admins
only; governance controls such as identity or kill_switch also need the agent_governance license. The agent
is stored in the database, loaded on this replica and written to the audit log.
Example Request:
curl -X POST "http://localhost:4000/v1/agents" \
-H "Authorization: Bearer <your_api_key>" \
-H "Content-Type: application/json" \
-d '{
"agent_name": "my-custom-agent",
"agent_card_params": {
"protocolVersion": "1.0",
"name": "Hello World Agent",
"description": "Just a hello world agent",
"url": "http://localhost:9999/",
"version": "1.0.0",
"defaultInputModes": ["text"],
"defaultOutputModes": ["text"],
"capabilities": {
"streaming": true
},
"skills": [
{
"id": "hello_world",
"name": "Returns hello world",
"description": "just returns hello world",
"tags": ["hello world"],
"examples": ["hi", "hello world"]
}
]
},
"spanway_params": {
"make_public": true
}
}'
Request body (application/json, schema AgentConfig):
| Field | Type | Required | Description |
|---|---|---|---|
access_group_ids | array of string or null | No | Access Group Ids |
agent_card_params | AgentCard | No | The AgentCard is a self-describing manifest for an agent. |
agent_name | string | Yes | Agent Name |
enabled | boolean | No | Enabled |
execution_mode | enum: "autonomous", "delegated", "both" | No | Execution Mode |
extra_headers | array of string or null | No | Extra Headers |
identity | EntraIdentityConfig or OidcIdentityConfig or null | No | Identity |
kill_switch | AgentKillSwitchConfig or null | No | |
object_permission | AgentObjectPermission | No | |
rpm_limit | integer or null | No | Rpm Limit |
session_rpm_limit | integer or null | No | Session Rpm Limit |
session_tpm_limit | integer or null | No | Session Tpm Limit |
spanway_params | object | No | Spanway Params |
static_headers | object or null | No | Static Headers |
tpm_limit | integer or null | No | Tpm Limit |
Example request:
curl -X POST "http://localhost:4000/v1/agents" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"agent_card_params": {
"capabilities": {
"streaming": true
},
"defaultInputModes": [
"text"
],
"defaultOutputModes": [
"text"
],
"description": "Sorts incoming support tickets by product area and urgency.",
"name": "Support triage agent",
"protocolVersion": "1.0",
"skills": [
{
"description": "Labels a ticket with its product area and urgency",
"examples": [
"My invoice shows the wrong amount"
],
"id": "triage",
"name": "Triage a ticket",
"tags": [
"support"
]
}
],
"url": "https://agents.example.com/support-triage/",
"version": "1.2.0"
},
"agent_name": "support-triage",
"rpm_limit": 60,
"spanway_params": {
"model": "gpt-5.6"
},
"tpm_limit": 100000
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The registered agent | application/json AgentResponse |
| 400 | The agent card or identity is invalid, or the name is already taken | 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 a governance control was set without the agent_governance license | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway has no database connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
identity | AgentIdentityBinding or null | No | |
identity_managed | boolean | No | Identity Managed |
enabled | boolean | No | Enabled |
execution_mode | enum: "autonomous", "delegated", "both" | No | Execution Mode |
jwt_auth_configured | boolean | No | Jwt Auth Configured |
agent_id | string | Yes | Agent Id |
agent_name | string | Yes | Agent Name |
spanway_params | object or null | No | Spanway Params |
agent_card_params | object | Yes | Agent Card Params |
object_permission | object or null | No | Object Permission |
spend | number or null | No | Spend |
tpm_limit | integer or null | No | Tpm Limit |
rpm_limit | integer or null | No | Rpm Limit |
session_tpm_limit | integer or null | No | Session Tpm Limit |
session_rpm_limit | integer or null | No | Session Rpm Limit |
static_headers | object or null | No | Static Headers |
extra_headers | array of string or null | No | Extra Headers |
access_group_ids | array of string or null | No | Access Group Ids |
kill_switch | AgentKillSwitchConfig or null | No | |
keys | array of AgentKeySummary or null | No | Keys |
search_score | number or null | No | Search Score |
created_at | string or null | No | Created At |
updated_at | string or null | No | Updated At |
created_by | string or null | No | Created By |
updated_by | string or null | No | Updated By |
GET /v1/agents/identity/providers
List the identity provider issuers an agent can be bound to
The issuers a registered agent may be bound to through its identity field.
An issuer qualifies when enable_jwt_auth is on and either its spanway_jwtauth.issuers entry carries an
audience without disable_audience_validation, or it is the gateway-wide JWT_ISSUER with JWT_AUDIENCE
set. The Agents page reads this list to fill the Trusted Entra Tenant dropdown. Proxy admin only.
Docs (https://docs.spanway.ai/docs/proxy/agent_identity_providers)
Example request:
curl -X GET "http://localhost:4000/v1/agents/identity/providers" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The trusted issuers, empty when JWT auth is off or no issuer validates an audience | application/json array of string |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller is not a proxy admin, or the license lacks the agent_governance feature |
POST /v1/agents/make_public
Set the list of public agents
Replaces the public agent list with exactly the agents sent, so agents left out stop being public. The AI hub at
/public/agent_hub shows the agent cards of these agents. Proxy admins only. The list is saved to the
gateway config and the change is written to the audit log with the old and new lists.
Example Request:
curl -X POST "http://localhost:4000/v1/agents/make_public" \
-H "Authorization: Bearer <your_api_key>" \
-H "Content-Type: application/json" \
-d '{
"agent_ids": ["123e4567-e89b-12d3-a456-426614174000", "123e4567-e89b-12d3-a456-426614174001"]
}'
Request body (application/json, schema MakeAgentsPublicRequest):
| Field | Type | Required | Description |
|---|---|---|---|
agent_ids | array of string | Yes | Agent Ids |
Example request:
curl -X POST "http://localhost:4000/v1/agents/make_public" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"agent_ids": [
"123e4567-e89b-12d3-a456-426614174000"
]
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The public agent list after the change | application/json AgentMakePublicResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | Only proxy admins can change which agents are public | application/json ErrorDetail |
| 404 | No agent has this id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway has no database connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
message | string | Yes | Message |
public_agent_groups | array of string | Yes | Public Agent Groups |
updated_by | string | Yes | Updated By |
GET /v1/agents/{agent_id}
Read one agent
Shows one registered agent with its agent card, limits and spend. Admins see any agent; other keys only see
agents their key, team or access groups may call, and get 404 for agents they cannot see. Secrets in
spanway_params are redacted. Nothing changes.
Example Request:
curl -X GET "http://localhost:4000/v1/agents/123e4567-e89b-12d3-a456-426614174000" \
-H "Authorization: Bearer <your_api_key>"
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
agent_id | path | string | Yes |
Example request:
curl -X GET "http://localhost:4000/v1/agents/agent_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The agent | application/json AgentResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller's key or team may not call this agent | application/json ErrorDetail |
| 404 | No agent has this id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway has no database connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
identity | AgentIdentityBinding or null | No | |
identity_managed | boolean | No | Identity Managed |
enabled | boolean | No | Enabled |
execution_mode | enum: "autonomous", "delegated", "both" | No | Execution Mode |
jwt_auth_configured | boolean | No | Jwt Auth Configured |
agent_id | string | Yes | Agent Id |
agent_name | string | Yes | Agent Name |
spanway_params | object or null | No | Spanway Params |
agent_card_params | object | Yes | Agent Card Params |
object_permission | object or null | No | Object Permission |
spend | number or null | No | Spend |
tpm_limit | integer or null | No | Tpm Limit |
rpm_limit | integer or null | No | Rpm Limit |
session_tpm_limit | integer or null | No | Session Tpm Limit |
session_rpm_limit | integer or null | No | Session Rpm Limit |
static_headers | object or null | No | Static Headers |
extra_headers | array of string or null | No | Extra Headers |
access_group_ids | array of string or null | No | Access Group Ids |
kill_switch | AgentKillSwitchConfig or null | No | |
keys | array of AgentKeySummary or null | No | Keys |
search_score | number or null | No | Search Score |
created_at | string or null | No | Created At |
updated_at | string or null | No | Updated At |
created_by | string or null | No | Created By |
updated_by | string or null | No | Updated By |
PUT /v1/agents/{agent_id}
Replace an agent
Replaces an agent's whole definition with the body, so fields left out go back to their defaults; use PATCH to change single fields. Proxy admins only, and governance controls need the agent_governance license. The change is stored, reloaded on this replica and written to the audit log with the before and after values.
Example Request:
curl -X PUT "http://localhost:4000/v1/agents/123e4567-e89b-12d3-a456-426614174000" \
-H "Authorization: Bearer <your_api_key>" \
-H "Content-Type: application/json" \
-d '{
"agent_name": "updated-agent",
"agent_card_params": {
"protocolVersion": "1.0",
"name": "Updated Agent",
"description": "Updated description",
"url": "http://localhost:9999/",
"version": "1.1.0",
"defaultInputModes": ["text"],
"defaultOutputModes": ["text"],
"capabilities": {
"streaming": true
},
"skills": []
},
"spanway_params": {
"make_public": false
}
}'
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
agent_id | path | string | Yes |
Request body (application/json, schema AgentConfig):
| Field | Type | Required | Description |
|---|---|---|---|
access_group_ids | array of string or null | No | Access Group Ids |
agent_card_params | AgentCard | No | The AgentCard is a self-describing manifest for an agent. |
agent_name | string | Yes | Agent Name |
enabled | boolean | No | Enabled |
execution_mode | enum: "autonomous", "delegated", "both" | No | Execution Mode |
extra_headers | array of string or null | No | Extra Headers |
identity | EntraIdentityConfig or OidcIdentityConfig or null | No | Identity |
kill_switch | AgentKillSwitchConfig or null | No | |
object_permission | AgentObjectPermission | No | |
rpm_limit | integer or null | No | Rpm Limit |
session_rpm_limit | integer or null | No | Session Rpm Limit |
session_tpm_limit | integer or null | No | Session Tpm Limit |
spanway_params | object | No | Spanway Params |
static_headers | object or null | No | Static Headers |
tpm_limit | integer or null | No | Tpm Limit |
Example request:
curl -X PUT "http://localhost:4000/v1/agents/agent_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"agent_card_params": {
"capabilities": {
"streaming": true
},
"defaultInputModes": [
"text"
],
"defaultOutputModes": [
"text"
],
"description": "Sorts incoming support tickets by product area and urgency.",
"name": "Support triage agent",
"protocolVersion": "1.0",
"skills": [
{
"description": "Labels a ticket with its product area and urgency",
"examples": [
"My invoice shows the wrong amount"
],
"id": "triage",
"name": "Triage a ticket",
"tags": [
"support"
]
}
],
"url": "https://agents.example.com/support-triage/",
"version": "1.2.0"
},
"agent_name": "support-triage",
"rpm_limit": 60,
"spanway_params": {
"model": "gpt-5.6"
},
"tpm_limit": 100000
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The agent after the update | application/json AgentResponse |
| 400 | The agent card or identity is invalid, or the name is already taken | 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 a governance control was set without the agent_governance license | application/json ErrorDetail |
| 404 | No agent has this id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway has no database connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
identity | AgentIdentityBinding or null | No | |
identity_managed | boolean | No | Identity Managed |
enabled | boolean | No | Enabled |
execution_mode | enum: "autonomous", "delegated", "both" | No | Execution Mode |
jwt_auth_configured | boolean | No | Jwt Auth Configured |
agent_id | string | Yes | Agent Id |
agent_name | string | Yes | Agent Name |
spanway_params | object or null | No | Spanway Params |
agent_card_params | object | Yes | Agent Card Params |
object_permission | object or null | No | Object Permission |
spend | number or null | No | Spend |
tpm_limit | integer or null | No | Tpm Limit |
rpm_limit | integer or null | No | Rpm Limit |
session_tpm_limit | integer or null | No | Session Tpm Limit |
session_rpm_limit | integer or null | No | Session Rpm Limit |
static_headers | object or null | No | Static Headers |
extra_headers | array of string or null | No | Extra Headers |
access_group_ids | array of string or null | No | Access Group Ids |
kill_switch | AgentKillSwitchConfig or null | No | |
keys | array of AgentKeySummary or null | No | Keys |
search_score | number or null | No | Search Score |
created_at | string or null | No | Created At |
updated_at | string or null | No | Updated At |
created_by | string or null | No | Created By |
updated_by | string or null | No | Updated By |
PATCH /v1/agents/{agent_id}
Change some fields of an agent
Changes only the fields sent in the body and keeps every other field of the agent, for example to raise a rate limit or re-enable an agent after a kill switch. Proxy admins only, and governance controls need the agent_governance license. The change is stored, reloaded on this replica and written to the audit log.
Example Request:
curl -X PATCH "http://localhost:4000/v1/agents/123e4567-e89b-12d3-a456-426614174000" \
-H "Authorization: Bearer <your_api_key>" \
-H "Content-Type: application/json" \
-d '{
"agent_name": "updated-agent",
"agent_card_params": {
"protocolVersion": "1.0",
"name": "Updated Agent",
"description": "Updated description",
"url": "http://localhost:9999/",
"version": "1.1.0",
"defaultInputModes": ["text"],
"defaultOutputModes": ["text"],
"capabilities": {
"streaming": true
},
"skills": []
},
"spanway_params": {
"make_public": false
}
}'
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
agent_id | path | string | Yes |
Request body (application/json, schema PatchAgentRequest):
| Field | Type | Required | Description |
|---|---|---|---|
access_group_ids | array of string or null | No | Access Group Ids |
agent_card_params | AgentCard | No | The AgentCard is a self-describing manifest for an agent. |
agent_name | string | No | Agent Name |
enabled | boolean | No | Enabled |
execution_mode | enum: "autonomous", "delegated", "both" | No | Execution Mode |
extra_headers | array of string or null | No | Extra Headers |
identity | EntraIdentityConfig or OidcIdentityConfig or null | No | Identity |
kill_switch | AgentKillSwitchConfig or null | No | |
object_permission | AgentObjectPermission | No | |
rpm_limit | integer or null | No | Rpm Limit |
session_rpm_limit | integer or null | No | Session Rpm Limit |
session_tpm_limit | integer or null | No | Session Tpm Limit |
spanway_params | object | No | Spanway Params |
static_headers | object or null | No | Static Headers |
tpm_limit | integer or null | No | Tpm Limit |
Example request:
curl -X PATCH "http://localhost:4000/v1/agents/agent_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"enabled": true,
"rpm_limit": 120
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The agent after the update | application/json AgentResponse |
| 400 | The agent card or identity is invalid, or the name is already taken | 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 a governance control was set without the agent_governance license | application/json ErrorDetail |
| 404 | No agent has this id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway has no database connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
identity | AgentIdentityBinding or null | No | |
identity_managed | boolean | No | Identity Managed |
enabled | boolean | No | Enabled |
execution_mode | enum: "autonomous", "delegated", "both" | No | Execution Mode |
jwt_auth_configured | boolean | No | Jwt Auth Configured |
agent_id | string | Yes | Agent Id |
agent_name | string | Yes | Agent Name |
spanway_params | object or null | No | Spanway Params |
agent_card_params | object | Yes | Agent Card Params |
object_permission | object or null | No | Object Permission |
spend | number or null | No | Spend |
tpm_limit | integer or null | No | Tpm Limit |
rpm_limit | integer or null | No | Rpm Limit |
session_tpm_limit | integer or null | No | Session Tpm Limit |
session_rpm_limit | integer or null | No | Session Rpm Limit |
static_headers | object or null | No | Static Headers |
extra_headers | array of string or null | No | Extra Headers |
access_group_ids | array of string or null | No | Access Group Ids |
kill_switch | AgentKillSwitchConfig or null | No | |
keys | array of AgentKeySummary or null | No | Keys |
search_score | number or null | No | Search Score |
created_at | string or null | No | Created At |
updated_at | string or null | No | Updated At |
created_by | string or null | No | Created By |
updated_by | string or null | No | Updated By |
DELETE /v1/agents/{agent_id}
Delete an agent
Deletes a registered agent from the database and unloads it from this replica, so calls to it stop. Keys bound to an agent whose identity the gateway manages are deleted with it. Proxy admins only. The deleted definition is written to the audit log.
Example Request:
curl -X DELETE "http://localhost:4000/v1/agents/123e4567-e89b-12d3-a456-426614174000" \
-H "Authorization: Bearer <your_api_key>"
Example Response:
{
"message": "Agent 123e4567-e89b-12d3-a456-426614174000 deleted successfully"
}
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
agent_id | path | string | Yes |
Example request:
curl -X DELETE "http://localhost:4000/v1/agents/agent_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The agent is gone | application/json AgentDeletedResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller is not a proxy admin, or a governance control was set without the agent_governance license | application/json ErrorDetail |
| 404 | No agent row has this id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway has no database connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
message | string | Yes | Confirms which agent was deleted |
GET /v1/agents/{agent_id}/credentials
List an agent's stored credentials
List the MCP and SaaS credentials stored for an agent, without their secrets, and whether an admin has suspended all of them. Proxy admins and admin viewers only.
Docs (https://docs.spanway.ai/docs/proxy/agent_credentials)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
agent_id | path | string | Yes | The agent's agent_id |
Example request:
curl -X GET "http://localhost:4000/v1/agents/agent_id-123/credentials" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The agent's credentials, never their secrets | application/json AgentCredentialList |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller is not a proxy admin or admin viewer, or the license lacks the agent_governance feature | application/json ErrorDetail |
| 404 | No agent with this id is stored in the database. Agents defined only in config.yaml cannot hold credentials | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | Stored agent credentials need a connected database | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
agent_id | string | Yes | Agent Id |
credentials | array of AgentCredential | Yes | Credentials |
suspension | AgentCredentialSuspension | Yes |
POST /v1/agents/{agent_id}/credentials
Store a credential for an agent
Store an API key or token that belongs to this agent. An mcp_server credential is sent by the gateway in place of the MCP server's own secret whenever this agent calls one of that server's tools. A saas credential is handed to the agent when it exchanges its identity provider token at POST /token with the credential name as audience. The secret is encrypted at rest and never returned. Proxy admin only.
Docs (https://docs.spanway.ai/docs/proxy/agent_credentials)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
agent_id | path | string | Yes | The agent's agent_id |
Request body (application/json, schema AgentCredentialCreate):
| Field | Type | Required | Description |
|---|---|---|---|
description | string or null | No | Description |
expires_at | string or null | No | After this time the credential is not used |
kind | enum: "mcp_server", "saas" | Yes | mcp_server: the gateway sends it to an MCP server. saas: the agent fetches it with its token |
mcp_server_id | string or null | No | The MCP server id, required when kind is mcp_server |
name | string | Yes | A short name the agent asks for, unique per agent, such as crm-api |
secret | string | Yes | The API key or token. Stored encrypted, admins never see it again |
Example request:
curl -X POST "http://localhost:4000/v1/agents/agent_id-123/credentials" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"description": "CRM read access for the support agent",
"expires_at": "2027-01-31T00:00:00Z",
"kind": "saas",
"name": "crm-api",
"secret": "crm-live-0d2c6f1e9b7a4c3d9f3a"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The stored record | application/json AgentCredential |
| 400 | The MCP server does not exist or does not take a static secret | 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 the license lacks the agent_governance feature | application/json ErrorDetail |
| 404 | No agent with this id is stored in the database. Agents defined only in config.yaml cannot hold credentials | application/json ErrorDetail |
| 409 | The agent already has a credential with that name or for that MCP server | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | Stored agent credentials need a connected database | application/json ErrorDetail |
| 503 | The gateway has no salt key or master key to encrypt the secret with | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
agent_id | string | Yes | Agent Id |
created_at | string | Yes | Created At |
created_by | string or null | No | Created By |
credential_id | string | Yes | Credential Id |
description | string or null | No | Description |
expires_at | string or null | No | Expires At |
kind | enum: "mcp_server", "saas" | Yes | Kind |
last_used_at | string or null | No | Last Used At |
mcp_server_id | string or null | No | Mcp Server Id |
name | string | Yes | Name |
revoke_reason | string or null | No | Revoke Reason |
revoked_at | string or null | No | Revoked At |
revoked_by | string or null | No | Revoked By |
rotated_at | string or null | No | Rotated At |
secret_hint | string or null | No | The last four characters of a long secret |
status | enum: "active", "revoked" | Yes | Status |
updated_at | string | Yes | Updated At |
updated_by | string or null | No | Updated By |
version | integer | Yes | Starts at 1 and goes up by one on every rotation |
PUT /v1/agents/{agent_id}/credentials/suspension
Suspend or resume all of an agent's stored credentials
The agent-wide kill switch for stored credentials. While suspended, every call that would use one of the agent's stored credentials is refused, and the agent cannot exchange its token for any of them. The credentials themselves are kept, so resuming restores them as they were. Proxy admin only.
Docs (https://docs.spanway.ai/docs/proxy/agent_credentials)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
agent_id | path | string | Yes | The agent's agent_id |
Request body (application/json, schema AgentCredentialSuspensionWrite):
| Field | Type | Required | Description |
|---|---|---|---|
reason | string or null | No | Why, shown to other admins |
suspended | boolean | Yes | true stops every stored credential of the agent, false resumes them |
Example request:
curl -X PUT "http://localhost:4000/v1/agents/agent_id-123/credentials/suspension" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"reason": "agent is under review",
"suspended": true
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The suspension state after the change | application/json AgentCredentialSuspension |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller is not a proxy admin, or the license lacks the agent_governance feature | application/json ErrorDetail |
| 404 | No agent with this id is stored in the database. Agents defined only in config.yaml cannot hold credentials | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | Stored agent credentials need a connected database | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
reason | string or null | No | Reason |
suspended | boolean | Yes | Suspended |
suspended_at | string or null | No | Suspended At |
suspended_by | string or null | No | Suspended By |
DELETE /v1/agents/{agent_id}/credentials/{credential_id}
Delete an agent's stored credential
Delete a stored credential and its record. Afterwards the agent's calls to that MCP server use the server's own secret again. Proxy admin only.
Docs (https://docs.spanway.ai/docs/proxy/agent_credentials)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
agent_id | path | string | Yes | The agent's agent_id |
credential_id | path | string | Yes | The credential id |
Example request:
curl -X DELETE "http://localhost:4000/v1/agents/agent_id-123/credentials/credential_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | What was deleted | application/json AgentCredentialDeleted |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller is not a proxy admin, or the license lacks the agent_governance feature | application/json ErrorDetail |
| 404 | The agent or the credential does not exist | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | Stored agent credentials need a connected database | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
agent_id | string | Yes | Agent Id |
credential_id | string | Yes | Credential Id |
POST /v1/agents/{agent_id}/credentials/{credential_id}/revoke
Revoke an agent's stored credential
Stop using a stored credential at once and erase its secret from the database. Calls that need it are refused instead of falling back to a shared secret. Rotate it later to put it back in service. Proxy admin only.
Docs (https://docs.spanway.ai/docs/proxy/agent_credentials)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
agent_id | path | string | Yes | The agent's agent_id |
credential_id | path | string | Yes | The credential id |
Request body (application/json, AgentCredentialRevoke or null):
Example request:
curl -X POST "http://localhost:4000/v1/agents/agent_id-123/credentials/credential_id-123/revoke" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"reason": "key posted in a public channel"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The record after the revocation | application/json AgentCredential |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller is not a proxy admin, or the license lacks the agent_governance feature | application/json ErrorDetail |
| 404 | The agent or the credential does not exist | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | Stored agent credentials need a connected database | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
agent_id | string | Yes | Agent Id |
created_at | string | Yes | Created At |
created_by | string or null | No | Created By |
credential_id | string | Yes | Credential Id |
description | string or null | No | Description |
expires_at | string or null | No | Expires At |
kind | enum: "mcp_server", "saas" | Yes | Kind |
last_used_at | string or null | No | Last Used At |
mcp_server_id | string or null | No | Mcp Server Id |
name | string | Yes | Name |
revoke_reason | string or null | No | Revoke Reason |
revoked_at | string or null | No | Revoked At |
revoked_by | string or null | No | Revoked By |
rotated_at | string or null | No | Rotated At |
secret_hint | string or null | No | The last four characters of a long secret |
status | enum: "active", "revoked" | Yes | Status |
updated_at | string | Yes | Updated At |
updated_by | string or null | No | Updated By |
version | integer | Yes | Starts at 1 and goes up by one on every rotation |
POST /v1/agents/{agent_id}/credentials/{credential_id}/rotate
Rotate an agent's stored credential
Replace the secret of a stored credential. The old secret stops being used at once and the version goes up by one. Rotating a revoked credential puts it back in service with the new secret. Proxy admin only.
Docs (https://docs.spanway.ai/docs/proxy/agent_credentials)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
agent_id | path | string | Yes | The agent's agent_id |
credential_id | path | string | Yes | The credential id |
Request body (application/json, schema AgentCredentialRotate):
| Field | Type | Required | Description |
|---|---|---|---|
expires_at | string or null | No | When the new secret stops being used |
secret | string | Yes | The new API key or token. The old one stops working at once |
Example request:
curl -X POST "http://localhost:4000/v1/agents/agent_id-123/credentials/credential_id-123/rotate" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"expires_at": "2027-01-31T00:00:00Z",
"secret": "crm-live-7a1b2c3d4e5f6a7b9f3a"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The record after the rotation | application/json AgentCredential |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller is not a proxy admin, or the license lacks the agent_governance feature | application/json ErrorDetail |
| 404 | The agent or the credential does not exist | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | Stored agent credentials need a connected database | application/json ErrorDetail |
| 503 | The gateway has no salt key or master key to encrypt the secret with | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
agent_id | string | Yes | Agent Id |
created_at | string | Yes | Created At |
created_by | string or null | No | Created By |
credential_id | string | Yes | Credential Id |
description | string or null | No | Description |
expires_at | string or null | No | Expires At |
kind | enum: "mcp_server", "saas" | Yes | Kind |
last_used_at | string or null | No | Last Used At |
mcp_server_id | string or null | No | Mcp Server Id |
name | string | Yes | Name |
revoke_reason | string or null | No | Revoke Reason |
revoked_at | string or null | No | Revoked At |
revoked_by | string or null | No | Revoked By |
rotated_at | string or null | No | Rotated At |
secret_hint | string or null | No | The last four characters of a long secret |
status | enum: "active", "revoked" | Yes | Status |
updated_at | string | Yes | Updated At |
updated_by | string or null | No | Updated By |
version | integer | Yes | Starts at 1 and goes up by one on every rotation |
GET /v1/agents/{agent_id}/identity
Read an agent's identity binding and execution mode
The identity binding of one agent: the provider, tenant, application and issuer it is bound to, whether the binding is active, the execution mode, and when a token from that application last authenticated. Proxy admin only.
Docs (https://docs.spanway.ai/docs/proxy/agent_identity_providers)
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
agent_id | path | string | Yes |
Example request:
curl -X GET "http://localhost:4000/v1/agents/agent_id-123/identity" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The binding, whether it is active, the execution mode and when the agent last authenticated | application/json ManagedAgentIdentityStatus |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller is not a proxy admin, or the license lacks the agent_governance feature | |
| 404 | No agent with this id. Use the agent_id from the create answer, not its name | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 503 | The agent policy could not be read from the database | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
enabled | boolean | No | Enabled |
execution_mode | enum: "autonomous", "delegated", "both" | No | Execution Mode |
identity | AgentIdentityBinding or null | No | |
identity_managed | boolean | No | Identity Managed |
last_authenticated_at | string or null | No | Last Authenticated At |
POST /v1/agents/{agent_id}/kill_switch
Stop an agent with its kill switch
Stop an agent at the gateway. Proxy admin only.
The agent is disabled, every key bound to it is blocked (key_action: "block", the default) or deleted
(key_action: "delete"), its keys are evicted from the auth cache, and its workflow runner steps stop.
Gateway-hosted custom agents stop before their next model or tool call. Only after that local halt is the
agent's kill_switch webhook called, when one is configured, and its result is reported in webhook, so a
failing webhook never leaves the agent running. When the agent row cannot be disabled, because it is a
config.yaml agent or because the database step failed, the response says durable: false and the agent is held
disabled on this replica only, across registry reloads, until the replica restarts or the agent is re-enabled
through it. A failed database step is named in store_error, and the workflow stop and the webhook still run.
Restore with PATCH /v1/agents/{agent_id} setting enabled: true and /key/unblock for each hash in
affected_tokens, and release workflow runs with POST /v1/workflows/runner/agents/{agent_id}/release. The
halt is written to the audit log as one kill_switch_fired row on the agent and one blocked or deleted
row per key.
Example Request:
curl -X POST "http://localhost:4000/v1/agents/123e4567-e89b-12d3-a456-426614174000/kill_switch" \
-H "Authorization: Bearer <your_api_key>" \
-H "Content-Type: application/json" \
-d '{"key_action": "block", "reason": "leaking data"}'
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
agent_id | path | string | Yes |
Request body (application/json, AgentHaltRequest or null):
Example request:
curl -X POST "http://localhost:4000/v1/agents/agent_id-123/kill_switch" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"key_action": "block",
"reason": "leaking data"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | What the switch stopped and what the webhook answered | application/json AgentKillSwitchOutcome |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller is not a proxy admin, or the license lacks agent_governance | application/json ErrorDetail |
| 404 | No agent has this id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
affected_tokens | array of string | Yes | Hashed keys the switch blocked or deleted. |
agent_id | string | Yes | Agent Id |
durable | boolean | Yes | False when the agent row could not be disabled, either because it is a config.yaml agent or because the database step failed (see store_error). The agent is then held disabled on this replica only, across registry relo |
failed_tokens | array of string | No | Hashed keys the switch could not delete. |
halted_workflow_runs | integer or null | Yes | None when the workflow runner halt failed. |
key_action | enum: "block", "delete" | Yes | Key Action |
reason | string or null | No | Reason |
store_error | enum: "agent_halt_store_unavailable", "agent_key_delete_failed" or null | No | Set when the database step failed. agent_halt_store_unavailable means no key was blocked or deleted. agent_key_delete_failed means the key delete stopped part way, so every bound key is listed in failed_tokens and |
webhook | AgentKillSwitchResult or null | No |
POST /v1/agents/{agent_id}/make_public
Make one agent public
Adds one agent to the public agent list, so the AI hub at /public/agent_hub shows its agent card to developers
looking for agents to call. Proxy admins only. The list is saved to the gateway config and the change is
written to the audit log.
Example Request:
curl -X POST "http://localhost:4000/v1/agents/123e4567-e89b-12d3-a456-426614174000/make_public" \
-H "Authorization: Bearer <your_api_key>" \
-H "Content-Type: application/json"
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
agent_id | path | string | Yes |
Request body (application/json, object):
Example request:
curl -X POST "http://localhost:4000/v1/agents/agent_id-123/make_public" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The public agent list after the change | application/json AgentMakePublicResponse |
| 400 | The agent is already public | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | Only proxy admins can change which agents are public | application/json ErrorDetail |
| 404 | No agent has this id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway has no database connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
message | string | Yes | Message |
public_agent_groups | array of string | Yes | Public Agent Groups |
updated_by | string | Yes | Updated By |