Skip to content

Verify Agent402 signed receipt

FREE with proof-of-workor $0.001 in USDCPOST /api/receipt-verify

Verify the cryptographic signature on an Agent402 signed receipt (a compact JWS, EdDSA over Ed25519) against the receipt keys this server publishes. Send POST /api/receipt-verify with the required field receipt and pay $0.001 per call over x402 or MPP, or call it free by solving a proof-of-work challenge. It returns a JSON object with valid, reason, detail, kid, record and 3 more.

Optionally send the answer text (body) or its SHA-256 (bodySha256), and the request (method, path, body), to check them against what the receipt signs. Returns valid, the key id, a reason when invalid, and the signed fields: route, amount, rail, network, payer, transaction and issue time (trust them only when valid is true). With no published key, every receipt reads unknown_kid. For on-chain settlement of an x402 payment use x402-verify; for an HMAC JWT use jwt-verify.

Category: Payments & x402Tags: receipt signed-receipt receipt-signature verify signature ed25519 eddsa jws

Try in playground →

Parameters

NameTypeRequiredDescription
receiptstringyesThe receipt: the compact JWS from the receipt response header, a trailer, or the receipt line that ends a streamed answer. Up to 4096 characters.
bodystringnoOptional: the answer text exactly as received (up to 65,536 characters; send bodySha256 for a longer one); its SHA-256 must match the receipt's. Up to 65536 characters.
bodySha256stringnoOptional, instead of body: the answer's SHA-256 in hex. Up to 64 characters.
requestobjectnoOptional: { method, path, body } of the call as sent; its digest must match the receipt's.

Free call, no wallet

This tool runs free with proof of work: fetch a challenge, solve the sha256 puzzle (16 leading zero bits, a fraction of a second of CPU), and resend with the X-Pow-Solution header. JavaScript:

import { createHash } from "node:crypto";
const lz = (b) => { let t = 0; for (const x of b) { if (!x) { t += 8; continue; } t += Math.clz32(x) - 24; break; } return t; };
const c = await (await fetch("https://agent402.tools/api/pow/challenge?slug=receipt-verify")).json();
let n = 0;
while (lz(createHash("sha256").update(c.challenge + ":" + n).digest()) < c.difficulty) n++;
await fetch("https://agent402.tools/api/receipt-verify", { method: "POST", headers: { "X-Pow-Solution": c.token + ":" + n, "Content-Type": "application/json" }, body: JSON.stringify({"receipt":"eyJhbGciOiJFZERTQSIsImtpZCI6ImRvY3MtZXhhbXBsZSIsInR5cCI6ImFnZW50NDAyLXJlY2VpcHQrandzIn0.eyJ2IjoxLCJpZCI6ImRvY3NFeGFtcGxlUmVjZWlwdDAwMDEiLCJpc3MiOiJodHRwczovL2FnZW50NDAyLnRvb2xzIiwiaWF0IjoiMjAyNi0xMS0yNlQwMDowMDowMC4wMDBaIiwibWV0aG9kIjoiUE9TVCIsInBhdGgiOiIvYXBpL2hhc2giLCJzbHVnIjoiaGFzaCIsInJlcXVlc3RTaGEyNTYiOiJkNDJmZGQ5NjZhZDJjYzU2NDFiYmU4NDg4ODBjM2YxYjIxZTE3NWZjNDBhNGQwNmY5NzViMjQ4YmQ5M2ViNTIyIiwicmVzcG9uc2VTaGEyNTYiOiIyNDNmY2NlN2U5OGVkNDI1NTFiYzM1YjA0OGI3NDMxNzJmZmY5ZWVkMWQyYTJhZWM1NTQwNWQwOTU0Y2ZiYTc2IiwicHJpY2VVc2QiOm51bGwsInJhaWwiOiJjcmVkaXRzIiwibmV0d29yayI6bnVsbCwicGF5ZXIiOm51bGwsInNldHRsZW1lbnQiOm51bGwsInJlcGxheSI6ZmFsc2V9.-GMHkVPAi3tJaEKoUi_s3WMKy3_vYHEsVmHvt7GpP-v7SOkZ1eH4T5_Lz3beJyP_yWmIcJSGf-56cw7Pz1pRDw"}) });

