{
  "openapi": "3.1.0",
  "info": {
    "title": "x402receipts",
    "version": "1.0.0",
    "summary": "Accounting infrastructure for autonomous spending",
    "description": "Every x402 purchase an agent makes becomes a receipt, reconciled against the on-chain transaction, anchored with independently verifiable evidence. Recording costs USD 1 per wallet per calendar month, paid over x402 (USDC on Base or Solana) by the agent's own wallet with its first upload of the month; the response carries a pass token (`Authorization: Bearer x4p_…`) that makes every later upload free until the month ends. The paying wallet is the account. No API key.",
    "contact": {
      "email": "hello@x402receipts.com",
      "url": "https://x402receipts.com"
    },
    "termsOfService": "https://x402receipts.com/terms.html"
  },
  "servers": [
    {
      "url": "https://app.x402receipts.com"
    }
  ],
  "paths": {
    "/api/v1/receipts": {
      "post": {
        "operationId": "recordReceipts",
        "summary": "Record receipts (paid over x402)",
        "tags": [
          "receipts"
        ],
        "description": "Send 1–500 receipts. Without a pass or payment the response is 402 with a PAYMENT-REQUIRED header (x402 v2) listing the monthly price and networks; retry with a PAYMENT-SIGNATURE header from any x402 client. On success the JSON carries `pass.token`: send it as `Authorization: Bearer` on later uploads and they are free until the month ends. A wallet that already paid the month is recognised and not charged again.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "receipts"
                ],
                "properties": {
                  "receipts": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 500,
                    "items": {
                      "type": "object",
                      "required": [
                        "id",
                        "occurredAt",
                        "network",
                        "resource",
                        "method",
                        "requestHash",
                        "delivered"
                      ],
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "Unique receipt id chosen by the agent (uuid recommended)"
                        },
                        "occurredAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "network": {
                          "type": "string",
                          "description": "CAIP-2 id of the network the purchase was paid on, e.g. eip155:8453"
                        },
                        "payer": {
                          "type": "string"
                        },
                        "payee": {
                          "type": "string"
                        },
                        "amountAtomic": {
                          "type": "string"
                        },
                        "asset": {
                          "type": "string"
                        },
                        "amount": {
                          "type": "string"
                        },
                        "currency": {
                          "type": "string"
                        },
                        "txRef": {
                          "type": "string",
                          "description": "Settlement transaction hash/signature"
                        },
                        "resource": {
                          "type": "string",
                          "format": "uri"
                        },
                        "method": {
                          "type": "string"
                        },
                        "requestHash": {
                          "type": "string",
                          "description": "sha256 hex of method + url + body"
                        },
                        "responseHash": {
                          "type": "string",
                          "description": "sha256 hex of the response body"
                        },
                        "responseStatus": {
                          "type": "integer"
                        },
                        "delivered": {
                          "type": "boolean"
                        },
                        "sellerReceipt": {
                          "type": "object",
                          "description": "x402 offer-receipt signed by the seller, when provided"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Stored",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "accepted": {
                      "type": "integer"
                    },
                    "duplicates": {
                      "type": "integer"
                    },
                    "anchored": {
                      "type": "boolean"
                    },
                    "paid": {
                      "type": "object",
                      "nullable": true,
                      "properties": {
                        "transaction": {
                          "type": "string"
                        },
                        "network": {
                          "type": "string"
                        },
                        "payer": {
                          "type": "string"
                        },
                        "month": {
                          "type": "string"
                        }
                      }
                    },
                    "pass": {
                      "type": "object",
                      "properties": {
                        "token": {
                          "type": "string"
                        },
                        "month": {
                          "type": "string"
                        },
                        "validUntil": {
                          "type": "string",
                          "format": "date-time"
                        }
                      }
                    },
                    "workspace": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "signInUrl": {
                          "type": "string"
                        },
                        "claimUrl": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid body (only once a payment is attached)"
          },
          "402": {
            "description": "Payment required (x402). Body and PAYMENT-REQUIRED header describe the price: USD 1 per wallet per calendar month."
          }
        }
      },
      "get": {
        "operationId": "getPrice",
        "summary": "The 402 challenge (price, networks, schema), without paying",
        "tags": [
          "receipts"
        ],
        "responses": {
          "402": {
            "description": "Payment requirements in the PAYMENT-REQUIRED header and JSON body"
          }
        }
      }
    },
    "/api/v1/receipts/{id}/verify": {
      "get": {
        "operationId": "verifyReceipt",
        "summary": "Public verification material for one receipt",
        "tags": [
          "evidence"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Receipt core, hash, Merkle path, root and the Hedera ledger entry holding it"
          },
          "404": {
            "description": "Unknown id"
          }
        }
      }
    },
    "/verify/{id}": {
      "get": {
        "operationId": "verifyPage",
        "summary": "Human-readable verification page (recomputes the proof in the browser)",
        "tags": [
          "evidence"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "HTML"
          }
        }
      }
    },
    "/api/status": {
      "get": {
        "operationId": "status",
        "summary": "Service health (200 ok / 503 problem)",
        "tags": [
          "meta"
        ],
        "responses": {
          "200": {
            "description": "Healthy"
          },
          "503": {
            "description": "Something needs attention"
          }
        }
      }
    },
    "/sdk": {
      "get": {
        "operationId": "sdk",
        "summary": "The single-file TypeScript SDK (withRegister)",
        "tags": [
          "meta"
        ],
        "responses": {
          "200": {
            "description": "text/typescript"
          }
        }
      }
    },
    "/llms.txt": {
      "get": {
        "operationId": "llms",
        "summary": "Plain-text description for language models",
        "tags": [
          "meta"
        ],
        "responses": {
          "200": {
            "description": "text/plain"
          }
        }
      }
    },
    "/.well-known/agent.json": {
      "get": {
        "operationId": "agentCard",
        "summary": "A2A-style agent card",
        "tags": [
          "meta"
        ],
        "responses": {
          "200": {
            "description": "JSON"
          }
        }
      }
    }
  },
  "x-specification": {
    "name": "ARR-1 — Agent Receipt Record",
    "url": "https://x402receipts.com/spec.html",
    "schemas": "https://x402receipts.com/spec/arr-1/",
    "licence": "CC0-1.0",
    "conformance": "Level 3 — Reconciled"
  },
  "x-payment": {
    "protocol": "x402",
    "version": 2,
    "pricePerWalletPerMonthUsd": 1,
    "asset": "USDC",
    "networks": [
      "eip155:8453",
      "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"
    ],
    "discovery": "Coinbase x402 Bazaar, PayAI directory"
  }
}