{
  "openapi": "3.1.0",
  "info": {
    "title": "ViewerTracker public aggregate coverage",
    "version": "1.0.0",
    "description": "Selected existing read-only v1 service. Best-effort availability; no private API or new authentication. See public-api.md for limits and interpretation."
  },
  "servers": [
    {
      "url": "https://api.viewertracker.io"
    }
  ],
  "paths": {
    "/api/v1/public/platform-stats": {
      "get": {
        "operationId": "getPublicCoverage",
        "summary": "Read the shared aggregate coverage snapshot",
        "security": [],
        "description": "No parameters or credentials. Poll at most once per 30 seconds. Existing fixed-minute limit 120 requests per observed client identity, with Retry-After 60 on 429. Cache-Control public max-age=5; Cloudflare shared API bypass remains. Never replace null or errors with zero.",
        "responses": {
          "200": {
            "description": "Snapshot, including genuine stale or unavailable state.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string"
                },
                "description": "public, max-age=5"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Coverage"
                }
              }
            }
          },
          "429": {
            "description": "Existing request limit; wait before retry.",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "60 seconds"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "detail": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "detail"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Infrastructure failure, including unavailable rate-limit storage. Treat as unavailable; do not infer zero."
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Coverage": {
        "type": "object",
        "properties": {
          "live_hosts_monitored": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "maximum": 10000000,
            "description": "Verified lower bound, not all TikTok LIVE hosts or customer count. Null means unavailable."
          },
          "source": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "global_firehose_coverage",
              null
            ]
          },
          "coverage": {
            "type": [
              "string",
              "null"
            ]
          },
          "observed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Actual successful observation time; never retrieval time."
          },
          "refresh_interval_seconds": {
            "type": "integer",
            "const": 30
          },
          "freshness": {
            "type": "string",
            "enum": [
              "fresh",
              "stale",
              "unavailable"
            ]
          },
          "age_seconds": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          }
        },
        "required": [
          "live_hosts_monitored",
          "source",
          "coverage",
          "observed_at",
          "refresh_interval_seconds",
          "freshness",
          "age_seconds"
        ],
        "additionalProperties": true
      }
    }
  }
}