Python, standard library only:

import hashlib, json, urllib.request

def zero_bits(digest):
    n = 0
    for b in digest:
        if b:
            return n + 8 - b.bit_length()
        n += 8
    return n

c = json.load(urllib.request.urlopen("https://agent402.tools/api/pow/challenge?slug=receipt-verify"))
n = 0
while zero_bits(hashlib.sha256(f"{c['challenge']}:{n}".encode()).digest()) < c["difficulty"]:
    n += 1
req = urllib.request.Request("https://agent402.tools/api/receipt-verify", method="POST", data="{\"receipt\":\"eyJhbGciOiJFZERTQSIsImtpZCI6ImRvY3MtZXhhbXBsZSIsInR5cCI6ImFnZW50NDAyLXJlY2VpcHQrandzIn0.eyJ2IjoxLCJpZCI6ImRvY3NFeGFtcGxlUmVjZWlwdDAwMDEiLCJpc3MiOiJodHRwczovL2FnZW50NDAyLnRvb2xzIiwiaWF0IjoiMjAyNi0xMS0yNlQwMDowMDowMC4wMDBaIiwibWV0aG9kIjoiUE9TVCIsInBhdGgiOiIvYXBpL2hhc2giLCJzbHVnIjoiaGFzaCIsInJlcXVlc3RTaGEyNTYiOiJkNDJmZGQ5NjZhZDJjYzU2NDFiYmU4NDg4ODBjM2YxYjIxZTE3NWZjNDBhNGQwNmY5NzViMjQ4YmQ5M2ViNTIyIiwicmVzcG9uc2VTaGEyNTYiOiIyNDNmY2NlN2U5OGVkNDI1NTFiYzM1YjA0OGI3NDMxNzJmZmY5ZWVkMWQyYTJhZWM1NTQwNWQwOTU0Y2ZiYTc2IiwicHJpY2VVc2QiOm51bGwsInJhaWwiOiJjcmVkaXRzIiwibmV0d29yayI6bnVsbCwicGF5ZXIiOm51bGwsInNldHRsZW1lbnQiOm51bGwsInJlcGxheSI6ZmFsc2V9.-GMHkVPAi3tJaEKoUi_s3WMKy3_vYHEsVmHvt7GpP-v7SOkZ1eH4T5_Lz3beJyP_yWmIcJSGf-56cw7Pz1pRDw\"}".encode(), headers={"X-Pow-Solution": f"{c['token']}:{n}", "Content-Type": "application/json"})
print(json.load(urllib.request.urlopen(req)))

Example request

curl -i -X POST https://agent402.tools/api/receipt-verify \
  -H "Content-Type: application/json" \
  -d '{"receipt":"eyJhbGciOiJFZERTQSIsImtpZCI6ImRvY3MtZXhhbXBsZSIsInR5cCI6ImFnZW50NDAyLXJlY2VpcHQrandzIn0.eyJ2IjoxLCJpZCI6ImRvY3NFeGFtcGxlUmVjZWlwdDAwMDEiLCJpc3MiOiJodHRwczovL2FnZW50NDAyLnRvb2xzIiwiaWF0IjoiMjAyNi0xMS0yNlQwMDowMDowMC4wMDBaIiwibWV0aG9kIjoiUE9TVCIsInBhdGgiOiIvYXBpL2hhc2giLCJzbHVnIjoiaGFzaCIsInJlcXVlc3RTaGEyNTYiOiJkNDJmZGQ5NjZhZDJjYzU2NDFiYmU4NDg4ODBjM2YxYjIxZTE3NWZjNDBhNGQwNmY5NzViMjQ4YmQ5M2ViNTIyIiwicmVzcG9uc2VTaGEyNTYiOiIyNDNmY2NlN2U5OGVkNDI1NTFiYzM1YjA0OGI3NDMxNzJmZmY5ZWVkMWQyYTJhZWM1NTQwNWQwOTU0Y2ZiYTc2IiwicHJpY2VVc2QiOm51bGwsInJhaWwiOiJjcmVkaXRzIiwibmV0d29yayI6bnVsbCwicGF5ZXIiOm51bGwsInNldHRsZW1lbnQiOm51bGwsInJlcGxheSI6ZmFsc2V9.-GMHkVPAi3tJaEKoUi_s3WMKy3_vYHEsVmHvt7GpP-v7SOkZ1eH4T5_Lz3beJyP_yWmIcJSGf-56cw7Pz1pRDw"}'

