{
  "openapi": "3.1.0",
  "info": {
    "title": "Base Transaction Evidence Oracle",
    "version": "0.1.0",
    "description": "Paid x402 endpoint that verifies a finalized Base transaction against explicit expectations and returns an Ed25519-signed deterministic evidence receipt."
  },
  "servers": [
    { "url": "/" }
  ],
  "paths": {
    "/health": {
      "get": {
        "summary": "Service readiness",
        "responses": {
          "200": {
            "description": "Service is ready"
          }
        }
      }
    },
    "/.well-known/receipt-signing-key.json": {
      "get": {
        "summary": "Receipt verification key",
        "responses": {
          "200": {
            "description": "Ed25519 public key in SPKI DER base64 form"
          }
        }
      }
    },
    "/v1/verify/base-transaction": {
      "post": {
        "summary": "Verify one Base transaction",
        "description": "Price: $0.01 in native Base USDC through x402. Checks the canonical transaction, receipt, block identity, outcome, optional sender, recipient, selector, and confirmation threshold.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VerificationRequest"
              },
              "example": {
                "transactionHash": "0xbf9166018c39a318480f15cb8f33c13a47655d47670bd15ca484a0ec3443574d",
                "expectations": {
                  "status": "success",
                  "minConfirmations": 5
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Signed verification receipt"
          },
          "400": {
            "description": "Malformed request"
          },
          "402": {
            "description": "x402 payment required"
          },
          "422": {
            "description": "Transaction unavailable, unfinalized, or inconsistent"
          },
          "503": {
            "description": "PayAI free-settlement hard limit reached; paid facilitator usage remains disabled"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "VerificationRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": ["transactionHash"],
        "properties": {
          "transactionHash": {
            "type": "string",
            "pattern": "^0x[a-fA-F0-9]{64}$"
          },
          "expectations": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "status": {
                "type": "string",
                "enum": ["success", "reverted"]
              },
              "from": {
                "type": "string",
                "pattern": "^0x[a-fA-F0-9]{40}$"
              },
              "to": {
                "type": "string",
                "pattern": "^0x[a-fA-F0-9]{40}$"
              },
              "selector": {
                "type": "string",
                "pattern": "^0x[a-fA-F0-9]{8}$"
              },
              "minConfirmations": {
                "type": "integer",
                "minimum": 1,
                "maximum": 100000
              }
            }
          }
        }
      }
    }
  }
}
