Arbiter

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:

json
{
  "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):

json
{
  "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

HeaderValue
X-Arbiter-CallThe call id on the escrow
X-Arbiter-Cover-TxThe transaction that paid the seller and locked the price
X-PAYMENT-RESPONSEbase64 JSON: success, transaction, network, payer, callId
X-Arbiter-Refundsent when an objective failure was refunded in the same request (pending if the refund transaction is still on its way)
X-Arbiter-Refund-TxThe refund transaction
X-Arbiter-ObjectiveWhich failure was measured

Errors

StatusMeaningCharged
402Payment missing, invalid, expired, already used, or the wallet lacks USDG (reason in error)No
503Service paused, its terms are changing, or the seller's free deposit cannot cover another callNo
502 / 504Upstream unreachable or too slowRefunded automatically
5xx from the sellerPassed throughRefunded automatically
anything elseThe seller's own answerCovered for the window

SDK

shell
curl -sO https://www.arbiterprotection.xyz/sdk/arbiter.mjs   # ESM, Node 20+, viem bundled
ts
import { 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 address

CLI

shell
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).

json
{ "mcpServers": { "arbiter": { "command": "node", "args": ["/path/to/arbiter.mjs", "mcp"], "env": { "ARBITER_KEY": "0x..." } } } }

REST endpoints

EndpointReturns
GET /api/v1/servicesListed 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}/disputeOpens a dispute: { reason, ts, signature } (EIP-191 of the message below)
GET /api/v1/statusBlock, services live, calls covered in the last hour
text
Arbiter dispute
call: <callId>
reason: <keccak256 of the reason text>
ts: <unix seconds, within 5 minutes>

Seller endpoints

EndpointBody
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
Seller messages are Arbiter seller\naction: <save|block>\nservice: <id>\npayload: <keccak256 of the JSON payload>\nts: <unix seconds>, signed with EIP-191 by the seller wallet.