Without payment this returns HTTP 402 Payment Required with the exact price for receipt-verify; any x402 v2 or MPP client pays it and retries.

Watch a call get paid

RequestPOST /api/receipt-verify
402$0.001 USDC
SignPAYMENT-SIGNATURE
Settleon 14 chains
Answer200 OK
ReceiptAgent402-ReceiptEd25519

Example response

{
  "valid": false,
  "reason": "unknown_kid",
  "detail": "The receipt names a key id this server does not publish.",
  "kid": "docs-example",
  "record": {
    "v": 1,
    "id": "docsExampleReceipt0001",
    "iss": "https://agent402.tools",
    "iat": "2026-11-26T00:00:00.000Z",
    "method": "POST",
    "path": "/api/hash",
    "slug": "hash",
    "requestSha256": "d42fdd966ad2cc5641bbe848880c3f1b21e175fc40a4d06f975b248bd93eb522",
    "responseSha256": "243fcce7e98ed42551bc35b048b743172fff9eed1d2a2aec55405d0954cfba76",
    "priceUsd": null,
    "rail": "credits",
    "network": null,
    "payer": null,
    "settlement": null,
    "replay": false
  },
  "fields": {
    "route": "POST /api/hash",
    "slug": "hash",
    "priceUsd": null,
    "rail": "credits",
    "network": null,
    "payer": null,
    "transaction": null,
    "issuedAt": "2026-11-26T00:00:00.000Z",
    "issuer": "https://agent402.tools",
    "id": "docsExampleReceipt0001",
    "replay": false
  },
  "keys": [],
  "keySet": "/.well-known/agent402-receipt-key.json"
}
FieldTypeAlways presentIn the example
validbooleanyesfalse
reasonstringyesunknown_kid
detailstringyesThe receipt names a key id this server does not publish.
kidstringyesdocs-example
recordobjectyes15 fields: v, id, iss, iat, method, path and 9 more
fieldsobjectyes11 fields: route, slug, priceUsd, rail, network, payer and 5 more
keysarrayyes0 items in the example
keySetstringyes/.well-known/agent402-receipt-key.json

From an MCP client

catalog.call {
  "slug": "receipt-verify",
  "params": {
    "receipt": "eyJhbGciOiJFZERTQSIsImtpZCI6ImRvY3MtZXhhbXBsZSIsInR5cCI6ImFnZW50NDAyLXJlY2VpcHQrandzIn0.eyJ2IjoxLCJpZCI6ImRvY3NFeGFtcGxlUmVjZWlwdDAwMDEiLCJpc3MiOiJodHRwczovL2FnZW50NDAyLnRvb2xzIiwiaWF0IjoiMjAyNi0xMS0yNlQwMDowMDowMC4wMDBaIiwibWV0aG9kIjoiUE9TVCIsInBhdGgiOiIvYXBpL2hhc2giLCJzbHVnIjoiaGFzaCIsInJlcXVlc3RTaGEyNTYiOiJkNDJmZGQ5NjZhZDJjYzU2NDFiYmU4NDg4ODBjM2YxYjIxZTE3NWZjNDBhNGQwNmY5NzViMjQ4YmQ5M2ViNTIyIiwicmVzcG9uc2VTaGEyNTYiOiIyNDNmY2NlN2U5OGVkNDI1NTFiYzM1YjA0OGI3NDMxNzJmZmY5ZWVkMWQyYTJhZWM1NTQwNWQwOTU0Y2ZiYTc2IiwicHJpY2VVc2QiOm51bGwsInJhaWwiOiJjcmVkaXRzIiwibmV0d29yayI6bnVsbCwicGF5ZXIiOm51bGwsInNldHRsZW1lbnQiOm51bGwsInJlcGxheSI6ZmFsc2V9.-GMHkVPAi3tJaEKoUi_s3WMKy3_vYHEsVmHvt7GpP-v7SOkZ1eH4T5_Lz3beJyP_yWmIcJSGf-56cw7Pz1pRDw"
  }
}

