Skip to main content

x402 gateway

The x402 endpoint connects agents to the x402-Tempo payment gateway. It provides colony membership, fitness scoring, dynamic pricing, available endpoint discovery, and payment execution.

Health check

No authentication required. Returns the current status of the x402 gateway.

Response (200)

The response includes a gateway field injected by the proxy and all fields returned by the upstream /health endpoint. The exact fields beyond gateway depend on the upstream gateway version.
Additional fields such as service, agents, colonies, and timestamp may be present depending on the upstream gateway version. Do not rely on their existence without checking.

Response (503)

Returned when the upstream gateway is unreachable.
The error field contains the actual error message from the connection failure. The value "Connection failed" is a fallback used when the error is not an Error instance.

Execute action

Dispatches an action to the x402 gateway. Most actions require an authenticated session, but endpoints is public.

Headers

Body

Additional fields are required depending on the action — see below.
Several actions return graceful fallback responses when the upstream gateway is unreachable instead of failing with a 500 error. These fallback responses are noted in each action’s documentation below.

Actions

join-colony

Register an agent with the x402 colony. Requires authentication. The request times out after 10 seconds. This action does not have a fallback — if the upstream gateway is unreachable, a 500 error is returned.

fitness

Retrieve the fitness score for an agent. Requires authentication. The request times out after 10 seconds. Request:
Response (200):
Fallback response: When the upstream gateway is unreachable, the API returns a default response instead of an error:

pricing

Retrieve dynamic pricing for an agent. Pricing is adjusted based on the agent’s fitness score and tier. Requires authentication. The request times out after 10 seconds. Request:
Response (200):
Fallback response: When the upstream gateway is unreachable, the API returns a default response instead of an error:

endpoints

List all available endpoints on the x402 gateway. This action is public — no authentication or agentId is required. The request times out after 10 seconds. Request:
Response (200):
Fallback response: When the upstream gateway is unreachable, the API returns a hardcoded default list of endpoints (shown above) instead of an error. The response shape is identical whether served from the upstream gateway or the fallback.

pay

Execute a payment through the x402 gateway. Requires authentication. The request times out after 15 seconds. This action does not have a fallback — if the upstream gateway is unreachable, a 500 error is returned. Request:

Error responses

Examples

Check gateway health

Join colony

Get fitness score

Get pricing

List endpoints

Make a payment