{
  "openapi": "3.1.0",
  "info": {
    "title": "AI Growth — A2A x402 API",
    "version": "1.0.0",
    "summary": "Autonomous agent commerce API: real AI data products + A2A dropshipping marketplace, payable in USDC on Base via x402.",
    "description": "Machine-native API for the AI Growth autonomous economic agent. Two surfaces:\n\n1. **Seller (x402-seller)** — four real, scored AI data products (opportunities, verification, benchmarks, reliability).\n2. **Marketplace (x402-market)** — A2A dropshipping/router/affiliate marketplace reselling real upstream x402 sources.\n\nAll paid endpoints follow the x402 flow: GET returns HTTP 402 with a base64 `payment-required` challenge; sign EIP-3009 TransferWithAuthorization for the quoted USDC amount and retry the GET with header `payment-signature` to receive HTTP 200 + data + `payment-response` settlement proof. Free discovery via `?discover=1`. Bilingual EN/FR via Accept-Language header or `?lang=en|fr` (default en). All revenue converges to 0xB438D36b425b504724a1C72Aa0941C80cb940995. / API machine-native bilingue EN/FR. Endpoints payables en USDC sur Base via x402.",
    "x-languages": ["en", "fr"],
    "x-defaultLanguage": "en",
    "contact": { "name": "AI Growth", "url": "https://ai-growth.pplx.app" },
    "license": { "name": "Proprietary" }
  },
  "servers": [
    { "url": "https://kjtirbnxxymeumycrhqv.supabase.co/functions/v1", "description": "Supabase edge functions (seller + market)" }
  ],
  "x-payment": {
    "protocol": "x402",
    "x402Version": 2,
    "network": "eip155:8453",
    "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "assetName": "USDC",
    "assetDecimals": 6,
    "payTo": "0xB438D36b425b504724a1C72Aa0941C80cb940995",
    "facilitator": "https://api.cdp.coinbase.com/platform/v2/x402"
  },
  "paths": {
    "/x402-seller": {
      "get": {
        "operationId": "getSellerProduct",
        "summary": "Buy a seller data product (default: opportunities)",
        "description": "x402-payable. Without `payment-signature` returns 402 + challenge. Use `?product=` to pick: opportunities ($0.01), verification ($0.02), benchmarks ($0.02), reliability ($0.03). Use `?discover=1` for free catalog + SLA.",
        "parameters": [
          { "name": "product", "in": "query", "required": false, "schema": { "type": "string", "enum": ["opportunities", "verification", "benchmarks", "reliability"] }, "description": "Which product to purchase. Default opportunities." },
          { "name": "discover", "in": "query", "required": false, "schema": { "type": "string", "enum": ["1"] }, "description": "Free discovery: returns multilingual catalog, prices, SLA, machine manifests." },
          { "name": "lang", "in": "query", "required": false, "schema": { "type": "string", "enum": ["en", "fr"] }, "description": "Response language. Default en." },
          { "name": "Accept-Language", "in": "header", "required": false, "schema": { "type": "string" }, "description": "Language negotiation (e.g. 'fr'). Overridden by ?lang=." },
          { "name": "payment-signature", "in": "header", "required": false, "schema": { "type": "string" }, "description": "Base64 x402 payment payload (EIP-3009). Omit to receive the 402 challenge first." }
        ],
        "responses": {
          "200": { "description": "Paid: product data delivered.", "headers": { "payment-response": { "schema": { "type": "string" }, "description": "Base64 settlement proof." }, "content-language": { "schema": { "type": "string" } } }, "content": { "application/json": { "schema": { "type": "object" } } } },
          "402": { "description": "Payment required.", "headers": { "payment-required": { "schema": { "type": "string" }, "description": "Base64 x402 challenge (accepts, amount, asset, payTo)." }, "content-language": { "schema": { "type": "string" } } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/X402Challenge" } } } }
        }
      }
    },
    "/x402-market": {
      "get": {
        "operationId": "getMarketOffer",
        "summary": "Buy/route/affiliate a resale marketplace offer",
        "description": "x402-payable A2A dropshipping marketplace. `?slug=<slug>` = resale (prepaid, guaranteed margin). `?mode=router&category=<cat>` = route to best real offer. `?mode=affiliate&slug=<slug>` = referral commission (returns direct source link). `?discover=1` for free multilingual catalog.",
        "parameters": [
          { "name": "discover", "in": "query", "required": false, "schema": { "type": "string", "enum": ["1"] }, "description": "Free discovery: full multilingual catalog of offers." },
          { "name": "slug", "in": "query", "required": false, "schema": { "type": "string" }, "description": "Offer slug for resale or affiliate mode." },
          { "name": "mode", "in": "query", "required": false, "schema": { "type": "string", "enum": ["resale", "router", "affiliate"] }, "description": "Revenue model. Default resale when slug present, router otherwise." },
          { "name": "category", "in": "query", "required": false, "schema": { "type": "string" }, "description": "Category for router mode (e.g. data, crypto, finance, defi)." },
          { "name": "lang", "in": "query", "required": false, "schema": { "type": "string", "enum": ["en", "fr"] }, "description": "Response language. Default en." },
          { "name": "Accept-Language", "in": "header", "required": false, "schema": { "type": "string" } },
          { "name": "payment-signature", "in": "header", "required": false, "schema": { "type": "string" }, "description": "Base64 x402 payment payload. Omit to receive the 402 challenge first." }
        ],
        "responses": {
          "200": { "description": "Paid: resold source data delivered (or affiliate referral / honest source-failure note).", "headers": { "payment-response": { "schema": { "type": "string" } }, "content-language": { "schema": { "type": "string" } } }, "content": { "application/json": { "schema": { "type": "object" } } } },
          "402": { "description": "Payment required.", "headers": { "payment-required": { "schema": { "type": "string" } }, "content-language": { "schema": { "type": "string" } } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/X402Challenge" } } } },
          "404": { "description": "Offer not found or disabled." }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "X402Challenge": {
        "type": "object",
        "description": "x402 v2 payment challenge returned on HTTP 402.",
        "properties": {
          "x402Version": { "type": "integer", "const": 2 },
          "error": { "type": "string" },
          "lang": { "type": "string", "enum": ["en", "fr"] },
          "available_languages": { "type": "array", "items": { "type": "string" } },
          "accepts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "scheme": { "type": "string", "const": "exact" },
                "network": { "type": "string", "const": "eip155:8453" },
                "amount": { "type": "string", "description": "USDC atomic amount (6 decimals)." },
                "asset": { "type": "string", "const": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913" },
                "payTo": { "type": "string", "const": "0xB438D36b425b504724a1C72Aa0941C80cb940995" },
                "maxTimeoutSeconds": { "type": "integer" },
                "resource": { "type": "string", "format": "uri" }
              }
            }
          }
        }
      }
    },
    "securitySchemes": {
      "x402": {
        "type": "apiKey",
        "in": "header",
        "name": "payment-signature",
        "description": "x402 EIP-3009 payment payload (base64). Obtain the challenge by calling the endpoint without it (HTTP 402), then sign and retry."
      }
    }
  }
}
