Agents API, SDK, CLI and MCP
Covered URLs speak x402. Any client that can sign an EIP-3009 USDG authorization can pay them. The SDK is the shortest path.
The x402 exchange
A request without payment gets HTTP 402 and the requirements:
{
"x402Version": 1,
"error": "X-PAYMENT header is required",
"accepts": [{
"scheme": "exact",
"network": "eip155:4663",
"maxAmountRequired": "20000", // USDG has 6 decimals: 0.02
"amount": "20000",
"asset": "0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",
"payTo": "<ArbiterEscrow>",
"resource": "https://www.arbiterprotection.xyz/x/stock-quote/NVDA",
"maxTimeoutSeconds": 300,
"extra": {
"name": "Global Dollar", "version": "1", "chainId": 4663,
"serviceId": "0x…", "service": "stock-quote",
"windowSeconds": 600, "maxLatencyMs": 20000
}
}]
}Sign an EIP-712 TransferWithAuthorization on the USDG domain (Global Dollar, version 1, chain 4663) from the paying wallet to payTo for exactly maxAmountRequired. Use nonce = keccak256(serviceId ‖ salt) with a random 32-byte salt to bind the signature to this service; a random nonce also works, and the relayer then settles it for the service in the URL. Retry the same request with the base64 JSON payload in X-PAYMENT (or PAYMENT-SIGNATURE):
{
"x402Version": 1, "scheme": "exact", "network": "eip155:4663",
"payload": {
"signature": "0x…",
"salt": "0x…",
"authorization": { "from": "0x…", "to": "<escrow>", "value": "20000",
"validAfter": "0", "validBefore": "1795000000", "nonce": "0x…" }
}
}Response headers
| Header | Value |
|---|---|
| X-Arbiter-Call | The call id on the escrow |
| X-Arbiter-Cover-Tx | The transaction that paid the seller and locked the price |
| X-PAYMENT-RESPONSE | base64 JSON: success, transaction, network, payer, callId |
| X-Arbiter-Refund | sent when an objective failure was refunded in the same request (pending if the refund transaction is still on its way) |
| X-Arbiter-Refund-Tx | The refund transaction |
| X-Arbiter-Objective | Which failure was measured |
Errors
| Status | Meaning | Charged |
|---|---|---|
| 402 | Payment missing, invalid, expired, already used, or the wallet lacks USDG (reason in error) | No |
| 503 | Service paused, its terms are changing, or the seller's free deposit cannot cover another call | No |
| 502 / 504 | Upstream unreachable or too slow | Refunded automatically |
| 5xx from the seller | Passed through | Refunded automatically |
| anything else | The seller's own answer | Covered for the window |
SDK
curl -sO https://www.arbiterprotection.xyz/sdk/arbiter.mjs # ESM, Node 20+, viem bundledimport { arbiter } from "./arbiter.mjs";
arbiter.fetch(url, init?, { account? | privateKey?, maxPrice? })
// -> { response, callId, price, coverTx, refund: "sent" | "pending" | null, refundTx, objective }
arbiter.call(callId) // status, refund, dispute, decision
arbiter.dispute(callId, reason, { account | privateKey })
arbiter.services() // the directory
arbiter.calls(address) // calls paid by an addressCLI
node arbiter.mjs services
ARBITER_KEY=0x... node arbiter.mjs call <service-id/path | url> [--method POST] [--data '{}'] [--max 0.05]
node arbiter.mjs status <callId>
ARBITER_KEY=0x... node arbiter.mjs dispute <callId> "<reason>"
ARBITER_KEY=0x... node arbiter.mjs calls [address]MCP server
A local stdio server that pays with ARBITER_KEY. Tools: list_services, call_service (service, path, method, body, max_price), call_status (call_id), dispute_call (call_id, reason).
{ "mcpServers": { "arbiter": { "command": "node", "args": ["/path/to/arbiter.mjs", "mcp"], "env": { "ARBITER_KEY": "0x..." } } } }REST endpoints
| Endpoint | Returns |
|---|---|
| GET /api/v1/services | Listed services: promise, price, window, refund rate, covered URL |
| GET /api/v1/services/{id} | One service |
| GET /api/v1/calls/{id} | Status, refund, upstream status and latency, dispute and decision |
| GET /api/v1/calls?buyer=0x… | Calls paid by an address (newest 50) |
| POST /api/v1/calls/{id}/dispute | Opens a dispute: { reason, ts, signature } (EIP-191 of the message below) |
| GET /api/v1/status | Block, services live, calls covered in the last hour |
Arbiter dispute
call: <callId>
reason: <keccak256 of the reason text>
ts: <unix seconds, within 5 minutes>Seller endpoints
| Endpoint | Body |
|---|---|
| POST /api/v1/services | { payload, ts, signature }: creates or updates the settings; returns the registerService / setService arguments |
| POST /api/v1/services/{id}/block | { buyer, blocked, ts, signature }: blocks or unblocks a buyer at the proxy |
| GET /api/v1/sellers/{address} | Deposit, locked and free amounts |
| GET /api/v1/calls?seller=0x… | Calls to the seller's services |
Arbiter seller\naction: <save|block>\nservice: <id>\npayload: <keccak256 of the JSON payload>\nts: <unix seconds>, signed with EIP-191 by the seller wallet.