{
  "openapi": "3.1.0",
  "info": {
    "title": "AgentX402Pay \u2014 pay-per-call API marketplace",
    "version": "1.1.0",
    "description": "21 monetized HTTP APIs on the x402 protocol \u2014 prediction markets (Polymarket, Kalshi), DeFi/crypto data, multi-chain on-chain reads, live weather, real-time web search, and Gold Source document indexing. No API keys or signups: call any route, receive an HTTP 402 with the exact USDC price, sign a payment, retry, and get the data back. Payments settle on Base, Polygon, Arbitrum, or Solana mainnet through Coinbase's CDP Facilitator. Independently monitored by x402-list.com: 100% uptime since Oct 27, 2026, 14/14 x402 compliance checks (as of Oct 31, 2026). Evidence: https://x402-list.com/services/agentx402pay",
    "x-guidance": "Every route returns HTTP 402 Payment Required when called without payment. All routes are GET with query parameters except POST /api/gold-index, which takes the document in the request body as JSON, a text/plain body, or a multipart/form-data \"file\" upload (never put the document in the URL or query string). The 402 response body is empty; its `payment-required` header (base64-encoded JSON) carries the `accepts` array, which lists the exact USDC amount, network (Base, Polygon, Arbitrum, or Solana), and payTo address \u2014 sign a payment matching one of those entries and retry the same request with the payment attached (e.g. via @x402/fetch's wrapFetchWithPayment, or any x402-compatible client) to receive the real response. Prices range from $0.001 to $0.05 per call (most routes $0.01). Query parameters (and the gold-index request body) are documented per-operation below; most routes have sensible defaults and can be called with zero or one parameter. No account, API key, or signup is required \u2014 payment alone is the access control. Browser-based agents: every route sends CORS headers and exposes PAYMENT-REQUIRED and PAYMENT-RESPONSE. A list of every paid resource is at https://agentx402pay.com/.well-known/x402."
  },
  "paths": {
    "/protected": {
      "get": {
        "operationId": "getProtected",
        "summary": "Protected Content \u2014 demo of a whole paid page",
        "description": "Premium HTML content, gated the same way as every other route (createX402Route()). Demonstrates paying for a whole page rather than a JSON API response.",
        "tags": [
          "demo",
          "content"
        ],
        "security": [],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.01"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                },
                "example": "<html>...Payment verified \u2014 protected HTML content unlocked...</html>"
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/weather": {
      "get": {
        "operationId": "getWeather",
        "summary": "Weather \u2014 live current conditions for any city",
        "description": "Live current weather conditions for any city, sourced from Open-Meteo.",
        "tags": [
          "weather",
          "forecast",
          "api",
          "data",
          "live"
        ],
        "security": [],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.01"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "type": "string"
                    },
                    "observedAt": {
                      "type": "string"
                    },
                    "report": {
                      "type": "object"
                    },
                    "source": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "location": "Austin, Texas, United States",
                    "observedAt": "2026-08-15T12:00",
                    "report": {
                      "weather": "partly cloudy",
                      "temperature": 91,
                      "feelsLike": 94,
                      "humidityPercent": 48,
                      "windMph": 7
                    },
                    "source": "open-meteo.com"
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        },
        "parameters": [
          {
            "name": "city",
            "in": "query",
            "required": false,
            "description": "City name to fetch live current weather for (defaults to New York)",
            "schema": {
              "type": "string",
              "description": "City name to fetch live current weather for (defaults to New York)"
            }
          }
        ]
      }
    },
    "/api/generate": {
      "get": {
        "operationId": "getGenerate",
        "summary": "Text Generator \u2014 real LLM-backed text generation",
        "description": "Real LLM-backed text generation (Gemini), billed by output length (max $0.05/request). Uses the x402 \"upto\" scheme: buyer authorizes a maximum in one signature, actual charge is computed from output length.",
        "tags": [
          "ai",
          "text-generation",
          "llm",
          "content",
          "usage-based"
        ],
        "security": [],
        "x-payment-info": {
          "price": {
            "mode": "dynamic",
            "currency": "USD",
            "min": "0.0001",
            "max": "0.05"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "prompt": {
                      "type": "string"
                    },
                    "text": {
                      "type": "string"
                    },
                    "billedCharacters": {
                      "type": "number"
                    }
                  },
                  "example": {
                    "prompt": "tell me something interesting",
                    "text": "Octopuses have three hearts and blue, copper-based blood instead of iron-based hemoglobin.",
                    "billedCharacters": 92
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        },
        "parameters": [
          {
            "name": "prompt",
            "in": "query",
            "required": true,
            "description": "Text prompt to generate a response for",
            "schema": {
              "type": "string",
              "description": "Text prompt to generate a response for"
            }
          }
        ]
      }
    },
    "/api/insights": {
      "get": {
        "operationId": "getInsights",
        "summary": "Trend Insights \u2014 Wikipedia page-view attention and momentum",
        "description": "Topic attention trend from real Wikipedia page views: 7-day average, week-over-week change, direction and peak day. Premium adds the 30-day daily series, spike days and the same stats for related articles. Attention proxy, not search or social volume. standard = $0.01, premium = $0.025.",
        "tags": [
          "insights",
          "trends",
          "analytics",
          "data",
          "tiered-pricing"
        ],
        "security": [],
        "x-payment-info": {
          "price": {
            "mode": "dynamic",
            "currency": "USD",
            "min": "0.01",
            "max": "0.025"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "topic": {
                      "type": "string"
                    },
                    "tier": {
                      "type": "string",
                      "enum": [
                        "standard",
                        "premium"
                      ]
                    },
                    "article": {
                      "type": "string",
                      "description": "Wikipedia article the topic resolved to"
                    },
                    "articleUrl": {
                      "type": "string"
                    },
                    "score": {
                      "type": "integer",
                      "description": "0-100, log-scaled 7-day average daily views"
                    },
                    "avgDailyViews7d": {
                      "type": "integer"
                    },
                    "avgDailyViewsPrior7d": {
                      "type": "integer"
                    },
                    "changePctWoW": {
                      "type": [
                        "number",
                        "null"
                      ],
                      "description": "Last 7 days vs the 7 before, percent. null when the prior week had no views."
                    },
                    "direction": {
                      "type": "string",
                      "enum": [
                        "rising",
                        "falling",
                        "flat",
                        "new"
                      ],
                      "description": "rising >= +15%, falling <= -15% week over week"
                    },
                    "momentum": {
                      "type": "string"
                    },
                    "peakDay": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "date": {
                          "type": "string"
                        },
                        "views": {
                          "type": "integer"
                        }
                      }
                    },
                    "window": {
                      "type": "object",
                      "properties": {
                        "from": {
                          "type": "string"
                        },
                        "to": {
                          "type": "string"
                        },
                        "days": {
                          "type": "integer"
                        }
                      },
                      "description": "14 days (standard) or 30 days (premium), ending yesterday UTC"
                    },
                    "daily": {
                      "type": "array",
                      "description": "Premium only: daily views",
                      "items": {
                        "type": "object",
                        "properties": {
                          "date": {
                            "type": "string"
                          },
                          "views": {
                            "type": "integer"
                          }
                        }
                      }
                    },
                    "spikes": {
                      "type": "array",
                      "description": "Premium only: days at least 3x the window median (and 100+ views)",
                      "items": {
                        "type": "object",
                        "properties": {
                          "date": {
                            "type": "string"
                          },
                          "views": {
                            "type": "integer"
                          },
                          "timesMedian": {
                            "type": "number"
                          }
                        }
                      }
                    },
                    "related": {
                      "type": "array",
                      "description": "Premium only: same 14-day stats for up to 4 related articles (title search matches)",
                      "items": {
                        "type": "object",
                        "properties": {
                          "article": {
                            "type": "string"
                          },
                          "score": {
                            "type": "integer",
                            "description": "0-100, log-scaled 7-day average daily views"
                          },
                          "avgDailyViews7d": {
                            "type": "integer"
                          },
                          "avgDailyViewsPrior7d": {
                            "type": "integer"
                          },
                          "changePctWoW": {
                            "type": [
                              "number",
                              "null"
                            ],
                            "description": "Last 7 days vs the 7 before, percent. null when the prior week had no views."
                          },
                          "direction": {
                            "type": "string",
                            "enum": [
                              "rising",
                              "falling",
                              "flat",
                              "new"
                            ],
                            "description": "rising >= +15%, falling <= -15% week over week"
                          },
                          "momentum": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "relatedTrends": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Premium only: related article titles (kept for compatibility)"
                    },
                    "source": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "topic": "bitcoin",
                    "tier": "premium",
                    "article": "Bitcoin",
                    "articleUrl": "https://en.wikipedia.org/wiki/Bitcoin",
                    "score": 72,
                    "avgDailyViews7d": 3813,
                    "avgDailyViewsPrior7d": 2247,
                    "changePctWoW": 69.7,
                    "direction": "rising",
                    "momentum": "+70% WoW",
                    "peakDay": {
                      "date": "2026-10-09",
                      "views": 12625
                    },
                    "window": {
                      "from": "2026-10-01",
                      "to": "2026-10-30",
                      "days": 30
                    },
                    "spikes": [
                      {
                        "date": "2026-10-09",
                        "views": 12625,
                        "timesMedian": 5.6
                      }
                    ],
                    "related": [
                      {
                        "article": "Bitcoin buried in Newport landfill",
                        "score": 52,
                        "avgDailyViews7d": 396,
                        "avgDailyViewsPrior7d": 320,
                        "changePctWoW": 23.7,
                        "direction": "rising",
                        "momentum": "+24% WoW"
                      }
                    ],
                    "source": "Wikipedia pageviews (en, user agents) for \"Bitcoin\""
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          },
          "404": {
            "description": "No Wikipedia article or page-view history for the topic (not charged)."
          }
        },
        "parameters": [
          {
            "name": "topic",
            "in": "query",
            "required": true,
            "description": "Topic to fetch trend insights for",
            "schema": {
              "type": "string",
              "description": "Topic to fetch trend insights for"
            }
          },
          {
            "name": "tier",
            "in": "query",
            "required": false,
            "description": "standard = $0.01, premium = $0.025",
            "schema": {
              "type": "string",
              "enum": [
                "standard",
                "premium"
              ],
              "description": "standard = $0.01, premium = $0.025"
            }
          }
        ]
      }
    },
    "/api/ping": {
      "get": {
        "operationId": "getPing",
        "summary": "Heartbeat \u2014 cheap repeatable ping",
        "description": "Heartbeat endpoint billed via a batch-settlement payment channel (with an exact-scheme fallback). Meant to be called many times in a session.",
        "tags": [
          "heartbeat",
          "monitoring",
          "micropayments",
          "batch-settlement"
        ],
        "security": [],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.001"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "pong": {
                      "type": "boolean"
                    },
                    "ts": {
                      "type": "number"
                    }
                  },
                  "example": {
                    "pong": true,
                    "ts": 1700000000000
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/polymarket-markets": {
      "get": {
        "operationId": "getPolymarketMarkets",
        "summary": "Polymarket Markets \u2014 search/list active markets",
        "description": "Search or list active Polymarket prediction markets, ranked by 24h volume.",
        "tags": [
          "prediction-markets",
          "polymarket",
          "crypto",
          "finance",
          "trading"
        ],
        "security": [],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.01"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "query": {
                      "type": "string"
                    },
                    "count": {
                      "type": "number"
                    },
                    "markets": {
                      "type": "array"
                    }
                  },
                  "example": {
                    "query": "election",
                    "count": 1,
                    "markets": [
                      {
                        "slug": "example-market",
                        "question": "Example prediction market?",
                        "outcomes": [
                          "Yes",
                          "No"
                        ],
                        "outcomePrices": [
                          0.62,
                          0.38
                        ],
                        "volume24hr": 12345.67,
                        "volumeTotal": 987654.32,
                        "liquidity": 45678.9,
                        "endDate": "2026-12-31T00:00:00Z",
                        "active": true
                      }
                    ]
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        },
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Optional keyword filter on the market question",
            "schema": {
              "type": "string",
              "description": "Optional keyword filter on the market question"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Max markets to return, 1-50 (default 10)",
            "schema": {
              "type": "string",
              "description": "Max markets to return, 1-50 (default 10)"
            }
          }
        ]
      }
    },
    "/api/polymarket-market": {
      "get": {
        "operationId": "getPolymarketMarket",
        "summary": "Polymarket Market Detail \u2014 single market by slug",
        "description": "Get full detail (prices, volume, liquidity, resolution) for a single Polymarket market by slug.",
        "tags": [
          "prediction-markets",
          "polymarket",
          "crypto",
          "finance",
          "trading"
        ],
        "security": [],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.01"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "slug": {
                      "type": "string"
                    },
                    "question": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "outcomes": {
                      "type": "array"
                    },
                    "outcomePrices": {
                      "type": "array"
                    },
                    "volume24hr": {
                      "type": "number"
                    },
                    "volume1wk": {
                      "type": "number"
                    },
                    "volumeTotal": {
                      "type": "number"
                    },
                    "liquidity": {
                      "type": "number"
                    },
                    "endDate": {
                      "type": "string"
                    },
                    "active": {
                      "type": "boolean"
                    },
                    "closed": {
                      "type": "boolean"
                    }
                  },
                  "example": {
                    "slug": "xi-jinping-out-before-2027",
                    "question": "Xi Jinping out before 2027?",
                    "description": "This market will resolve to \"Yes\" if...",
                    "outcomes": [
                      "Yes",
                      "No"
                    ],
                    "outcomePrices": [
                      0.0445,
                      0.9555
                    ],
                    "volume24hr": 23665.67,
                    "volume1wk": 122625.33,
                    "volumeTotal": 12084934.95,
                    "liquidity": 233436.44,
                    "endDate": "2026-12-31T00:00:00Z",
                    "active": true,
                    "closed": false
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        },
        "parameters": [
          {
            "name": "slug",
            "in": "query",
            "required": true,
            "description": "Polymarket market slug (from the URL or /api/polymarket-markets)",
            "schema": {
              "type": "string",
              "description": "Polymarket market slug (from the URL or /api/polymarket-markets)"
            }
          }
        ]
      }
    },
    "/api/kalshi-markets": {
      "get": {
        "operationId": "getKalshiMarkets",
        "summary": "Kalshi Markets \u2014 search/list open markets",
        "description": "Search or list open Kalshi prediction markets (regulated US event contracts).",
        "tags": [
          "prediction-markets",
          "kalshi",
          "finance",
          "trading",
          "events"
        ],
        "security": [],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.01"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "query": {
                      "type": "string"
                    },
                    "count": {
                      "type": "number"
                    },
                    "markets": {
                      "type": "array"
                    }
                  },
                  "example": {
                    "query": "fed rate",
                    "count": 1,
                    "markets": [
                      {
                        "ticker": "KXEXAMPLE-99",
                        "eventTicker": "KXEXAMPLE-99",
                        "title": "Example Kalshi market?",
                        "yesBid": 0.1,
                        "yesAsk": 0.12,
                        "lastPrice": 0.12,
                        "volume24h": 174.62,
                        "liquidity": 0,
                        "closeTime": "2099-08-01T04:59:00Z",
                        "status": "active"
                      }
                    ]
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        },
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Optional keyword filter on the market title",
            "schema": {
              "type": "string",
              "description": "Optional keyword filter on the market title"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Max markets to return, 1-50 (default 10)",
            "schema": {
              "type": "string",
              "description": "Max markets to return, 1-50 (default 10)"
            }
          }
        ]
      }
    },
    "/api/kalshi-market": {
      "get": {
        "operationId": "getKalshiMarket",
        "summary": "Kalshi Market Detail \u2014 single market by ticker",
        "description": "Get full detail (yes/no prices, volume, status, result) for a single Kalshi market by ticker.",
        "tags": [
          "prediction-markets",
          "kalshi",
          "finance",
          "trading",
          "events"
        ],
        "security": [],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.01"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ticker": {
                      "type": "string"
                    },
                    "eventTicker": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "yesSubTitle": {
                      "type": "null"
                    },
                    "noSubTitle": {
                      "type": "string"
                    },
                    "yesBid": {
                      "type": "number"
                    },
                    "yesAsk": {
                      "type": "number"
                    },
                    "noBid": {
                      "type": "number"
                    },
                    "noAsk": {
                      "type": "number"
                    },
                    "lastPrice": {
                      "type": "number"
                    },
                    "volume": {
                      "type": "number"
                    },
                    "volume24h": {
                      "type": "number"
                    },
                    "liquidity": {
                      "type": "number"
                    },
                    "openTime": {
                      "type": "string"
                    },
                    "closeTime": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "result": {
                      "type": "null"
                    }
                  },
                  "example": {
                    "ticker": "KXELONMARS-99",
                    "eventTicker": "KXELONMARS-99",
                    "title": "Will Elon Musk visit Mars before Aug 1, 2099?",
                    "yesSubTitle": null,
                    "noSubTitle": "Mars",
                    "yesBid": 0.1,
                    "yesAsk": 0.12,
                    "noBid": 0.88,
                    "noAsk": 0.9,
                    "lastPrice": 0.12,
                    "volume": 117134.08,
                    "volume24h": 174.62,
                    "liquidity": 0,
                    "openTime": "2025-08-28T20:45:00Z",
                    "closeTime": "2099-08-01T04:59:00Z",
                    "status": "active",
                    "result": null
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        },
        "parameters": [
          {
            "name": "ticker",
            "in": "query",
            "required": true,
            "description": "Kalshi market ticker (from /api/kalshi-markets)",
            "schema": {
              "type": "string",
              "description": "Kalshi market ticker (from /api/kalshi-markets)"
            }
          }
        ]
      }
    },
    "/api/defi-tvl": {
      "get": {
        "operationId": "getDefiTvl",
        "summary": "DeFi Protocol TVL \u2014 by chain, plus market cap",
        "description": "Look up a DeFi protocol's current total value locked (TVL), by chain, plus market cap.",
        "tags": [
          "defi",
          "crypto",
          "tvl",
          "finance",
          "on-chain"
        ],
        "security": [],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.01"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "symbol": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    },
                    "chains": {
                      "type": "array"
                    },
                    "tvlUsd": {
                      "type": "number"
                    },
                    "asOf": {
                      "type": "string"
                    },
                    "tvlByChain": {
                      "type": "object"
                    },
                    "marketCapUsd": {
                      "type": "number"
                    }
                  },
                  "example": {
                    "name": "Uniswap",
                    "symbol": "UNI",
                    "url": "https://uniswap.org/",
                    "chains": [
                      "Ethereum",
                      "Base",
                      "Arbitrum"
                    ],
                    "tvlUsd": 2922032778,
                    "asOf": "2026-08-16T00:00:00.000Z",
                    "tvlByChain": {
                      "Ethereum": 1800000000,
                      "Base": 400000000
                    },
                    "marketCapUsd": 5200000000
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        },
        "parameters": [
          {
            "name": "protocol",
            "in": "query",
            "required": true,
            "description": "DefiLlama protocol slug, e.g. \"uniswap\", \"aave\"",
            "schema": {
              "type": "string",
              "description": "DefiLlama protocol slug, e.g. \"uniswap\", \"aave\""
            }
          }
        ]
      }
    },
    "/api/defi-chains": {
      "get": {
        "operationId": "getDefiChains",
        "summary": "DeFi Chain TVL Ranking \u2014 chains by total DeFi TVL",
        "description": "Rank blockchains by total DeFi value locked (TVL) across all protocols.",
        "tags": [
          "defi",
          "crypto",
          "tvl",
          "finance",
          "on-chain",
          "blockchain"
        ],
        "security": [],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.01"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "count": {
                      "type": "number"
                    },
                    "chains": {
                      "type": "array"
                    }
                  },
                  "example": {
                    "count": 2,
                    "chains": [
                      {
                        "rank": 1,
                        "chain": "Ethereum",
                        "tokenSymbol": "ETH",
                        "tvlUsd": 65000000000
                      },
                      {
                        "rank": 2,
                        "chain": "Solana",
                        "tokenSymbol": "SOL",
                        "tvlUsd": 8500000000
                      }
                    ]
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        },
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Number of top chains to return, 1-100 (default 15)",
            "schema": {
              "type": "string",
              "description": "Number of top chains to return, 1-100 (default 15)"
            }
          }
        ]
      }
    },
    "/api/crypto-price": {
      "get": {
        "operationId": "getCryptoPrice",
        "summary": "Crypto Price Lookup \u2014 price, 24h change, market cap",
        "description": "Look up current price, 24h change, and market cap for one or more cryptocurrencies.",
        "tags": [
          "crypto",
          "price",
          "finance",
          "market-data"
        ],
        "security": [],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.01"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "vs": {
                      "type": "string"
                    },
                    "prices": {
                      "type": "array"
                    }
                  },
                  "example": {
                    "vs": "usd",
                    "prices": [
                      {
                        "id": "bitcoin",
                        "price": 63151,
                        "change24hPct": -0.2,
                        "marketCap": 1267177736333
                      }
                    ]
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        },
        "parameters": [
          {
            "name": "ids",
            "in": "query",
            "required": true,
            "description": "Comma-separated CoinGecko coin ids, e.g. \"bitcoin,ethereum\"",
            "schema": {
              "type": "string",
              "description": "Comma-separated CoinGecko coin ids, e.g. \"bitcoin,ethereum\""
            }
          },
          {
            "name": "vs",
            "in": "query",
            "required": false,
            "description": "Quote currency, e.g. \"usd\", \"eur\" (default usd)",
            "schema": {
              "type": "string",
              "description": "Quote currency, e.g. \"usd\", \"eur\" (default usd)"
            }
          }
        ]
      }
    },
    "/api/crypto-market": {
      "get": {
        "operationId": "getCryptoMarket",
        "summary": "Crypto Market Data \u2014 rank, 24h high/low, volume, ATH",
        "description": "Rich market data for one or more cryptocurrencies: rank, 24h high/low, volume, ATH, and more.",
        "tags": [
          "crypto",
          "market-data",
          "finance",
          "trading"
        ],
        "security": [],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.01"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "vs": {
                      "type": "string"
                    },
                    "count": {
                      "type": "number"
                    },
                    "coins": {
                      "type": "array"
                    }
                  },
                  "example": {
                    "vs": "usd",
                    "count": 1,
                    "coins": [
                      {
                        "id": "bitcoin",
                        "symbol": "btc",
                        "name": "Bitcoin",
                        "rank": 1,
                        "price": 63151,
                        "marketCap": 1267177736333,
                        "volume24h": 28123456789,
                        "high24h": 63980,
                        "low24h": 61890,
                        "change24hPct": -0.2,
                        "circulatingSupply": 19780000,
                        "athPrice": 108786,
                        "athChangePct": -41.9
                      }
                    ]
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        },
        "parameters": [
          {
            "name": "ids",
            "in": "query",
            "required": true,
            "description": "Comma-separated CoinGecko coin ids, e.g. \"bitcoin,ethereum\"",
            "schema": {
              "type": "string",
              "description": "Comma-separated CoinGecko coin ids, e.g. \"bitcoin,ethereum\""
            }
          },
          {
            "name": "vs",
            "in": "query",
            "required": false,
            "description": "Quote currency, e.g. \"usd\", \"eur\" (default usd)",
            "schema": {
              "type": "string",
              "description": "Quote currency, e.g. \"usd\", \"eur\" (default usd)"
            }
          }
        ]
      }
    },
    "/api/crypto-trending": {
      "get": {
        "operationId": "getCryptoTrending",
        "summary": "Crypto Trending \u2014 top trending coins right now",
        "description": "Get the top trending cryptocurrencies right now, ranked by search interest.",
        "tags": [
          "crypto",
          "trending",
          "market-data",
          "finance"
        ],
        "security": [],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.01"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "count": {
                      "type": "number"
                    },
                    "coins": {
                      "type": "array"
                    }
                  },
                  "example": {
                    "count": 1,
                    "coins": [
                      {
                        "id": "pepe",
                        "name": "Pepe",
                        "symbol": "PEPE",
                        "marketCapRank": 28,
                        "priceUsd": 0.0000091,
                        "change24hPct": 5.3,
                        "marketCap": "$3.8B",
                        "volume24h": "$412M"
                      }
                    ]
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/web-search": {
      "get": {
        "operationId": "getWebSearch",
        "summary": "Web Search \u2014 real-time ranked results via Exa",
        "description": "Real-time web search (via Exa) \u2014 ranked results with title, URL, published date, author, and relevance score for a query.",
        "tags": [
          "search",
          "web-search",
          "data",
          "ai"
        ],
        "security": [],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.015"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "query": {
                      "type": "string"
                    },
                    "autopromptString": {
                      "type": "null"
                    },
                    "results": {
                      "type": "array"
                    }
                  },
                  "example": {
                    "query": "Base blockchain",
                    "autopromptString": null,
                    "results": [
                      {
                        "title": "Base (blockchain) - Wikipedia",
                        "url": "https://en.wikipedia.org/wiki/Base_(blockchain)",
                        "publishedDate": "2023-08-09",
                        "author": null,
                        "score": 0.87
                      }
                    ]
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        },
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "description": "Search query",
            "schema": {
              "type": "string",
              "description": "Search query"
            }
          },
          {
            "name": "numResults",
            "in": "query",
            "required": false,
            "description": "Number of results to return (1-10, default 5)",
            "schema": {
              "type": "integer",
              "description": "Number of results to return (1-10, default 5)"
            }
          }
        ]
      }
    },
    "/api/rpc": {
      "get": {
        "operationId": "getRpc",
        "summary": "Multi-Chain RPC \u2014 safelisted read-only JSON-RPC proxy",
        "description": "Safelisted read-only JSON-RPC proxy across major EVM chains (base, ethereum, polygon, arbitrum, optimism) \u2014 eth_call, eth_getBalance, eth_getTransactionReceipt, eth_getBlockByNumber, and more.",
        "tags": [
          "rpc",
          "ethereum",
          "on-chain",
          "blockchain",
          "infrastructure"
        ],
        "security": [],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.01"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "chain": {
                      "type": "string"
                    },
                    "method": {
                      "type": "string"
                    },
                    "result": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "chain": "Base",
                    "method": "eth_blockNumber",
                    "result": "0x1234567"
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        },
        "parameters": [
          {
            "name": "chain",
            "in": "query",
            "required": false,
            "description": "Chain to query: base, ethereum, polygon, arbitrum, optimism (default base)",
            "schema": {
              "type": "string",
              "description": "Chain to query: base, ethereum, polygon, arbitrum, optimism (default base)"
            }
          },
          {
            "name": "method",
            "in": "query",
            "required": true,
            "description": "Read-only JSON-RPC method name, e.g. eth_getBalance, eth_call, eth_blockNumber",
            "schema": {
              "type": "string",
              "description": "Read-only JSON-RPC method name, e.g. eth_getBalance, eth_call, eth_blockNumber"
            }
          },
          {
            "name": "params",
            "in": "query",
            "required": false,
            "description": "JSON-encoded array of RPC params, e.g. [\"0xabc...\",\"latest\"] (default [])",
            "schema": {
              "type": "string",
              "description": "JSON-encoded array of RPC params, e.g. [\"0xabc...\",\"latest\"] (default [])"
            }
          }
        ]
      }
    },
    "/api/wallet-balance": {
      "get": {
        "operationId": "getWalletBalance",
        "summary": "Wallet Balance Lookup \u2014 native + ERC-20 balance",
        "description": "Native and (optional) ERC-20 token balance for a wallet address across major EVM chains (base, ethereum, polygon, arbitrum, optimism).",
        "tags": [
          "wallet",
          "balance",
          "ethereum",
          "on-chain",
          "blockchain",
          "erc20"
        ],
        "security": [],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.01"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "chain": {
                      "type": "string"
                    },
                    "address": {
                      "type": "string"
                    },
                    "native": {
                      "type": "object"
                    },
                    "token": {
                      "type": "object"
                    }
                  },
                  "example": {
                    "chain": "Base",
                    "address": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
                    "native": {
                      "symbol": "ETH",
                      "balance": "1.24031"
                    },
                    "token": {
                      "address": "0x8335...",
                      "symbol": "USDC",
                      "decimals": 6,
                      "balance": "500.0"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        },
        "parameters": [
          {
            "name": "address",
            "in": "query",
            "required": true,
            "description": "EVM wallet address (0x...)",
            "schema": {
              "type": "string",
              "description": "EVM wallet address (0x...)"
            }
          },
          {
            "name": "chain",
            "in": "query",
            "required": false,
            "description": "Chain to query: base, ethereum, polygon, arbitrum, optimism (default base)",
            "schema": {
              "type": "string",
              "description": "Chain to query: base, ethereum, polygon, arbitrum, optimism (default base)"
            }
          },
          {
            "name": "token",
            "in": "query",
            "required": false,
            "description": "Optional ERC-20 token contract address to also check",
            "schema": {
              "type": "string",
              "description": "Optional ERC-20 token contract address to also check"
            }
          }
        ]
      }
    },
    "/api/gas-price": {
      "get": {
        "operationId": "getGasPrice",
        "summary": "Gas Price Oracle \u2014 current gas + EIP-1559 estimate",
        "description": "Current gas price and EIP-1559 fee estimate for a chain (base, ethereum, polygon, arbitrum, optimism).",
        "tags": [
          "gas",
          "ethereum",
          "on-chain",
          "blockchain",
          "fees"
        ],
        "security": [],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.01"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "chain": {
                      "type": "string"
                    },
                    "nativeSymbol": {
                      "type": "string"
                    },
                    "gasPriceGwei": {
                      "type": "number"
                    },
                    "maxFeePerGasGwei": {
                      "type": "number"
                    },
                    "maxPriorityFeePerGasGwei": {
                      "type": "number"
                    }
                  },
                  "example": {
                    "chain": "Base",
                    "nativeSymbol": "ETH",
                    "gasPriceGwei": 0.012,
                    "maxFeePerGasGwei": 0.015,
                    "maxPriorityFeePerGasGwei": 0.001
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        },
        "parameters": [
          {
            "name": "chain",
            "in": "query",
            "required": false,
            "description": "Chain to query: base, ethereum, polygon, arbitrum, optimism (default base)",
            "schema": {
              "type": "string",
              "description": "Chain to query: base, ethereum, polygon, arbitrum, optimism (default base)"
            }
          }
        ]
      }
    },
    "/api/ens-resolve": {
      "get": {
        "operationId": "getEnsResolve",
        "summary": "ENS Resolver \u2014 name \u2194 address resolution",
        "description": "Resolve an ENS name to an address, or reverse-resolve an address to its primary ENS name.",
        "tags": [
          "ens",
          "ethereum",
          "on-chain",
          "identity",
          "domains"
        ],
        "security": [],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.01"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "address": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "name": "vitalik.eth",
                    "address": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        },
        "parameters": [
          {
            "name": "name",
            "in": "query",
            "required": false,
            "description": "ENS name to resolve, e.g. \"vitalik.eth\"",
            "schema": {
              "type": "string",
              "description": "ENS name to resolve, e.g. \"vitalik.eth\""
            }
          },
          {
            "name": "address",
            "in": "query",
            "required": false,
            "description": "EVM address to reverse-resolve to its primary ENS name",
            "schema": {
              "type": "string",
              "description": "EVM address to reverse-resolve to its primary ENS name"
            }
          }
        ]
      }
    },
    "/api/prediction-arb": {
      "get": {
        "operationId": "getPredictionArb",
        "summary": "Prediction Market Divergence \u2014 same question on Polymarket and Kalshi, checked and priced",
        "description": "Same question priced differently on Polymarket and Kalshi. Each pair passes outcome-name (fuzzy), number, close-date (within 7 days when both are real dates), negation and key-term checks (e.g. win vs run, president vs vice president), and Kalshi must have a two-sided quote. Returns live bid/ask on both venues, the cost of a full hedge (YES on one venue + NO on the other) the gross edge, and the edge after estimated taker fees (Kalshi 0.07 x P x (1-P) per contract; Polymarket's per-market fee schedule; slippage not included), plus both rule texts so the buyer can confirm the questions resolve the same way. If no pair passes, the response is 404 and is not charged. Upstream data is cached for up to 60 seconds.",
        "tags": [
          "prediction-markets",
          "polymarket",
          "kalshi",
          "arbitrage",
          "crypto",
          "finance",
          "trading"
        ],
        "security": [],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.05"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "At least one checked pair (example abbreviated, from a live run on 2026-10-31)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "count": {
                      "type": "integer"
                    },
                    "scanned": {
                      "type": "object"
                    },
                    "rejectedPairs": {
                      "type": "object",
                      "description": "How many candidate pairs each check removed"
                    },
                    "note": {
                      "type": "string"
                    },
                    "matches": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "confidence": {
                            "type": "string",
                            "enum": [
                              "high",
                              "medium",
                              "low"
                            ]
                          },
                          "matchScore": {
                            "type": "number"
                          },
                          "divergencePct": {
                            "type": "number"
                          },
                          "cheaperYesOn": {
                            "type": "string",
                            "enum": [
                              "polymarket",
                              "kalshi"
                            ]
                          },
                          "hedge": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "properties": {
                              "buyYesOn": {
                                "type": "string"
                              },
                              "hedgeCost": {
                                "type": "number",
                                "description": "Price of YES on one venue + NO on the other; pays $1 either way"
                              },
                              "grossEdgePct": {
                                "type": "number",
                                "description": "100 x (1 - hedgeCost), before fees and slippage"
                              },
                              "estFees": {
                                "type": "number",
                                "description": "Estimated taker fees for one YES + one NO contract, in dollars"
                              },
                              "netEdgePct": {
                                "type": "number",
                                "description": "100 x (1 - hedgeCost - estFees); slippage not included"
                              },
                              "polymarketFeeRate": {
                                "type": [
                                  "number",
                                  "null"
                                ],
                                "description": "Polymarket fee rate for this market (null = not published; 0.05 assumed)"
                              }
                            }
                          },
                          "warnings": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "polymarket": {
                            "type": "object",
                            "properties": {
                              "yesProbability": {
                                "type": "number"
                              },
                              "yesBid": {
                                "type": [
                                  "number",
                                  "null"
                                ]
                              },
                              "yesAsk": {
                                "type": [
                                  "number",
                                  "null"
                                ]
                              },
                              "rules": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "description": "First 400 characters of the venue's resolution text"
                              },
                              "question": {
                                "type": "string"
                              },
                              "outcome": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "url": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "endDate": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            }
                          },
                          "kalshi": {
                            "type": "object",
                            "properties": {
                              "yesProbability": {
                                "type": "number"
                              },
                              "yesBid": {
                                "type": [
                                  "number",
                                  "null"
                                ]
                              },
                              "yesAsk": {
                                "type": [
                                  "number",
                                  "null"
                                ]
                              },
                              "rules": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "description": "First 400 characters of the venue's resolution text"
                              },
                              "title": {
                                "type": "string"
                              },
                              "outcome": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "ticker": {
                                "type": "string"
                              },
                              "closeTime": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "example": {
                    "query": null,
                    "minDivergencePct": 2,
                    "minEdgePct": null,
                    "sort": "edge",
                    "count": 1,
                    "scanned": {
                      "polymarket": 1543,
                      "kalshi": 7590,
                      "kalshiPartial": true,
                      "asOf": "2026-10-31T23:05:33.874Z"
                    },
                    "rejectedPairs": {
                      "negation": 0,
                      "qualifier": 5,
                      "number": 0,
                      "outcome": 1,
                      "date": 0
                    },
                    "matches": [
                      {
                        "confidence": "medium",
                        "matchScore": 0.613,
                        "divergencePct": 7.15,
                        "cheaperYesOn": "polymarket",
                        "hedge": {
                          "buyYesOn": "polymarket",
                          "hedgeCost": 0.963,
                          "grossEdgePct": 3.7
                        },
                        "warnings": [
                          "Close dates could not be compared."
                        ],
                        "polymarket": {
                          "question": "Will Gadi Eizenkot be the next Prime Minister of Israel?",
                          "outcome": "Gadi Eizenkot"
                        },
                        "kalshi": {
                          "title": "Will Gadi Eisenkot be the next Prime Minister of Israel?",
                          "outcome": "Gadi Eisenkot"
                        }
                      }
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameter"
          },
          "402": {
            "description": "Payment Required"
          },
          "404": {
            "description": "No pair passed every check with these filters (not charged)"
          },
          "502": {
            "description": "Polymarket or Kalshi unavailable"
          }
        },
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Optional keyword filter on question or outcome text",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Max pairs to return, 1-25 (default 10)",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 25,
              "default": 10
            }
          },
          {
            "name": "minDivergencePct",
            "in": "query",
            "required": false,
            "description": "Minimum gap between the two Yes prices, in points (default 2)",
            "schema": {
              "type": "number",
              "minimum": 0,
              "maximum": 100,
              "default": 2
            }
          },
          {
            "name": "minEdgePct",
            "in": "query",
            "required": false,
            "description": "Optional minimum hedge edge after estimated fees, in points",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "description": "edge (default, after estimated fees) or divergence",
            "schema": {
              "type": "string",
              "enum": [
                "edge",
                "divergence"
              ],
              "default": "edge"
            }
          }
        ]
      }
    },
    "/api/gold-index": {
      "post": {
        "operationId": "postGoldIndex",
        "summary": "Gold Source Indexing \u2014 exact-span document index with SHA-256 fingerprints",
        "description": "Index a document into a hierarchical tree of sections and content blocks without rewriting it. Send the document in the request body, never in the URL or query string, as one of: JSON {\"text\": \"...\"} or {\"url\": \"...\"}; a raw text/plain body (optional ?filename= label); or multipart/form-data with a \"file\" field (plain text, HTML/XHTML or PDF). Request bodies are limited to 4,194,304 bytes and each request to 60 s. Every node carries a half-open [start, end) span in UTF-16 code units (start inclusive, end exclusive) such that canonicalText.slice(start, end) is the node's full text, its full section path, and a SHA-256 fingerprint of that span. goldMeta.coverage reports whether any non-whitespace text was left out. For text input the canonical text is the submitted string; for \"url\" and file input it is the extracted text, returned as source.canonicalText. Stateless: the whole index comes back in this response. Unpaid requests get HTTP 402 before the body is read; a request that fails with any error status is not charged. GET is not supported and returns 405.",
        "tags": [
          "indexing",
          "documents",
          "rag-alternative",
          "legal",
          "financial",
          "compliance"
        ],
        "security": [],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.05"
          },
          "protocols": [
            {
              "x402": {
                "scheme": "exact"
              }
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GoldIndexRequest"
              },
              "example": {
                "text": "SERVICES AGREEMENT\n\nARTICLE 1 - SERVICES\nProvider will deliver the Services described in Exhibit A.\n\nARTICLE 2 - FEES\nClient pays $2,500 per month, due within 30 days of invoice.\nLate amounts accrue interest as set out in Section 2.3.",
                "filename": "services-agreement.txt"
              }
            },
            "text/plain": {
              "schema": {
                "type": "string",
                "minLength": 50,
                "maxLength": 1000000
              },
              "example": "SERVICES AGREEMENT\n\nARTICLE 1 - SERVICES\nProvider will deliver the Services described in Exhibit A.\n\nARTICLE 2 - FEES\nClient pays $2,500 per month, due within 30 days of invoice.\nLate amounts accrue interest as set out in Section 2.3."
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/GoldIndexUpload"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The index. Example generated by scripts/gold-index-openapi.mjs from the gold-index-v2 engine.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GoldIndexResponse"
                },
                "example": {
                  "goldMeta": {
                    "filename": "services-agreement.txt",
                    "hash": "2ab4a039efcc241763219a21f101fb51ffaec73696f0e3fd99f1c3ed01122f01",
                    "hashAlgorithm": "sha256",
                    "hashInput": "UTF-8 bytes of the hashed text (whole canonical text, or canonicalText.slice(start, end) per node); hex digest",
                    "charLength": 234,
                    "offsetUnit": "utf16-code-unit",
                    "spanConvention": "half-open [start, end): canonicalText.slice(start, end) is the full node text",
                    "indexVersion": "gold-index-v2.1",
                    "indexedAt": "2026-10-18T14:35:26.900Z",
                    "nodeCount": 5,
                    "coverage": {
                      "indexedNonWhitespaceChars": 193,
                      "totalNonWhitespaceChars": 193,
                      "complete": true
                    }
                  },
                  "source": {
                    "type": "text",
                    "canonicalization": "verbatim-input",
                    "note": "Canonical text is the submitted \"text\" value exactly as received; it is not echoed back."
                  },
                  "tree": {
                    "id": "root",
                    "type": "DOCUMENT_ROOT",
                    "title": "services-agreement.txt",
                    "goldHash": "2ab4a039efcc241763219a21f101fb51ffaec73696f0e3fd99f1c3ed01122f01",
                    "totalChars": 234,
                    "level": 0,
                    "sectionPath": [],
                    "children": [
                      {
                        "id": "idx_1",
                        "type": "SECTION",
                        "title": "SERVICES AGREEMENT",
                        "level": 2,
                        "sectionPath": [
                          "SERVICES AGREEMENT"
                        ],
                        "charStart": 0,
                        "charEnd": 18,
                        "goldPointer": {
                          "start": 0,
                          "end": 18,
                          "excerpt": "SERVICES AGREEMENT",
                          "excerptLength": 18,
                          "excerptTruncated": false,
                          "fullTextHash": "0d30420bd386658aa52a1cfbf1eb8e2e71095d42cc5cb82accdc18f283211588",
                          "lineRange": [
                            0,
                            0
                          ]
                        },
                        "children": [],
                        "keywords": [],
                        "entities": [],
                        "summary": null
                      },
                      {
                        "id": "idx_2",
                        "type": "SECTION",
                        "title": "ARTICLE 1 - SERVICES",
                        "level": 1,
                        "sectionPath": [
                          "ARTICLE 1 - SERVICES"
                        ],
                        "charStart": 20,
                        "charEnd": 40,
                        "goldPointer": {
                          "start": 20,
                          "end": 40,
                          "excerpt": "ARTICLE 1 - SERVICES",
                          "excerptLength": 20,
                          "excerptTruncated": false,
                          "fullTextHash": "6a75606bef13f06ed6132c6c61a547351eb8d83cad12eaa20a2cce95608f1616",
                          "lineRange": [
                            2,
                            2
                          ]
                        },
                        "children": [
                          {
                            "id": "idx_3",
                            "type": "CONTENT_BLOCK",
                            "title": "Under: ARTICLE 1 - SERVICES",
                            "level": 2,
                            "sectionPath": [
                              "ARTICLE 1 - SERVICES"
                            ],
                            "charStart": 41,
                            "charEnd": 99,
                            "goldPointer": {
                              "start": 41,
                              "end": 99,
                              "excerpt": "Provider will deliver the Services described in Exhibit A.",
                              "excerptLength": 58,
                              "excerptTruncated": false,
                              "fullTextHash": "d2ac11db04426bce54e63f80879d42f0004e957fd4ca81596058db562a8c7974",
                              "lineRange": [
                                3,
                                3
                              ]
                            },
                            "content": {
                              "summary": "Provider will deliver the Services described in Exhibit A.",
                              "keywords": [
                                {
                                  "term": "provider",
                                  "freq": 1
                                },
                                {
                                  "term": "deliver",
                                  "freq": 1
                                },
                                {
                                  "term": "services",
                                  "freq": 1
                                },
                                {
                                  "term": "described",
                                  "freq": 1
                                },
                                {
                                  "term": "exhibit",
                                  "freq": 1
                                }
                              ],
                              "entities": [],
                              "charLength": 58,
                              "sentenceCount": 1
                            },
                            "children": []
                          }
                        ],
                        "keywords": [],
                        "entities": [],
                        "summary": null
                      },
                      {
                        "id": "idx_4",
                        "type": "SECTION",
                        "title": "ARTICLE 2 - FEES",
                        "level": 1,
                        "sectionPath": [
                          "ARTICLE 2 - FEES"
                        ],
                        "charStart": 101,
                        "charEnd": 117,
                        "goldPointer": {
                          "start": 101,
                          "end": 117,
                          "excerpt": "ARTICLE 2 - FEES",
                          "excerptLength": 16,
                          "excerptTruncated": false,
                          "fullTextHash": "6f5cc84500bf8fc699094123d99b6b5cac4c67a7a3fc0f99948458b71271599f",
                          "lineRange": [
                            5,
                            5
                          ]
                        },
                        "children": [
                          {
                            "id": "idx_5",
                            "type": "CONTENT_BLOCK",
                            "title": "Under: ARTICLE 2 - FEES",
                            "level": 2,
                            "sectionPath": [
                              "ARTICLE 2 - FEES"
                            ],
                            "charStart": 118,
                            "charEnd": 234,
                            "goldPointer": {
                              "start": 118,
                              "end": 234,
                              "excerpt": "Client pays $2,500 per month, due within 30 days of invoice.\nLate amounts accrue interest as set out in Section 2.3.",
                              "excerptLength": 116,
                              "excerptTruncated": false,
                              "fullTextHash": "9b0f8493d3e0850df24cada785afe76e2f6b8b26f08af0ac8596ebd9684c4bf9",
                              "lineRange": [
                                6,
                                7
                              ]
                            },
                            "content": {
                              "summary": "Client pays $2,500 per month, due within 30 days of invoice",
                              "keywords": [
                                {
                                  "term": "client",
                                  "freq": 1
                                },
                                {
                                  "term": "pays",
                                  "freq": 1
                                },
                                {
                                  "term": "month",
                                  "freq": 1
                                },
                                {
                                  "term": "within",
                                  "freq": 1
                                },
                                {
                                  "term": "days",
                                  "freq": 1
                                },
                                {
                                  "term": "invoice",
                                  "freq": 1
                                },
                                {
                                  "term": "late",
                                  "freq": 1
                                },
                                {
                                  "term": "amounts",
                                  "freq": 1
                                }
                              ],
                              "entities": [
                                {
                                  "type": "MONEY",
                                  "value": "$2,500",
                                  "index": 12,
                                  "start": 130,
                                  "end": 136
                                },
                                {
                                  "type": "REFERENCE",
                                  "value": "Section 2.3.",
                                  "index": 104,
                                  "start": 222,
                                  "end": 234
                                }
                              ],
                              "charLength": 116,
                              "sentenceCount": 2
                            },
                            "children": []
                          }
                        ],
                        "keywords": [],
                        "entities": [],
                        "summary": null
                      }
                    ],
                    "metadata": {
                      "createdAt": "2026-10-18T14:35:26.896Z",
                      "indexingModel": "gold-index-v2.1 (vectorless, rule-based)",
                      "principle": "Canonical text is immutable. Index only points."
                    }
                  },
                  "invertedIndex": {
                    "provider": [
                      {
                        "nodeId": "idx_3",
                        "freq": 1,
                        "title": "Under: ARTICLE 1 - SERVICES"
                      }
                    ],
                    "deliver": [
                      {
                        "nodeId": "idx_3",
                        "freq": 1,
                        "title": "Under: ARTICLE 1 - SERVICES"
                      }
                    ],
                    "services": [
                      {
                        "nodeId": "idx_3",
                        "freq": 1,
                        "title": "Under: ARTICLE 1 - SERVICES"
                      }
                    ],
                    "described": [
                      {
                        "nodeId": "idx_3",
                        "freq": 1,
                        "title": "Under: ARTICLE 1 - SERVICES"
                      }
                    ],
                    "exhibit": [
                      {
                        "nodeId": "idx_3",
                        "freq": 1,
                        "title": "Under: ARTICLE 1 - SERVICES"
                      }
                    ],
                    "client": [
                      {
                        "nodeId": "idx_5",
                        "freq": 1,
                        "title": "Under: ARTICLE 2 - FEES"
                      }
                    ],
                    "pays": [
                      {
                        "nodeId": "idx_5",
                        "freq": 1,
                        "title": "Under: ARTICLE 2 - FEES"
                      }
                    ],
                    "month": [
                      {
                        "nodeId": "idx_5",
                        "freq": 1,
                        "title": "Under: ARTICLE 2 - FEES"
                      }
                    ],
                    "within": [
                      {
                        "nodeId": "idx_5",
                        "freq": 1,
                        "title": "Under: ARTICLE 2 - FEES"
                      }
                    ],
                    "days": [
                      {
                        "nodeId": "idx_5",
                        "freq": 1,
                        "title": "Under: ARTICLE 2 - FEES"
                      }
                    ],
                    "invoice": [
                      {
                        "nodeId": "idx_5",
                        "freq": 1,
                        "title": "Under: ARTICLE 2 - FEES"
                      }
                    ],
                    "late": [
                      {
                        "nodeId": "idx_5",
                        "freq": 1,
                        "title": "Under: ARTICLE 2 - FEES"
                      }
                    ],
                    "amounts": [
                      {
                        "nodeId": "idx_5",
                        "freq": 1,
                        "title": "Under: ARTICLE 2 - FEES"
                      }
                    ]
                  },
                  "log": [
                    {
                      "id": "log_1",
                      "timestamp": "2026-10-18T14:35:26.890Z",
                      "elapsedMs": 4,
                      "step": "INIT",
                      "level": "info",
                      "reasoning": "Received document for gold-source indexing. The canonical text is never modified, only referenced.",
                      "input": {
                        "filename": "services-agreement.txt",
                        "charLength": 234,
                        "offsetUnit": "utf16-code-unit"
                      },
                      "output": {}
                    },
                    {
                      "id": "log_2",
                      "timestamp": "2026-10-18T14:35:26.895Z",
                      "elapsedMs": 6,
                      "step": "GOLD_HASH",
                      "level": "info",
                      "reasoning": "Computed SHA-256 digest of the canonical text.",
                      "input": {
                        "hashAlgorithm": "sha256"
                      },
                      "output": {
                        "goldHash": "2ab4a039efcc241763219a21f101fb51ffaec73696f0e3fd99f1c3ed01122f01",
                        "length": 234
                      }
                    },
                    {
                      "id": "log_3",
                      "timestamp": "2026-10-18T14:35:26.896Z",
                      "elapsedMs": 7,
                      "step": "STRUCTURE_SCAN",
                      "level": "info",
                      "reasoning": "Scanned lines for headings (Markdown, legal, numbered, all-caps, lettered) and grouped the text between them into blocks.",
                      "input": {
                        "patternsChecked": 6
                      },
                      "output": {
                        "nodesDetected": 5,
                        "headings": 3,
                        "blocks": 2,
                        "durationMs": 1
                      }
                    },
                    {
                      "id": "log_4",
                      "timestamp": "2026-10-18T14:35:26.900Z",
                      "elapsedMs": 11,
                      "step": "TREE_COMPLETE",
                      "level": "info",
                      "reasoning": "Built the hierarchical index; every node span round-trips against the canonical text.",
                      "input": {
                        "totalNodes": 5
                      },
                      "output": {
                        "structure": "DOCUMENT_ROOT -> SECTION* -> CONTENT_BLOCK*",
                        "coverage": {
                          "indexedNonWhitespaceChars": 193,
                          "totalNonWhitespaceChars": 193,
                          "complete": true
                        }
                      }
                    },
                    {
                      "id": "log_5",
                      "timestamp": "2026-10-18T14:35:26.900Z",
                      "elapsedMs": 11,
                      "step": "INVERTED_INDEX",
                      "level": "info",
                      "reasoning": "Built inverted keyword index.",
                      "input": {
                        "uniqueTerms": 13
                      },
                      "output": {}
                    },
                    {
                      "id": "log_6",
                      "timestamp": "2026-10-18T14:35:26.900Z",
                      "elapsedMs": 11,
                      "step": "XREF_MAP",
                      "level": "info",
                      "reasoning": "Mapped internal cross-references.",
                      "input": {},
                      "output": {
                        "crossRefsFound": 1
                      }
                    }
                  ],
                  "message": "Gold source indexed. Canonical text preserved, every node span round-trips against it."
                }
              }
            }
          },
          "400": {
            "description": "JSON body is not valid JSON; Multipart body has no \"file\" field or cannot be read; Neither \"text\" nor \"url\" given; Both given; \"text\" or \"url\" not a string; \"text\" shorter than 50; URL invalid, not http(s), contains credentials, uses a port other than 80/443, or points to (or resolves to) a non-public address.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Payment Required. The response body is empty; the price, network and payTo address (scheme \"exact\") are in the base64-encoded JSON payment-required response header, under accepts."
          },
          "405": {
            "description": "GET or another method other than POST (the body says to use POST and links this spec; not charged).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request body over 4,194,304 bytes; Text (pasted, uploaded or extracted) longer than 1,000,000 characters; Download over 5 MB, or over 10 MB after decompression.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Request Content-Type is not application/json, text/plain or multipart/form-data; Uploaded file is not plain text, HTML, XHTML or PDF; URL content type is not HTML, XHTML, plain text or PDF.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Less than 50 characters of readable text extracted from a URL or uploaded file (message says if a bot-check page was detected); PDF could not be read; PDF needed too much memory.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "PDF support unavailable on the server; Unexpected internal error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Hostname did not resolve; Upstream returned a non-2xx status; Bad or unsupported content-encoding; More than 3 redirects, or an invalid redirect; Connection failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "504": {
            "description": "Hostname lookup or download exceeded 15 s; Connect exceeded 5 s; PDF parsing exceeded 10 s (parsing is stopped); Whole request exceeded the 60 s execution limit (the platform stops the function).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "GoldIndexRequest": {
        "type": "object",
        "description": "Send exactly one of \"text\" or \"url\". Any other field is ignored.",
        "properties": {
          "text": {
            "type": "string",
            "minLength": 50,
            "maxLength": 1000000,
            "description": "Document text to index, 50 to 1,000,000 UTF-16 code units. This exact string is the canonical text all spans refer to."
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "Public http:// or https:// URL (ports 80/443, no credentials) of an HTML, XHTML, plain-text or PDF document. Private, loopback and cloud-metadata addresses are refused. Limits: 3 redirects, 15 s total, 5 MB download (10 MB decompressed). Only the first 50 PDF pages are parsed, within 10 s. The extracted text must be 50 to 1,000,000 characters and is returned as source.canonicalText."
          },
          "filename": {
            "type": "string",
            "description": "Optional label. Defaults to \"document.txt\" for text, or host + path for a URL."
          }
        },
        "oneOf": [
          {
            "required": [
              "text"
            ]
          },
          {
            "required": [
              "url"
            ]
          }
        ]
      },
      "GoldIndexResponse": {
        "type": "object",
        "required": [
          "goldMeta",
          "source",
          "tree",
          "invertedIndex",
          "log",
          "message"
        ],
        "properties": {
          "goldMeta": {
            "$ref": "#/components/schemas/GoldIndexMeta"
          },
          "source": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/GoldIndexTextSource"
              },
              {
                "$ref": "#/components/schemas/GoldIndexUrlSource"
              },
              {
                "$ref": "#/components/schemas/GoldIndexFileSource"
              }
            ]
          },
          "tree": {
            "$ref": "#/components/schemas/GoldIndexRoot"
          },
          "invertedIndex": {
            "type": "object",
            "description": "Keyword (lower-case) -> content blocks containing it.",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "nodeId": {
                    "type": "string"
                  },
                  "freq": {
                    "type": "integer"
                  },
                  "title": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "log": {
            "type": "array",
            "description": "Processing steps. Contains counts and settings only, never document text.",
            "items": {
              "$ref": "#/components/schemas/GoldIndexLogEntry"
            }
          },
          "message": {
            "type": "string",
            "const": "Gold source indexed. Canonical text preserved, every node span round-trips against it."
          }
        }
      },
      "GoldIndexMeta": {
        "type": "object",
        "properties": {
          "filename": {
            "type": "string"
          },
          "hash": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "description": "SHA-256 of the UTF-8 bytes of the whole canonical text."
          },
          "hashAlgorithm": {
            "type": "string",
            "const": "sha256"
          },
          "hashInput": {
            "type": "string",
            "const": "UTF-8 bytes of the hashed text (whole canonical text, or canonicalText.slice(start, end) per node); hex digest"
          },
          "charLength": {
            "type": "integer",
            "minimum": 0,
            "description": "Length of the canonical text in UTF-16 code units."
          },
          "offsetUnit": {
            "type": "string",
            "const": "utf16-code-unit"
          },
          "spanConvention": {
            "type": "string",
            "const": "half-open [start, end): canonicalText.slice(start, end) is the full node text"
          },
          "indexVersion": {
            "type": "string",
            "const": "gold-index-v2.1"
          },
          "indexedAt": {
            "type": "string",
            "format": "date-time"
          },
          "nodeCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of SECTION and CONTENT_BLOCK nodes."
          },
          "coverage": {
            "type": "object",
            "description": "Non-whitespace characters covered by node spans vs. in the whole text. complete=true means no non-whitespace text was left out of the index.",
            "properties": {
              "indexedNonWhitespaceChars": {
                "type": "integer",
                "minimum": 0
              },
              "totalNonWhitespaceChars": {
                "type": "integer",
                "minimum": 0
              },
              "complete": {
                "type": "boolean"
              }
            }
          }
        }
      },
      "GoldIndexTextSource": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "text"
          },
          "canonicalization": {
            "type": "string",
            "const": "verbatim-input"
          },
          "note": {
            "type": "string"
          },
          "bodyType": {
            "type": "string",
            "const": "text/plain",
            "description": "Present only when the document was sent as a text/plain body."
          }
        }
      },
      "GoldIndexUrlSource": {
        "type": "object",
        "description": "Returned for \"url\" input.",
        "properties": {
          "type": {
            "type": "string",
            "const": "url"
          },
          "url": {
            "type": "string"
          },
          "finalUrl": {
            "type": "string",
            "description": "URL after redirects."
          },
          "redirects": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of redirects followed."
          },
          "contentType": {
            "type": "string"
          },
          "extractedFrom": {
            "type": "string",
            "enum": [
              "article",
              "main",
              "body",
              "text-plain",
              "pdf-text"
            ]
          },
          "canonicalization": {
            "type": "string",
            "const": "url-text-v2"
          },
          "pdfPages": {
            "type": "integer",
            "minimum": 0,
            "description": "PDF only: total pages in the file."
          },
          "pdfPagesParsed": {
            "type": "integer",
            "minimum": 0,
            "description": "PDF only: pages whose text was extracted (at most 50)."
          },
          "canonicalText": {
            "type": "string",
            "description": "The extracted text. Every span and hash in the response refers to this string."
          }
        }
      },
      "GoldIndexPointer": {
        "type": "object",
        "description": "canonicalText.slice(start, end) is the full node text; its SHA-256 is fullTextHash.",
        "properties": {
          "start": {
            "type": "integer",
            "minimum": 0,
            "description": "Inclusive start offset, UTF-16 code units."
          },
          "end": {
            "type": "integer",
            "minimum": 0,
            "description": "Exclusive end offset, UTF-16 code units."
          },
          "excerpt": {
            "type": "string",
            "description": "Prefix of the node text (up to 200 chars for headings, 300 for blocks)."
          },
          "excerptLength": {
            "type": "integer",
            "minimum": 0
          },
          "excerptTruncated": {
            "type": "boolean"
          },
          "fullTextHash": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "description": "SHA-256 of the UTF-8 bytes of canonicalText.slice(start, end)."
          },
          "lineRange": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 0
            },
            "minItems": 2,
            "maxItems": 2,
            "description": "[first line, last line], zero-based, inclusive."
          }
        }
      },
      "GoldIndexEntity": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "DATE",
              "MONEY",
              "REFERENCE",
              "DEFINITION"
            ]
          },
          "value": {
            "type": "string",
            "description": "Equals canonicalText.slice(start, end)."
          },
          "index": {
            "type": "integer",
            "minimum": 0,
            "description": "Offset within the block."
          },
          "start": {
            "type": "integer",
            "minimum": 0,
            "description": "Inclusive start offset in the canonical text."
          },
          "end": {
            "type": "integer",
            "minimum": 0,
            "description": "Exclusive end offset in the canonical text."
          }
        }
      },
      "GoldIndexNode": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/GoldIndexSection"
          },
          {
            "$ref": "#/components/schemas/GoldIndexContentBlock"
          }
        ],
        "discriminator": {
          "propertyName": "type",
          "mapping": {
            "SECTION": "#/components/schemas/GoldIndexSection",
            "CONTENT_BLOCK": "#/components/schemas/GoldIndexContentBlock"
          }
        }
      },
      "GoldIndexSection": {
        "type": "object",
        "description": "A heading. Its span covers the heading line; the text under it is in its CONTENT_BLOCK children.",
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "const": "SECTION"
          },
          "title": {
            "type": "string",
            "description": "Full heading text, including any number."
          },
          "level": {
            "type": "integer",
            "minimum": 0
          },
          "sectionPath": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Heading titles from the top of the document down to and including this one."
          },
          "charStart": {
            "type": "integer",
            "minimum": 0,
            "description": "Same as goldPointer.start."
          },
          "charEnd": {
            "type": "integer",
            "minimum": 0,
            "description": "Same as goldPointer.end."
          },
          "goldPointer": {
            "$ref": "#/components/schemas/GoldIndexPointer"
          },
          "children": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GoldIndexNode"
            }
          },
          "keywords": {
            "type": "array",
            "maxItems": 0
          },
          "entities": {
            "type": "array",
            "maxItems": 0
          },
          "summary": {
            "type": "null"
          }
        }
      },
      "GoldIndexContentBlock": {
        "type": "object",
        "description": "The text between two headings.",
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "const": "CONTENT_BLOCK"
          },
          "title": {
            "type": "string",
            "description": "\"Under: <heading>\", or \"Block <n>\" before the first heading."
          },
          "level": {
            "type": "integer",
            "minimum": 0
          },
          "sectionPath": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Heading titles of the sections containing this block."
          },
          "charStart": {
            "type": "integer",
            "minimum": 0,
            "description": "Same as goldPointer.start."
          },
          "charEnd": {
            "type": "integer",
            "minimum": 0,
            "description": "Same as goldPointer.end."
          },
          "goldPointer": {
            "$ref": "#/components/schemas/GoldIndexPointer"
          },
          "content": {
            "type": "object",
            "properties": {
              "summary": {
                "type": "string",
                "description": "First sentence of the block (up to 220 chars), copied, not generated."
              },
              "keywords": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "term": {
                      "type": "string"
                    },
                    "freq": {
                      "type": "integer"
                    }
                  }
                }
              },
              "entities": {
                "type": "array",
                "maxItems": 25,
                "items": {
                  "$ref": "#/components/schemas/GoldIndexEntity"
                }
              },
              "charLength": {
                "type": "integer",
                "minimum": 0
              },
              "sentenceCount": {
                "type": "integer",
                "minimum": 0
              }
            }
          },
          "children": {
            "type": "array",
            "maxItems": 0
          }
        }
      },
      "GoldIndexRoot": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "const": "root"
          },
          "type": {
            "type": "string",
            "const": "DOCUMENT_ROOT"
          },
          "title": {
            "type": "string"
          },
          "goldHash": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "description": "Same as goldMeta.hash."
          },
          "totalChars": {
            "type": "integer",
            "minimum": 0
          },
          "level": {
            "type": "integer",
            "const": 0
          },
          "sectionPath": {
            "type": "array",
            "maxItems": 0
          },
          "children": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GoldIndexNode"
            }
          },
          "metadata": {
            "type": "object",
            "properties": {
              "createdAt": {
                "type": "string",
                "format": "date-time"
              },
              "indexingModel": {
                "type": "string"
              },
              "principle": {
                "type": "string"
              }
            }
          }
        }
      },
      "GoldIndexLogEntry": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "timestamp": {
            "type": "string",
            "format": "date-time"
          },
          "elapsedMs": {
            "type": "integer",
            "minimum": 0
          },
          "step": {
            "type": "string"
          },
          "level": {
            "type": "string",
            "enum": [
              "info",
              "warn"
            ]
          },
          "reasoning": {
            "type": "string"
          },
          "input": {
            "type": "object"
          },
          "output": {
            "type": "object"
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string",
            "description": "Human-readable message. No machine-readable code is returned; branch on the HTTP status."
          }
        }
      },
      "GoldIndexUpload": {
        "type": "object",
        "description": "multipart/form-data upload. The extracted text is the canonical text and is returned as source.canonicalText.",
        "required": [
          "file"
        ],
        "properties": {
          "file": {
            "type": "string",
            "format": "binary",
            "description": "The document: plain text (.txt, .md), HTML/XHTML or PDF. Text is read as UTF-8 unchanged; HTML and PDF are extracted with the same rules as \"url\" input (first 50 PDF pages, within 10 s). The type is taken from the part's Content-Type, or from the file extension."
          },
          "filename": {
            "type": "string",
            "description": "Optional label. Defaults to the uploaded file name."
          }
        }
      },
      "GoldIndexFileSource": {
        "type": "object",
        "description": "Returned for multipart \"file\" input.",
        "properties": {
          "type": {
            "type": "string",
            "const": "file"
          },
          "uploadName": {
            "type": "string"
          },
          "contentType": {
            "type": "string"
          },
          "bytes": {
            "type": "integer",
            "minimum": 0
          },
          "extractedFrom": {
            "type": "string",
            "enum": [
              "article",
              "main",
              "body",
              "text-plain",
              "pdf-text"
            ]
          },
          "canonicalization": {
            "type": "string",
            "const": "url-text-v2"
          },
          "pdfPages": {
            "type": "integer",
            "minimum": 0,
            "description": "PDF only: total pages in the file."
          },
          "pdfPagesParsed": {
            "type": "integer",
            "minimum": 0,
            "description": "PDF only: pages whose text was extracted (at most 50)."
          },
          "canonicalText": {
            "type": "string",
            "description": "The extracted text. Every span and hash in the response refers to this string."
          }
        }
      }
    }
  }
}