On the hosted connector at https://agent402.tools/mcp, catalog.call runs receipt-verify free (rate-limited, no wallet). Local install: npx -y agent402-mcp@0.17.1.

Errors and behavior

Paid call (JavaScript agent)

import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client();
client.setSpendControls?.({ maxAmountPerPayment: "$0.001" }); // refuse any quote above this tool's price
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.AGENT_KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);

const res = await payFetch("https://agent402.tools/api/receipt-verify", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "receipt": "eyJhbGciOiJFZERTQSIsImtpZCI6ImRvY3MtZXhhbXBsZSIsInR5cCI6ImFnZW50NDAyLXJlY2VpcHQrandzIn0.eyJ2IjoxLCJpZCI6ImRvY3NFeGFtcGxlUmVjZWlwdDAwMDEiLCJpc3MiOiJodHRwczovL2FnZW50NDAyLnRvb2xzIiwiaWF0IjoiMjAyNi0xMS0yNlQwMDowMDowMC4wMDBaIiwibWV0aG9kIjoiUE9TVCIsInBhdGgiOiIvYXBpL2hhc2giLCJzbHVnIjoiaGFzaCIsInJlcXVlc3RTaGEyNTYiOiJkNDJmZGQ5NjZhZDJjYzU2NDFiYmU4NDg4ODBjM2YxYjIxZTE3NWZjNDBhNGQwNmY5NzViMjQ4YmQ5M2ViNTIyIiwicmVzcG9uc2VTaGEyNTYiOiIyNDNmY2NlN2U5OGVkNDI1NTFiYzM1YjA0OGI3NDMxNzJmZmY5ZWVkMWQyYTJhZWM1NTQwNWQwOTU0Y2ZiYTc2IiwicHJpY2VVc2QiOm51bGwsInJhaWwiOiJjcmVkaXRzIiwibmV0d29yayI6bnVsbCwicGF5ZXIiOm51bGwsInNldHRsZW1lbnQiOm51bGwsInJlcGxheSI6ZmFsc2V9.-GMHkVPAi3tJaEKoUi_s3WMKy3_vYHEsVmHvt7GpP-v7SOkZ1eH4T5_Lz3beJyP_yWmIcJSGf-56cw7Pz1pRDw"
  }),
});

No wallet yet? Fund a first one with USDC on Base, no ETH needed, or run npx -y agent402-mcp@0.17.1 wallet new to make one on this computer: it stores the key and prints the address and the config, never the key.

Related tools

Verify x402 settlement

$0.004GET /api/x402-verify

Confirm a USDC payment actually settled: given a tx hash (and network), returns whether it succeeded and the USDC.

Verify B20 token

$0.005GET /api/b20-verify

Boolean verdict with reasons: is this address a real factory-issued B20 on Base?

Rate a call you paid for

$0.001POST /api/feedback

Tell this server whether a call you paid for delivered what it promised.

Transaction status

$0.001GET /api/tx-status

Check the confirmation status of a transaction by hash on Base/Polygon/Arbitrum One/OP Mainnet/Ethereum/Celo/Avalanche.

SQL execution certificate verify

FREE w/ computeor $0.001POST /api/sql-cert-verify

Verify an Ed25519 execution certificate against the exact SQL statement you are about to run - the gate your database.

Audit report (one wallet's paid history, signed)

$0.01POST /api/audit-report

An audit report of your own wallet's paid history here, a record of every paid call: each call over a window of up.