Skip to main content

Management API: Agent Management

You're reading AI Gateway 2026.09.24. The newest release is 1.2.0. Go to the newest release

CRUD operations and API key management for A2A Agents.

Create a new Agent​

POST /agents

Code samples


curl -X POST http://localhost:9090/api/management/v1/agents \
-u {username}:{password} \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d @payload.json

Add a new A2A Agent to the Gateway.

Payload

{
"apiVersion": "gateway.api-platform.wso2.com/v1",
"kind": "Agent",
"metadata": {
"name": "trip-planner-v1.0"
},
"spec": {
"displayName": "Trip Planner",
"version": "v1.0",
"context": "/trip-planner",
"upstream": {
"url": "http://host.docker.internal:9099"
},
"a2a": {
"protocolVersion": "1.0",
"operationConfigs": {
"transports": [
{ "protocolBinding": "JSONRPC", "pathPrefix": "/" },
{ "protocolBinding": "HTTP+JSON", "pathPrefix": "/v1" }
]
}
}
}
}

Authentication​

This operation requires Basic Auth authentication. Required roles: `admin`, `developer`

Parameters​

NameInTypeRequiredDescription
bodybodyAgentConfigurationRequesttruenone

Responses​

StatusMeaningDescription
201CreatedAgent created successfully
400Bad RequestInvalid configuration (validation failed)
409ConflictAn Agent with the same name and version already exists
500Internal Server ErrorInternal server error

The response body is the stored AgentConfiguration, which is the request plus a read-only status object.

List all Agents​

GET /agents

Code samples


curl -X GET http://localhost:9090/api/management/v1/agents \
-u {username}:{password} \
-H 'Accept: application/json'

List Agents registered in the Gateway, optionally filtered by name, version, context, or status.

Authentication​

This operation requires Basic Auth authentication. Required roles: `admin`, `developer`

Parameters​

NameInTypeRequiredDescription
displayNamequerystringfalseFilter by agent display name
versionquerystringfalseFilter by agent version
contextquerystringfalseFilter by agent context path
statusquerystringfalseFilter by deployment status: deployed or undeployed

Example responses

200 Response

{
"status": "success",
"count": 1,
"agents": [
{
"apiVersion": "gateway.api-platform.wso2.com/v1",
"kind": "Agent",
"metadata": { "name": "trip-planner-v1.0" },
"spec": { "displayName": "Trip Planner", "version": "v1.0" }
}
]
}

Responses​

StatusMeaningDescription
200OKList of Agents
500Internal Server ErrorInternal server error

Get Agent by id​

GET /agents/{id}

Code samples


curl -X GET http://localhost:9090/api/management/v1/agents/trip-planner-v1.0 \
-u {username}:{password} \
-H 'Accept: application/json'

Get an Agent by its ID.

Authentication​

This operation requires Basic Auth authentication. Required roles: `admin`, `developer`

Parameters​

NameInTypeRequiredDescription
idpathstringtrueUnique public identifier of the Agent

Responses​

StatusMeaningDescription
200OKAgent details
404Not FoundAgent not found
500Internal Server ErrorInternal server error

Update an existing Agent​

PUT /agents/{id}

Code samples


curl -X PUT http://localhost:9090/api/management/v1/agents/trip-planner-v1.0 \
-u {username}:{password} \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d @payload.json

Update an existing Agent in the Gateway. The request body carries the complete configuration, as the create operation does.

Authentication​

This operation requires Basic Auth authentication. Required roles: `admin`, `developer`

Parameters​

NameInTypeRequiredDescription
idpathstringtrueUnique public identifier of the Agent to update
bodybodyAgentConfigurationRequesttruenone

Responses​

StatusMeaningDescription
200OKAgent updated successfully
400Bad RequestInvalid configuration (validation failed)
404Not FoundAgent not found
500Internal Server ErrorInternal server error

Delete an Agent​

DELETE /agents/{id}

Code samples


curl -X DELETE http://localhost:9090/api/management/v1/agents/trip-planner-v1.0 \
-u {username}:{password} \
-H 'Accept: application/json'

