Docs/AP2 bridging
google ap2 · intent mandates

tools402 bridges x402 wire payments to Google's AP2 Intent Mandates.

Google announced AP2 (Agent Payments Protocol) on 16 September 2025 with 60 partners — Visa, Mastercard, Adyen, Stripe, Coinbase. AP2 standardises cryptographically-signed Intent Mandates so an agent can prove what it was authorised to spend, where, and when. tools402 was always wire-protocol-first; AP2 is the mandate layer that wraps it. Three touchpoints are live today.

E2 — MCP descriptor
live
E5 — X-AP2 header
live
E9 — /agent/identity
live
ecosystem

The 60-partner stack we now interop with.

AP2 inherits the credentials network of card payments and grafts it onto agent-initiated transactions. tools402 sits on the crypto-native rail (USDC on Base, x402 wire) and accepts AP2 mandates for budget-bounded spend.

Google AP2 spec Visa Mastercard Adyen Stripe Coinbase (via x402) + 54 issuers / acquirers

Touchpoint E2 — MCP descriptor live

Our MCP server (@tools402/mcp) advertises AP2 compatibility in its description string. Any MCP host that filters servers by capability will surface tools402 when an agent looks for an AP2-compatible payment provider.

E2

npm · @tools402/mcp · description

commit f65aefd
// Excerpt from the MCP server descriptor returned on init
{"name": "tools402",
  "version": "0.2.3",
  "description": "100+ HTTP endpoints, paid per call in USDC on Base, Polygon, or Solana. AP2 compatible — accepts Google Agent Payments Protocol Intent Mandates for budget-bounded spend.",
  "capabilities": ["x402", "ap2", "eip-712", "usdc-base"],
  "contact": "hello@tools402.dev"}

Touchpoint E5 — X-AP2-Mandate-Accepted response header live

When a buyer passes a valid AP2 Intent Mandate in the request (header X-AP2-Mandate), the x402 middleware verifies the mandate against the budget and returns the response with X-AP2-Mandate-Accepted: true. Four code paths cover the full surface: EIP-3009 fast / EIP-3009 race / EIP-3009 main, and Exact scheme. 340 tests pass on commit fd6a70a.

E5

x402 middleware · request/response

commit fd6a70a · 340 tests
# 1 · Buyer includes the AP2 mandate in the request
curl -X POST https://api.tools402.dev/v1/pdf-md \
     -H 'X-Payment: eyJ4NDAyVi…ifQ' \
     -H 'X-AP2-Mandate: eyJ…ap2…' \
     -F "file=@receipt.pdf"

# 2 · x402 middleware verifies both the wire payment AND the mandate budget
HTTP/1.1 200 OK
X-AP2-Mandate-Accepted: true
X-AP2-Mandate-Remaining-Budget-Usd: 42.13
Content-Type: application/json

{"markdown": "# Receipt 2026-05-15…"}

If the mandate is missing, expired, or the cumulative spend would exceed the budget, the response is still served (the wire payment was already valid) but with X-AP2-Mandate-Accepted: false and a X-AP2-Mandate-Rejected-Reason header explaining why.

Touchpoint E9 — POST /v1/agent/identity live

The build / verify endpoint for AP2 IntentMandates. Pass action: "build" with a budget and policy to receive a freshly-signed mandate. Pass action: "verify" with an existing mandate to confirm its signature and current remaining budget. EIP-712 typed data, 20 tests on commit 107db6b.

E9

POST /v1/agent/identity · build a mandate

commit 107db6b · 20 tests
# Request — wallet asks tools402 to mint a budget-bounded mandate
curl -X POST https://api.tools402.dev/v1/agent/identity \
     -H 'X-Payment: eyJ4NDAyVi…ifQ' \
     -H 'Content-Type: application/json' \
     -d '{"action": "build",
       "agent_wallet":    "0xAgent…f9c1",
       "budget_usdc":     "50.00",
       "per_call_max_usdc":"0.10",
       "allowed_paths":   ["/v1/pdf-md", "/v1/ocr"],
       "expires_at":      "2026-06-15T00:00:00Z"}'

HTTP/1.1 200 OK
{
  "mandate":       "eyJ0eXAiOi…ap2.signed",
  "signature_eip712": "0x7f02a…",
  "domain": {"name": "tools402-ap2", "version": "1", "chainId": 8453;}
}
E9

POST /v1/agent/identity · verify a mandate

commit 107db6b · 20 tests
# Request — verify the mandate and read current state
curl -X POST https://api.tools402.dev/v1/agent/identity \
     -H 'X-Payment: eyJ4NDAyVi…ifQ' \
     -H 'Content-Type: application/json' \
     -d '{"action":  "verify",
       "mandate": "eyJ0eXAiOi…ap2.signed";}'

HTTP/1.1 200 OK
{"valid":                 true,
  "agent_wallet":          "0xAgent…f9c1",
  "budget_usdc":           "50.00",
  "spent_so_far_usdc":     "7.87",
  "remaining_budget_usdc": "42.13",
  "expires_at":            "2026-06-15T00:00:00Z",
  "seconds_until_expiry":  2674800;}

AP2 mandate + x402 wire live

An AP2 Intent Mandate complements each wire x402 payment: the wire is required, the mandate records budget, path, and expiry. Pass X-AP2-Mandate alongside X-Payment; the middleware returns X-AP2-Mandate-Accepted: true when the mandate is valid (see touchpoint E5).

implementation reference

Verify any of this yourself.

The MCP descriptor (E2), the middleware behaviour (E5), the /v1/agent/identity endpoint (E9) — all three are observable directly via curl. The audit log at /v1/_audit records every E5 verification with an Ed25519 signature.

Three touchpoints live. Wire payment plus AP2 mandate — budget-bounded spend on crypto rails.