{
  "openapi": "3.1.0",
  "info": {
    "title": "Seller Due-Diligence Report",
    "version": "0.1.0",
    "summary": "Signed due-diligence report on an x402 / API seller before you pay.",
    "description": "Signed due-diligence report on an x402 / API seller before a big purchase or integration: Pay Guard on the live 402 terms, Agentropolis reputation (verified domain, real buyers, wash flags, Live-Tested), domain age, lookalike scan, contact/refund presence and a short LLM summary. Unpaid probe only; we never pay the seller. $5.00 USDC per report, or $5 by card via POST /api/report/checkout.",
    "contact": {
      "name": "Agentropolis",
      "email": "hello@agentropolis.io",
      "url": "https://agentropolis.io"
    },
    "x-guidance": "POST /api/report with {url, domain}; if verdict is avoid, do not pay."
  },
  "servers": [
    {
      "url": "https://seenly-due-diligence.vercel.app"
    }
  ],
  "paths": {
    "/api/report": {
      "post": {
        "operationId": "sellerDueDiligenceReport",
        "summary": "Seller due-diligence report (x402, $5)",
        "description": "$5.00 USDC per call on Base mainnet. Invalid → 422 before payment. Settles only on success.",
        "tags": [
          "Seller Due-Diligence Report"
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "5.00"
          },
          "protocols": [
            {
              "x402": {}
            }
          ],
          "rails": [
            {
              "protocol": "x402",
              "version": 2,
              "scheme": "exact",
              "network": "eip155:8453",
              "networkName": "Base mainnet",
              "asset": "USDC",
              "assetAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
              "amount": "5000000",
              "priceUsd": "5.00",
              "payTo": "0xeE6239F3E17bEBe5e89F21F29D74D68CAa0d78CE",
              "facilitator": "Coinbase CDP (gas sponsored; payer needs no ETH)",
              "header": "PAYMENT-SIGNATURE"
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckRequest"
              },
              "example": {
                "url": "https://seenly-pay-guard.vercel.app/api/guard",
                "domain": "seenly-pay-guard.vercel.app",
                "planned_spend_usd": 50,
                "max_price_usd": 0.05
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Signed 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"
          }
        }
      }
    },
    "/api/report/checkout": {
      "post": {
        "operationId": "sellerDueDiligenceCheckout",
        "summary": "Pay $5 by card (Stripe Checkout): returns checkout_url, job_id, job_token",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Checkout created"
          },
          "422": {
            "description": "invalid_request"
          }
        }
      }
    },
    "/api/report/jobs/{id}": {
      "get": {
        "operationId": "sellerDueDiligenceJob",
        "summary": "Fetch a card-paid report (needs ?token=job_token)",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Report ready"
          },
          "202": {
            "description": "Awaiting payment or generating"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "CheckRequest": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "description": "HTTPS seller endpoint (or origin) you are about to pay or integrate."
          },
          "domain": {
            "type": "string",
            "description": "The domain you intend to buy from (for lookalike / mismatch checks). Defaults to the url host."
          },
          "payTo": {
            "type": "string",
            "description": "Optional: the wallet you expect to pay (0x…). Compared with the live 402."
          },
          "planned_spend_usd": {
            "type": "number",
            "description": "Optional: total you plan to spend (tightens the verdict for big commitments)."
          },
          "max_price_usd": {
            "type": "number",
            "description": "Optional per-call price cap checked against the live 402."
          },
          "probe_body": {
            "description": "Optional JSON body for the unpaid probe (≤ 4 KB), if the endpoint needs one to return 402."
          },
          "requestKey": {
            "type": "string",
            "maxLength": 128
          }
        },
        "required": [
          "url"
        ],
        "additionalProperties": false
      },
      "CheckResult": {
        "type": "object",
        "example": {
          "kit": "seenly.due-diligence",
          "report_id": "dd_…",
          "verdict": "proceed_with_caution",
          "risks": [
            "Few or no real outside buyers in 30 days (2)."
          ],
          "positives": [
            "Endpoint answers unpaid requests with a well-formed x402 402.",
            "Pay Guard allows the live payment terms.",
            "Seller domain is verified on Agentropolis."
          ],
          "summary": {
            "headline": "Verified seller with early, thin sales history.",
            "summary": "…",
            "key_risks": [
              "…"
            ],
            "before_you_pay": [
              "Lock payTo, amount, asset and network."
            ],
            "model": "openai/gpt-5-mini"
          },
          "facts": {
            "live_402": {},
            "pay_guard": {},
            "reputation": {},
            "live_tested": {},
            "domain_age": {},
            "lookalike": {},
            "contact_and_policy": {}
          },
          "signature": {
            "alg": "Ed25519",
            "key_id": "…",
            "value": "…"
          },
          "report_version": "seller-due-diligence-0.1.0"
        }
      }
    }
  }
}