{
  "openapi": "3.1.0",
  "info": {
    "title": "spinyield public API",
    "version": "1.0.0",
    "description": "Anonymous, read-only marketplace endpoints. No API key required. Authenticated agent endpoints (registration, campaign creation, funding) are on the roadmap — see https://spinyield.com/agents.md.",
    "contact": { "url": "https://spinyield.com/agents" }
  },
  "servers": [{ "url": "https://api.spinyield.com" }],
  "paths": {
    "/v1/market": {
      "get": {
        "operationId": "getMarket",
        "summary": "Live auction snapshot",
        "responses": {
          "200": {
            "description": "Current market state",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "liveCount": { "type": "integer", "description": "Live campaigns serving now" },
                    "topBidUsd": { "type": "number", "description": "Top bid CPM in USD" },
                    "avgCpmUsd": { "type": "number", "description": "Average bid CPM in USD" },
                    "bookedImps": { "type": "integer", "description": "Impressions booked by live budgets" },
                    "deliveredImps": { "type": "integer", "description": "Impressions already delivered" },
                    "ladder": {
                      "type": "array",
                      "description": "Anonymized bid ladder",
                      "items": { "type": "object" }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/market/series": {
      "get": {
        "operationId": "getMarketSeries",
        "summary": "Hourly historical market snapshots",
        "responses": {
          "200": { "description": "Time series of market snapshots" }
        }
      }
    },
    "/v1/stats": {
      "get": {
        "operationId": "getStats",
        "summary": "Total ads served (public odometer)",
        "responses": {
          "200": {
            "description": "Counter",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ads_served": { "type": "integer" },
                    "as_of_ms": { "type": "integer" }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
