curl and fetch — which is also the point: any agent, in any language, can drive it.
Set your environment once:
- Sandbox
- Live
1. Get an API key
Create one from the Nevermined app. Every Router call carries it asAuthorization: Bearer $NVM_API_KEY.
Never send this key to the service you’re paying. It authenticates you to Nevermined, nothing else.
2. Create a Delegation
A Delegation is your budget: a hard cap in cents and an expiry. Create it once and reuse the id for every payment until it’s exhausted or expires.provider: "erc4337" is the crypto-funded Delegation, which is what both stablecoin rails use. A card-funded Delegation is a different provider and is not accepted on those rails.3. Fund your wallet
Both rails pull: the merchant takes the money from your own custodial wallet. A Delegation authorizes the spend, but the wallet has to actually hold the funds. Find its address on the Delegation:providerPaymentMethodId is the wallet address to fund. Send it the payment asset on the network you intend to pay on — see the x402 rail and the MPP rail for which networks and assets each supports.
4. Make a paid call
Hand the Router the request you want made. It probes the service, detects the protocol, pays the 402, and relays the answer.- curl
- TypeScript
- Python
status and body unchanged, plus what the call cost you:
paid: false and no payment block — the Router relays it and charges nothing.
Use one stable
requestId per logical purchase, not per HTTP attempt. It’s the idempotency key: retrying a dropped call with the same id returns the original payment instead of buying twice. Retrying with a fresh id buys twice, on purpose.5. Check what you spent
When something is refused
Refusals are the system working. The three you’re most likely to meet:
Guardrails covers every code and, more usefully, why widening a cap in response to a refusal is almost always the wrong move.
Next
The x402 rail
Networks, assets, and what “exact” means.
The MPP rail
Tempo charges, receipts, and the asset allowlist.