Route a request through the Router, paying the agent’s 402 and relaying the reply (mode B)
Hand the Router the request you want made to an upstream x402 agent; it probes, pays any 402 with your Delegation (same engine as POST /router/payments), and relays the agent’s response in ONE call — you never see the 402 or handle the credential yourself.
Prerequisite: a Delegation id (POST /api/v1/delegation/create, provider erc4337).
Provide the target url (+ optional method, headers, body). A free (non-402) upstream is relayed unchanged with paid=false and no payment. requestId is REQUIRED (the Router pays automatically, so a retry must be idempotency-keyed); a duplicate returns 409 with the original paymentId (from API 1.48, the first purchase's retained result instead — see GET /router/payments/{id}/result).
For LARGE or STREAMED responses, a transparent streaming variant exists at ALL /api/v1/router/proxy: point your HTTP client at it with headers X-Router-Target-Url and X-Router-Delegation-Id (optional X-Router-Upstream-Authorization for the agent’s own auth). Method/body/headers pass through and the response streams back, with payment metadata in X-Router-Payment-Id, X-Router-Payment-Status, and X-Router-Tx-Hash response headers. Use this JSON endpoint when you want a single structured result instead.
Request
- Base URL: https://api.sandbox.nevermined.app/api/v1
- URL: https://api.sandbox.nevermined.app/api/v1/router/route
- Auth: HTTP bearer
Request body
Example request
{
"url": "https://agent.example/api/resource",
"slug": "webscrape-pro",
"path": "scrape",
"search": "flight_iata=AA217&limit=1",
"requestId": "order-1234"
}Response
The relayed upstream response (status + body) plus the payment that was made.
Example response
{
"status": 200,
"body": {
"ok": true,
"data": "the paid resource"
},
"paid": true,
"payment": {
"resultUrl": "/api/v1/router/payments/b1f9c2e4-3d5a-4c7e-9f21-6a8b0c4d2e13/result",
"paymentId": "b1f9c2e4-3d5a-4c7e-9f21-6a8b0c4d2e13",
"settlement": {
"recipient": "0x209693Bc6afc0C5328bA36FaF03C514EF312287C",
"amount": "1000",
"asset": "USDC",
"network": "base-sepolia",
"approxCents": "1",
"scheme": "exact"
},
"fee": {
"amount": "0",
"cents": "0",
"capChargedCents": "1",
"capChargedMicros": "2040"
},
"status": "Settled"
}
}Changes
No recorded changes to this operation across all 1 revision of this API.