Delete an Agent from the Gateway.

Authentication​

This operation requires Basic Auth authentication. Required roles: `admin`, `developer`

Parameters​

NameInTypeRequiredDescription
idpathstringtrueUnique public identifier of the Agent to delete

Responses​

StatusMeaningDescription
200OKAgent deleted successfully
404Not FoundAgent not found
500Internal Server ErrorInternal server error

To take an Agent out of router traffic while keeping its configuration, policies, and API keys, set spec.deploymentState to undeployed instead of deleting it.

Create a new API key for an Agent​

POST /agents/{id}/api-keys

Code samples


curl -X POST http://localhost:9090/api/management/v1/agents/trip-planner-v1.0/api-keys \
-u {username}:{password} \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{"name":"trip-planner-client"}'

Generate a new API key for an Agent in the Gateway. The key is a 32-byte random value encoded in hexadecimal, prefixed with apip_. Use the API Key Auth policy on the Agent to validate incoming requests with this key.

Authentication​

This operation requires Basic Auth authentication. Required roles: `admin`, `consumer`

Parameters​

NameInTypeRequiredDescription
idpathstringtrueUnique public identifier of the Agent to generate the key for
bodybodyAPIKeyCreationRequesttruenone

Responses​

StatusMeaningDescription
201CreatedAPI key created successfully
400Bad RequestInvalid configuration (validation failed)
404Not FoundAgent not found
409ConflictDuplicate key or conflicting update
500Internal Server ErrorInternal server error

The key value appears in the response only on creation and regeneration. Store it securely; a lost key is regenerated rather than recovered.

Get the list of API keys for an Agent​

GET /agents/{id}/api-keys

List all API keys for an Agent in the Gateway. Key values aren't included.

Authentication​

This operation requires Basic Auth authentication. Required roles: `admin`, `consumer`

Parameters​

NameInTypeRequiredDescription
idpathstringtrueUnique public identifier of the Agent to retrieve the keys for

Responses​

StatusMeaningDescription
200OKList of API keys
404Not FoundAgent not found
500Internal Server ErrorInternal server error

Regenerate API key for an Agent​

POST /agents/{id}/api-keys/{apiKeyName}/regenerate

Regenerate an existing API key for an Agent in the Gateway. The previous key is revoked and replaced with a new 32-byte random value encoded in hexadecimal, prefixed with apip_.

Authentication​

This operation requires Basic Auth authentication. Required roles: `admin`, `consumer`

Parameters​

NameInTypeRequiredDescription
idpathstringtrueUnique public identifier of the Agent
apiKeyNamepathstringtrueName of the API key to regenerate

Responses​

StatusMeaningDescription
200OKAPI key regenerated successfully
404Not FoundAgent or API key not found
500Internal Server ErrorInternal server error

Update an API key for an Agent​

PUT /agents/{id}/api-keys/{apiKeyName}

Set a custom value on an existing API key instead of generating one, for injecting an externally issued key.

Authentication​

This operation requires Basic Auth authentication. Required roles: `admin`, `consumer`

Parameters​

NameInTypeRequiredDescription
idpathstringtrueUnique public identifier of the Agent
apiKeyNamepathstringtrueName of the API key to update

Responses​

StatusMeaningDescription
200OKAPI key updated successfully
404Not FoundAgent or API key not found
500Internal Server ErrorInternal server error

Revoke an API key for an Agent​

DELETE /agents/{id}/api-keys/{apiKeyName}

Revoke an API key. Once revoked, it can no longer authenticate requests.

Authentication​

This operation requires Basic Auth authentication. Required roles: `admin`, `consumer`

Parameters​

NameInTypeRequiredDescription
idpathstringtrueUnique public identifier of the Agent
apiKeyNamepathstringtrueName of the API key to revoke

Responses​

StatusMeaningDescription
200OKAPI key revoked successfully
404Not FoundAgent or API key not found
500Internal Server ErrorInternal server error

Was this page helpful?