A2a registration API
This page documents the 1 gateway endpoint tagged a2a_registration 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 |
|---|---|---|
| POST | /v1/a2a/discover | Fetch an upstream agent's card |
Endpoints
POST /v1/a2a/discover
Fetch an upstream agent's card
Fetch the upstream agent's well-known card so the UI can show the admin which skills/capabilities the agent exposes.
Proxy admins only, so other keys cannot use the gateway to reach internal addresses. The Admin UI calls it while an admin registers an agent.
Example:
curl -X POST "http://localhost:4000/v1/a2a/discover" \
-H "Authorization: Bearer <admin_key>" \
-H "Content-Type: application/json" \
-d '{"url": "https://upstream-agent.example.com"}'
Request body (application/json, schema DiscoverAgentRequest):
| Field | Type | Required | Description |
|---|---|---|---|
discovery_mode | DiscoveryMode | No | How to locate the upstream card. well_known_fallback for pure A2A agents (try standard paths); langgraph_platform for LangGraph Platform deployments where the card is shared across assistants and disambiguated by |
params | object or null | No | Mode-specific parameters. langgraph_platform requires {'assistant_id': <id>}. well_known_fallback ignores this. |
url | string | Yes | Base URL of the upstream agent. Behavior depends on discovery_mode: well_known_fallback (default) tries /.well-known/agent-card.json, /.well-known/agent.json, /agent.json under this URL in order; ``langgraph_plat |
Example request:
curl -X POST "http://localhost:4000/v1/a2a/discover" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://agent.example.com"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful response | application/json DiscoverAgentResponse |
| 400 | Could not fetch agent card from https://agent.example.com (mode=well_known_fallback). Last error: HTTP 404 or langgraph_platform discovery requires params.assistant_id | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ErrorDetail |
| 403 | Only proxy admins can discover agent cards. Your role=internal_user | application/json ErrorDetail |
| 422 | A field failed validation and the detail names it | application/json ErrorDetail |
| 500 | Discovery failed. The gateway log has the cause. | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
agent_card | object | Yes | Agent Card |
url | string | Yes | Url |