{
  "openapi": "3.1.0",
  "info": {
    "title": "ToolsGambling Slot RTP & Operator Audits API",
    "version": "1.0.0",
    "description": "Source-cited slot RTP specifications, multi-variant math models, SHA-256 HTML receipt verification, batch lobby auditing, and regulated casino storefront RTP audits under CC BY 4.0.",
    "license": {
      "name": "CC BY 4.0",
      "url": "https://creativecommons.org/licenses/by/4.0/"
    }
  },
  "servers": [
    {
      "url": "https://toolsgambling.com"
    }
  ],
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      },
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  },
  "paths": {
    "/api/rtp/list": {
      "get": {
        "operationId": "searchRtpRegistry",
        "summary": "Search and paginate verified slot RTP records",
        "parameters": [
          { "name": "q", "in": "query", "schema": { "type": "string" } },
          { "name": "provider", "in": "query", "schema": { "type": "string" } },
          { "name": "game_type", "in": "query", "schema": { "type": "string" } },
          { "name": "has_variants", "in": "query", "schema": { "type": "string" } },
          { "name": "volatility", "in": "query", "schema": { "type": "string" } },
          { "name": "min_rtp", "in": "query", "schema": { "type": "number" } },
          { "name": "has_demo", "in": "query", "schema": { "type": "string" } },
          { "name": "sort", "in": "query", "schema": { "type": "string" } },
          { "name": "limit", "in": "query", "schema": { "type": "integer", "minimum": 1, "maximum": 200 } },
          { "name": "offset", "in": "query", "schema": { "type": "integer", "minimum": 0 } }
        ],
        "responses": {
          "200": { "description": "Paginated slot RTP dataset response with facets and source metadata" }
        }
      }
    },
    "/api/rtp/{slug}": {
      "get": {
        "operationId": "getSlotRtp",
        "summary": "Get full RTP specification, variants, and operator observations for one slot",
        "parameters": [
          { "name": "slug", "in": "path", "required": true, "schema": { "type": "string" } }
        ],
        "responses": {
          "200": { "description": "Slot record with provider headline RTP, variants, and source receipt" },
          "404": { "description": "Slot not found in registry" }
        }
      }
    },
    "/api/rtp/operators-export": {
      "get": {
        "operationId": "exportOperatorAudits",
        "summary": "Download audited casino operator RTP aggregates and per-brand game observations",
        "security": [{}, { "ApiKeyAuth": [] }, { "BearerAuth": [] }],
        "parameters": [
          { "name": "format", "in": "query", "schema": { "type": "string", "enum": ["json", "csv"] } },
          { "name": "operator", "in": "query", "schema": { "type": "string" } }
        ],
        "responses": {
          "200": { "description": "Operator audit summary or per-operator observed game builds" }
        }
      }
    },
    "/api/rtp/audit-list": {
      "post": {
        "operationId": "auditSlotList",
        "summary": "Batch audit pasted slot titles or casino lobby text for configurable RTP risk",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": { "type": "string" }
                },
                "required": ["text"]
              }
            }
          }
        },
        "responses": {
          "200": { "description": "Matched slots with min-max variants, risk classification, and floor average" }
        }
      }
    },
    "/api/rtp/changelog.xml": {
      "get": {
        "operationId": "getRtpChangelogRss",
        "summary": "RSS 2.0 feed of verified registry changes and cross-casino RTP splits",
        "responses": {
          "200": { "description": "Valid RSS 2.0 XML feed" }
        }
      }
    },
    "/api/evidence/{sha256}": {
      "get": {
        "operationId": "getEvidenceReceipt",
        "summary": "Verify a SHA-256 snapshot receipt against its provider source URL and fetch timestamp",
        "parameters": [
          { "name": "sha256", "in": "path", "required": true, "schema": { "type": "string" } }
        ],
        "responses": {
          "200": { "description": "Snapshot receipt metadata" },
          "404": { "description": "Receipt not found" }
        }
      }
    },
    "/api/rtp/history": {
      "get": {
        "operationId": "getSlotRtpHistory",
        "summary": "Fetch recorded weekly diff events filtered by slot or provider",
        "parameters": [
          { "name": "slot", "in": "query", "schema": { "type": "string" } },
          { "name": "provider", "in": "query", "schema": { "type": "string" } },
          { "name": "type", "in": "query", "schema": { "type": "string" } },
          { "name": "limit", "in": "query", "schema": { "type": "integer" } }
        ],
        "responses": {
          "200": { "description": "Dated changelog event items" }
        }
      }
    }
  }
}
