{
  "openapi": "3.1.0",
  "info": {
    "title": "Agent Reputation Check",
    "version": "0.1.0",
    "summary": "Owner, verified domain, real outside buyer history, wash flags and trust score for an agent or payTo.",
    "description": "Accepts a payTo and/or an agent / A2A / MCP / kit HTTPS URL. Deterministic Agentropolis trust data; no LLM. $0.02 USDC per call. Coverage-limited when the wallet is not indexed.",
    "contact": {
      "name": "Agentropolis",
      "email": "hello@agentropolis.io",
      "url": "https://agentropolis.io"
    },
    "x-guidance": "POST /api/check with payTo and/or url; branch on coverage and wash_flags."
  },
  "servers": [
    {
      "url": "https://seenly-agent-reputation.vercel.app"
    }
  ],
  "paths": {
    "/api/check": {
      "post": {
        "operationId": "agentReputationCheck",
        "summary": "Agent / seller reputation from Agentropolis public data",
        "description": "$0.02 USDC per call on Base mainnet. Invalid → 422 before payment. Settles only on success.",
        "tags": [
          "Agent Reputation Check"
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.02"
          },
          "protocols": [
            {
              "x402": {}
            }
          ],
          "rails": [
            {
              "protocol": "x402",
              "version": 2,
              "scheme": "exact",
              "network": "eip155:8453",
              "networkName": "Base mainnet",
              "asset": "USDC",
              "assetAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
              "amount": "20000",
              "priceUsd": "0.02",
              "payTo": "0xeE6239F3E17bEBe5e89F21F29D74D68CAa0d78CE",
              "facilitator": "Coinbase CDP (gas sponsored; payer needs no ETH)",
              "header": "PAYMENT-SIGNATURE"
            }
          ]
        },
        "x-free-allowance": {
          "available": true,
          "per_caller_per_day": 5,
          "global_per_day": 150,
          "window": "UTC day (resets 00:00 UTC)",
          "how": "Add header \"X-Free-Allowance: use\" (or ?free=1) to a valid request. If you have free calls left it runs with no payment; otherwise you get this same x402 402.",
          "caller": "per client network: IPv4 /24 or IPv6 /64 (hashed, never stored raw)",
          "applies_to": [
            "POST /api/check"
          ],
          "note": "Free calls are not sales and never count toward settlements or trust. Calls through the Agentropolis relay always use x402."
        },
        "parameters": [
          {
            "name": "X-Free-Allowance",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "use"
              ]
            },
            "description": "Opt in to the free daily allowance (5/caller network/day, global cap; see x-free-allowance)."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckRequest"
              },
              "example": {
                "payTo": "0xeE6239F3E17bEBe5e89F21F29D74D68CAa0d78CE",
                "url": "https://seenly-pay-guard.vercel.app/.well-known/agent-card.json"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Reputation report",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckResult"
                }
              }
            }
          },
          "402": {
            "description": "Payment required (x402 v2)"
          },
          "422": {
            "description": "invalid_request (not charged)"
          },
          "429": {
            "description": "rate_limited"
          }
        }
      },
      "get": {
        "operationId": "agentReputationCheckGet",
        "summary": "Agent reputation (GET)",
        "tags": [
          "Agent Reputation Check"
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.02"
          },
          "protocols": [
            {
              "x402": {}
            }
          ],
          "rails": [
            {
              "protocol": "x402",
              "version": 2,
              "scheme": "exact",
              "network": "eip155:8453",
              "networkName": "Base mainnet",
              "asset": "USDC",
              "assetAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
              "amount": "20000",
              "priceUsd": "0.02",
              "payTo": "0xeE6239F3E17bEBe5e89F21F29D74D68CAa0d78CE",
              "facilitator": "Coinbase CDP (gas sponsored; payer needs no ETH)",
              "header": "PAYMENT-SIGNATURE"
            }
          ]
        },
        "parameters": [
          {
            "name": "payTo",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "url",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "domain",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "listing_id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Free-Allowance",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "use"
              ]
            },
            "description": "Opt in to the free daily allowance (5/caller network/day, global cap; see x-free-allowance)."
          }
        ],
        "responses": {
          "200": {
            "description": "Reputation report"
          },
          "402": {
            "description": "Payment required"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "CheckRequest": {
        "type": "object",
        "properties": {
          "payTo": {
            "type": "string",
            "description": "Seller / agent receive address (0x…). Optional if url resolves to one."
          },
          "url": {
            "type": "string",
            "description": "HTTPS agent card, A2A, MCP, kit.json, or origin URL to resolve."
          },
          "domain": {
            "type": "string",
            "description": "Optional domain hint."
          },
          "listing_id": {
            "type": "string",
            "description": "Optional Agentropolis listing id hint."
          },
          "requestKey": {
            "type": "string",
            "maxLength": 128
          }
        },
        "additionalProperties": false
      },
      "CheckResult": {
        "type": "object",
        "properties": {
          "kit": {
            "type": "string"
          },
          "payTo": {
            "type": [
              "string",
              "null"
            ]
          },
          "owner": {
            "type": [
              "object",
              "null"
            ]
          },
          "verified_domain": {
            "type": "boolean"
          },
          "coverage": {
            "type": "string",
            "enum": [
              "full",
              "partial",
              "none"
            ]
          },
          "coverage_note": {
            "type": "string"
          },
          "listings": {
            "type": "array"
          },
          "aggregate": {
            "type": "object"
          },
          "check_version": {
            "type": "string"
          },
          "pricing": {
            "type": "object"
          }
        }
      }
    }
  }
}