Skip to main content

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.

MethodPathSummary
GET/agent/daily/activityShow daily spend and usage per agent
GET/v1/agentsList the agents the caller can reach
POST/v1/agentsRegister an agent
GET/v1/agents/identity/providersList the identity provider issuers an agent can be bound to
POST/v1/agents/make_publicSet 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}/credentialsList an agent's stored credentials
POST/v1/agents/{agent_id}/credentialsStore a credential for an agent
PUT/v1/agents/{agent_id}/credentials/suspensionSuspend 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}/revokeRevoke an agent's stored credential
POST/v1/agents/{agent_id}/credentials/{credential_id}/rotateRotate an agent's stored credential
GET/v1/agents/{agent_id}/identityRead an agent's identity binding and execution mode
POST/v1/agents/{agent_id}/kill_switchStop an agent with its kill switch
POST/v1/agents/{agent_id}/make_publicMake 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:

NameInTypeRequiredDescription
agent_idsquerystring or nullNoComma separated agent ids. Leave it out for every agent you may see
start_datequerystring or nullNoFirst day of the range, YYYY-MM-DD
end_datequerystring or nullNoLast day of the range, YYYY-MM-DD
modelquerystring or nullNoOnly count requests to this model
api_keyquerystring or nullNoOnly count requests made with this key's hash
pagequeryintegerNoPage number, starting at 1
page_sizequeryintegerNoDays per page
exclude_agent_idsquerystring or nullNoComma 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:

StatusDescriptionBody
200Spend and tokens per dayapplication/json SpendAnalyticsPaginatedResponse
401No valid key or Admin UI session was presentedapplication/json ProxyError
403Agents are turned off for internal users in the Admin UI settingsapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway has no database connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
resultsarray of DailySpendDataYesResults
metadataDailySpendMetadataNo

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:

NameInTypeRequiredDescription
health_checkquerybooleanNoWhen 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.
queryquerystring or nullNoDescribe 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_kqueryintegerNoWith 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:

StatusDescriptionBody
200The agents the key can seeapplication/json array of AgentResponse
401No valid key or Admin UI session was presentedapplication/json ProxyError
403Agents are turned off for internal users in the Admin UI settingsapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500Reading the agents failedapplication/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):

FieldTypeRequiredDescription
access_group_idsarray of string or nullNoAccess Group Ids
agent_card_paramsAgentCardNoThe AgentCard is a self-describing manifest for an agent.
agent_namestringYesAgent Name
enabledbooleanNoEnabled
execution_modeenum: "autonomous", "delegated", "both"NoExecution Mode
extra_headersarray of string or nullNoExtra Headers
identityEntraIdentityConfig or OidcIdentityConfig or nullNoIdentity
kill_switchAgentKillSwitchConfig or nullNo
object_permissionAgentObjectPermissionNo
rpm_limitinteger or nullNoRpm Limit
session_rpm_limitinteger or nullNoSession Rpm Limit
session_tpm_limitinteger or nullNoSession Tpm Limit
spanway_paramsobjectNoSpanway Params
static_headersobject or nullNoStatic Headers
tpm_limitinteger or nullNoTpm 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:

StatusDescriptionBody
200The registered agentapplication/json AgentResponse
400The agent card or identity is invalid, or the name is already takenapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller is not a proxy admin, or a governance control was set without the agent_governance licenseapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway has no database connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
identityAgentIdentityBinding or nullNo
identity_managedbooleanNoIdentity Managed
enabledbooleanNoEnabled
execution_modeenum: "autonomous", "delegated", "both"NoExecution Mode
jwt_auth_configuredbooleanNoJwt Auth Configured
agent_idstringYesAgent Id
agent_namestringYesAgent Name
spanway_paramsobject or nullNoSpanway Params
agent_card_paramsobjectYesAgent Card Params
object_permissionobject or nullNoObject Permission
spendnumber or nullNoSpend
tpm_limitinteger or nullNoTpm Limit
rpm_limitinteger or nullNoRpm Limit
session_tpm_limitinteger or nullNoSession Tpm Limit
session_rpm_limitinteger or nullNoSession Rpm Limit
static_headersobject or nullNoStatic Headers
extra_headersarray of string or nullNoExtra Headers
access_group_idsarray of string or nullNoAccess Group Ids
kill_switchAgentKillSwitchConfig or nullNo
keysarray of AgentKeySummary or nullNoKeys
search_scorenumber or nullNoSearch Score
created_atstring or nullNoCreated At
updated_atstring or nullNoUpdated At
created_bystring or nullNoCreated By
updated_bystring or nullNoUpdated 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:

StatusDescriptionBody
200The trusted issuers, empty when JWT auth is off or no issuer validates an audienceapplication/json array of string
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The 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):

FieldTypeRequiredDescription
agent_idsarray of stringYesAgent 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:

StatusDescriptionBody
200The public agent list after the changeapplication/json AgentMakePublicResponse
401No valid key or Admin UI session was presentedapplication/json ProxyError
403Only proxy admins can change which agents are publicapplication/json ErrorDetail
404No agent has this idapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway has no database connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
messagestringYesMessage
public_agent_groupsarray of stringYesPublic Agent Groups
updated_bystringYesUpdated 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:

NameInTypeRequiredDescription
agent_idpathstringYes

Example request:

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

Responses:

StatusDescriptionBody
200The agentapplication/json AgentResponse
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller's key or team may not call this agentapplication/json ErrorDetail
404No agent has this idapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway has no database connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
identityAgentIdentityBinding or nullNo
identity_managedbooleanNoIdentity Managed
enabledbooleanNoEnabled
execution_modeenum: "autonomous", "delegated", "both"NoExecution Mode
jwt_auth_configuredbooleanNoJwt Auth Configured
agent_idstringYesAgent Id
agent_namestringYesAgent Name
spanway_paramsobject or nullNoSpanway Params
agent_card_paramsobjectYesAgent Card Params
object_permissionobject or nullNoObject Permission
spendnumber or nullNoSpend
tpm_limitinteger or nullNoTpm Limit
rpm_limitinteger or nullNoRpm Limit
session_tpm_limitinteger or nullNoSession Tpm Limit
session_rpm_limitinteger or nullNoSession Rpm Limit
static_headersobject or nullNoStatic Headers
extra_headersarray of string or nullNoExtra Headers
access_group_idsarray of string or nullNoAccess Group Ids
kill_switchAgentKillSwitchConfig or nullNo
keysarray of AgentKeySummary or nullNoKeys
search_scorenumber or nullNoSearch Score
created_atstring or nullNoCreated At
updated_atstring or nullNoUpdated At
created_bystring or nullNoCreated By
updated_bystring or nullNoUpdated 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:

NameInTypeRequiredDescription
agent_idpathstringYes

Request body (application/json, schema AgentConfig):

FieldTypeRequiredDescription
access_group_idsarray of string or nullNoAccess Group Ids
agent_card_paramsAgentCardNoThe AgentCard is a self-describing manifest for an agent.
agent_namestringYesAgent Name
enabledbooleanNoEnabled
execution_modeenum: "autonomous", "delegated", "both"NoExecution Mode
extra_headersarray of string or nullNoExtra Headers
identityEntraIdentityConfig or OidcIdentityConfig or nullNoIdentity
kill_switchAgentKillSwitchConfig or nullNo
object_permissionAgentObjectPermissionNo
rpm_limitinteger or nullNoRpm Limit
session_rpm_limitinteger or nullNoSession Rpm Limit
session_tpm_limitinteger or nullNoSession Tpm Limit
spanway_paramsobjectNoSpanway Params
static_headersobject or nullNoStatic Headers
tpm_limitinteger or nullNoTpm 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:

StatusDescriptionBody
200The agent after the updateapplication/json AgentResponse
400The agent card or identity is invalid, or the name is already takenapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller is not a proxy admin, or a governance control was set without the agent_governance licenseapplication/json ErrorDetail
404No agent has this idapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway has no database connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
identityAgentIdentityBinding or nullNo
identity_managedbooleanNoIdentity Managed
enabledbooleanNoEnabled
execution_modeenum: "autonomous", "delegated", "both"NoExecution Mode
jwt_auth_configuredbooleanNoJwt Auth Configured
agent_idstringYesAgent Id
agent_namestringYesAgent Name
spanway_paramsobject or nullNoSpanway Params
agent_card_paramsobjectYesAgent Card Params
object_permissionobject or nullNoObject Permission
spendnumber or nullNoSpend
tpm_limitinteger or nullNoTpm Limit
rpm_limitinteger or nullNoRpm Limit
session_tpm_limitinteger or nullNoSession Tpm Limit
session_rpm_limitinteger or nullNoSession Rpm Limit
static_headersobject or nullNoStatic Headers
extra_headersarray of string or nullNoExtra Headers
access_group_idsarray of string or nullNoAccess Group Ids
kill_switchAgentKillSwitchConfig or nullNo
keysarray of AgentKeySummary or nullNoKeys
search_scorenumber or nullNoSearch Score
created_atstring or nullNoCreated At
updated_atstring or nullNoUpdated At
created_bystring or nullNoCreated By
updated_bystring or nullNoUpdated 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:

NameInTypeRequiredDescription
agent_idpathstringYes

Request body (application/json, schema PatchAgentRequest):

FieldTypeRequiredDescription
access_group_idsarray of string or nullNoAccess Group Ids
agent_card_paramsAgentCardNoThe AgentCard is a self-describing manifest for an agent.
agent_namestringNoAgent Name
enabledbooleanNoEnabled
execution_modeenum: "autonomous", "delegated", "both"NoExecution Mode
extra_headersarray of string or nullNoExtra Headers
identityEntraIdentityConfig or OidcIdentityConfig or nullNoIdentity
kill_switchAgentKillSwitchConfig or nullNo
object_permissionAgentObjectPermissionNo
rpm_limitinteger or nullNoRpm Limit
session_rpm_limitinteger or nullNoSession Rpm Limit
session_tpm_limitinteger or nullNoSession Tpm Limit
spanway_paramsobjectNoSpanway Params
static_headersobject or nullNoStatic Headers
tpm_limitinteger or nullNoTpm 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:

StatusDescriptionBody
200The agent after the updateapplication/json AgentResponse
400The agent card or identity is invalid, or the name is already takenapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller is not a proxy admin, or a governance control was set without the agent_governance licenseapplication/json ErrorDetail
404No agent has this idapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway has no database connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
identityAgentIdentityBinding or nullNo
identity_managedbooleanNoIdentity Managed
enabledbooleanNoEnabled
execution_modeenum: "autonomous", "delegated", "both"NoExecution Mode
jwt_auth_configuredbooleanNoJwt Auth Configured
agent_idstringYesAgent Id
agent_namestringYesAgent Name
spanway_paramsobject or nullNoSpanway Params
agent_card_paramsobjectYesAgent Card Params
object_permissionobject or nullNoObject Permission
spendnumber or nullNoSpend
tpm_limitinteger or nullNoTpm Limit
rpm_limitinteger or nullNoRpm Limit
session_tpm_limitinteger or nullNoSession Tpm Limit
session_rpm_limitinteger or nullNoSession Rpm Limit
static_headersobject or nullNoStatic Headers
extra_headersarray of string or nullNoExtra Headers
access_group_idsarray of string or nullNoAccess Group Ids
kill_switchAgentKillSwitchConfig or nullNo
keysarray of AgentKeySummary or nullNoKeys
search_scorenumber or nullNoSearch Score
created_atstring or nullNoCreated At
updated_atstring or nullNoUpdated At
created_bystring or nullNoCreated By
updated_bystring or nullNoUpdated 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:

NameInTypeRequiredDescription
agent_idpathstringYes

Example request:

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

Responses:

StatusDescriptionBody
200The agent is goneapplication/json AgentDeletedResponse
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller is not a proxy admin, or a governance control was set without the agent_governance licenseapplication/json ErrorDetail
404No agent row has this idapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway has no database connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
messagestringYesConfirms 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:

NameInTypeRequiredDescription
agent_idpathstringYesThe 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:

StatusDescriptionBody
200The agent's credentials, never their secretsapplication/json AgentCredentialList
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller is not a proxy admin or admin viewer, or the license lacks the agent_governance featureapplication/json ErrorDetail
404No agent with this id is stored in the database. Agents defined only in config.yaml cannot hold credentialsapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500Stored agent credentials need a connected databaseapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
agent_idstringYesAgent Id
credentialsarray of AgentCredentialYesCredentials
suspensionAgentCredentialSuspensionYes

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:

NameInTypeRequiredDescription
agent_idpathstringYesThe agent's agent_id

Request body (application/json, schema AgentCredentialCreate):

FieldTypeRequiredDescription
descriptionstring or nullNoDescription
expires_atstring or nullNoAfter this time the credential is not used
kindenum: "mcp_server", "saas"Yesmcp_server: the gateway sends it to an MCP server. saas: the agent fetches it with its token
mcp_server_idstring or nullNoThe MCP server id, required when kind is mcp_server
namestringYesA short name the agent asks for, unique per agent, such as crm-api
secretstringYesThe 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:

StatusDescriptionBody
200The stored recordapplication/json AgentCredential
400The MCP server does not exist or does not take a static secretapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller is not a proxy admin, or the license lacks the agent_governance featureapplication/json ErrorDetail
404No agent with this id is stored in the database. Agents defined only in config.yaml cannot hold credentialsapplication/json ErrorDetail
409The agent already has a credential with that name or for that MCP serverapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500Stored agent credentials need a connected databaseapplication/json ErrorDetail
503The gateway has no salt key or master key to encrypt the secret withapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
agent_idstringYesAgent Id
created_atstringYesCreated At
created_bystring or nullNoCreated By
credential_idstringYesCredential Id
descriptionstring or nullNoDescription
expires_atstring or nullNoExpires At
kindenum: "mcp_server", "saas"YesKind
last_used_atstring or nullNoLast Used At
mcp_server_idstring or nullNoMcp Server Id
namestringYesName
revoke_reasonstring or nullNoRevoke Reason
revoked_atstring or nullNoRevoked At
revoked_bystring or nullNoRevoked By
rotated_atstring or nullNoRotated At
secret_hintstring or nullNoThe last four characters of a long secret
statusenum: "active", "revoked"YesStatus
updated_atstringYesUpdated At
updated_bystring or nullNoUpdated By
versionintegerYesStarts 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:

NameInTypeRequiredDescription
agent_idpathstringYesThe agent's agent_id

Request body (application/json, schema AgentCredentialSuspensionWrite):

FieldTypeRequiredDescription
reasonstring or nullNoWhy, shown to other admins
suspendedbooleanYestrue 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:

StatusDescriptionBody
200The suspension state after the changeapplication/json AgentCredentialSuspension
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller is not a proxy admin, or the license lacks the agent_governance featureapplication/json ErrorDetail
404No agent with this id is stored in the database. Agents defined only in config.yaml cannot hold credentialsapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500Stored agent credentials need a connected databaseapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
reasonstring or nullNoReason
suspendedbooleanYesSuspended
suspended_atstring or nullNoSuspended At
suspended_bystring or nullNoSuspended 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:

NameInTypeRequiredDescription
agent_idpathstringYesThe agent's agent_id
credential_idpathstringYesThe 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:

StatusDescriptionBody
200What was deletedapplication/json AgentCredentialDeleted
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller is not a proxy admin, or the license lacks the agent_governance featureapplication/json ErrorDetail
404The agent or the credential does not existapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500Stored agent credentials need a connected databaseapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
agent_idstringYesAgent Id
credential_idstringYesCredential 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:

NameInTypeRequiredDescription
agent_idpathstringYesThe agent's agent_id
credential_idpathstringYesThe 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:

StatusDescriptionBody
200The record after the revocationapplication/json AgentCredential
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller is not a proxy admin, or the license lacks the agent_governance featureapplication/json ErrorDetail
404The agent or the credential does not existapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500Stored agent credentials need a connected databaseapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
agent_idstringYesAgent Id
created_atstringYesCreated At
created_bystring or nullNoCreated By
credential_idstringYesCredential Id
descriptionstring or nullNoDescription
expires_atstring or nullNoExpires At
kindenum: "mcp_server", "saas"YesKind
last_used_atstring or nullNoLast Used At
mcp_server_idstring or nullNoMcp Server Id
namestringYesName
revoke_reasonstring or nullNoRevoke Reason
revoked_atstring or nullNoRevoked At
revoked_bystring or nullNoRevoked By
rotated_atstring or nullNoRotated At
secret_hintstring or nullNoThe last four characters of a long secret
statusenum: "active", "revoked"YesStatus
updated_atstringYesUpdated At
updated_bystring or nullNoUpdated By
versionintegerYesStarts 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:

NameInTypeRequiredDescription
agent_idpathstringYesThe agent's agent_id
credential_idpathstringYesThe credential id

Request body (application/json, schema AgentCredentialRotate):

FieldTypeRequiredDescription
expires_atstring or nullNoWhen the new secret stops being used
secretstringYesThe 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:

StatusDescriptionBody
200The record after the rotationapplication/json AgentCredential
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller is not a proxy admin, or the license lacks the agent_governance featureapplication/json ErrorDetail
404The agent or the credential does not existapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500Stored agent credentials need a connected databaseapplication/json ErrorDetail
503The gateway has no salt key or master key to encrypt the secret withapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
agent_idstringYesAgent Id
created_atstringYesCreated At
created_bystring or nullNoCreated By
credential_idstringYesCredential Id
descriptionstring or nullNoDescription
expires_atstring or nullNoExpires At
kindenum: "mcp_server", "saas"YesKind
last_used_atstring or nullNoLast Used At
mcp_server_idstring or nullNoMcp Server Id
namestringYesName
revoke_reasonstring or nullNoRevoke Reason
revoked_atstring or nullNoRevoked At
revoked_bystring or nullNoRevoked By
rotated_atstring or nullNoRotated At
secret_hintstring or nullNoThe last four characters of a long secret
statusenum: "active", "revoked"YesStatus
updated_atstringYesUpdated At
updated_bystring or nullNoUpdated By
versionintegerYesStarts 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:

NameInTypeRequiredDescription
agent_idpathstringYes

Example request:

curl -X GET "http://localhost:4000/v1/agents/agent_id-123/identity" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200The binding, whether it is active, the execution mode and when the agent last authenticatedapplication/json ManagedAgentIdentityStatus
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller is not a proxy admin, or the license lacks the agent_governance feature
404No agent with this id. Use the agent_id from the create answer, not its nameapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
503The agent policy could not be read from the databaseapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
enabledbooleanNoEnabled
execution_modeenum: "autonomous", "delegated", "both"NoExecution Mode
identityAgentIdentityBinding or nullNo
identity_managedbooleanNoIdentity Managed
last_authenticated_atstring or nullNoLast 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:

NameInTypeRequiredDescription
agent_idpathstringYes

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:

StatusDescriptionBody
200What the switch stopped and what the webhook answeredapplication/json AgentKillSwitchOutcome
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller is not a proxy admin, or the license lacks agent_governanceapplication/json ErrorDetail
404No agent has this idapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError

Response fields (200):

FieldTypeRequiredDescription
affected_tokensarray of stringYesHashed keys the switch blocked or deleted.
agent_idstringYesAgent Id
durablebooleanYesFalse 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_tokensarray of stringNoHashed keys the switch could not delete.
halted_workflow_runsinteger or nullYesNone when the workflow runner halt failed.
key_actionenum: "block", "delete"YesKey Action
reasonstring or nullNoReason
store_errorenum: "agent_halt_store_unavailable", "agent_key_delete_failed" or nullNoSet 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
webhookAgentKillSwitchResult or nullNo

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:

NameInTypeRequiredDescription
agent_idpathstringYes

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:

StatusDescriptionBody
200The public agent list after the changeapplication/json AgentMakePublicResponse
400The agent is already publicapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
403Only proxy admins can change which agents are publicapplication/json ErrorDetail
404No agent has this idapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway has no database connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
messagestringYesMessage
public_agent_groupsarray of stringYesPublic Agent Groups
updated_bystringYesUpdated By