Skip to main content
The Meterlane Agent Gateway implements the x402 payment protocol to gate HTTP requests behind USDC micropayments. The flow is intentionally lightweight: your first request to a paid route returns a 402 with machine-readable payment requirements; you sign a USDC transfer, attach it as the X-PAYMENT header, and retry. The gateway verifies the payment with the facilitator, settles on-chain, and proxies your request to the upstream service — all within the same HTTP round trip.

GET /gateway/:orgSlug/:routePath

The paid proxy endpoint. Every route you create is reachable at this pattern.

Path parameters

string
required
Your organisation’s URL slug, visible in the dashboard under Settings → General.
string
required
The route path you configured when creating the route, e.g. weather/forecast.

Request headers

string
Base64-encoded signed x402 payment payload. Omit this header on the first (probe) request to receive the 402 challenge. Include it on the retry to authorise payment and receive the proxied response.

Step 1 — Unpaid probe (402 Payment Required)

When you call a route without a valid X-PAYMENT header the gateway returns 402 and sets X-Payment-Requirements with a JSON object describing exactly what you need to pay.
1

Send an unpaid request

Call the route URL without any payment header to discover the requirements.
2

Receive the 402 challenge

The gateway responds with 402 Payment Required and the X-Payment-Requirements header.
The maxAmountRequired value is in the token’s smallest unit (6 decimals for USDC), so 10000 equals $0.01.

Step 2 — Paid request (200 OK)

Use the requirements to construct and sign an ERC-3009 transferWithAuthorization payload, then send it as the X-PAYMENT header.
1

Sign the payment

Use the x402 client library to sign a USDC transfer using the details from X-Payment-Requirements.
2

Retry with X-PAYMENT

Attach the signed payload as the X-PAYMENT header and resend the request.
3

Receive the proxied response

The gateway verifies the payment with the facilitator, settles on-chain, and forwards your request to the upstream. You receive the upstream’s response directly.

Full flow reference


Error codes

The table below covers errors specific to the payment proxy path.
Each payment nonce is single-use. If you retry an identical X-PAYMENT payload you will always receive NONCE_REPLAY. Your x402 client library handles nonce generation automatically on each signing call.