{
  "openapi": "3.0.3",
  "info": {
    "title": "GamingAPI — Casino Game Aggregator API",
    "description": "One REST API for 5,000+ casino games (slots, live casino, crash, lottery, sportsbook) from 150+ certified studios, with a seamless multi-currency wallet covering 120+ countries and USDT/BTC/ETH settlement. Sandbox keys available in minutes.",
    "version": "1.0.0",
    "termsOfService": "https://casinoapi.shop/terms",
    "contact": {
      "name": "GamingAPI Support",
      "url": "https://casinoapi.shop/contact",
      "email": "hello@casino-api.com"
    },
    "license": { "name": "Proprietary", "url": "https://casinoapi.shop/terms" }
  },
  "servers": [{ "url": "https://casinoapi.shop", "description": "Production" }],
  "externalDocs": { "description": "Integration docs", "url": "https://casinoapi.shop/docs" },
  "tags": [
    { "name": "Catalog", "description": "Game and provider catalog" },
    { "name": "Session", "description": "Game launch and round notifications" },
    { "name": "Account", "description": "Key identity and GGR balance" }
  ],
  "paths": {
    "/api/public/v1/whoami": {
      "get": {
        "tags": ["Account"],
        "summary": "Verify an API token",
        "description": "Returns the account, brand and currency bound to the supplied API token.",
        "parameters": [{ "$ref": "#/components/parameters/Token" }],
        "responses": {
          "200": { "description": "Token details", "content": { "application/json": { "schema": { "type": "object" } } } },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "403": { "$ref": "#/components/responses/Forbidden" }
        }
      }
    },
    "/api/public/v1/providers": {
      "get": {
        "tags": ["Catalog"],
        "summary": "List game providers",
        "description": "Returns the certified studios enabled for the account (Pragmatic Play, Evolution, PG Soft, JILI, Spribe and more).",
        "parameters": [{ "$ref": "#/components/parameters/Token" }],
        "responses": {
          "200": { "description": "Provider list", "content": { "application/json": { "schema": { "type": "object" } } } },
          "401": { "$ref": "#/components/responses/Unauthorized" }
        }
      }
    },
    "/api/public/v1/games": {
      "get": {
        "tags": ["Catalog"],
        "summary": "List games",
        "description": "Paginated game catalog, filterable by provider brand, search text and currency support.",
        "parameters": [
          { "$ref": "#/components/parameters/Token" },
          { "name": "brand_id", "in": "query", "schema": { "type": "integer" }, "description": "Filter by provider brand id." },
          { "name": "q", "in": "query", "schema": { "type": "string" }, "description": "Search by game name." },
          { "name": "limit", "in": "query", "schema": { "type": "integer", "maximum": 2000, "default": 500 } },
          { "name": "offset", "in": "query", "schema": { "type": "integer", "default": 0 } },
          { "name": "currency_supported", "in": "query", "schema": { "type": "string", "enum": ["0", "1"] }, "description": "Set to 1 to return only games supporting the account currency." }
        ],
        "responses": {
          "200": { "description": "Game list", "content": { "application/json": { "schema": { "type": "object" } } } },
          "401": { "$ref": "#/components/responses/Unauthorized" }
        }
      }
    },
    "/api/public/v1/launch": {
      "post": {
        "tags": ["Session"],
        "summary": "Launch a game session",
        "description": "Creates a player session and returns a game URL. Payload may be sent plain or AES-256 encrypted with the account secret.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["token", "user_id", "balance", "game_uid"],
                "properties": {
                  "token": { "type": "string", "description": "API token." },
                  "user_id": { "type": "string", "description": "Your player id (digits)." },
                  "balance": { "type": "number", "description": "Player balance in the account currency." },
                  "game_uid": { "type": "string", "description": "Game identifier from /games." },
                  "currency_code": { "type": "string", "example": "BDT" },
                  "language": { "type": "string", "example": "en" },
                  "return": { "type": "string", "format": "uri", "description": "Return URL after the player exits." },
                  "callback": { "type": "string", "format": "uri", "description": "Wallet callback URL." },
                  "payload": { "type": "string", "description": "Optional AES-256 encrypted payload replacing the plain fields." }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "Game URL", "content": { "application/json": { "schema": { "type": "object", "properties": { "game_url": { "type": "string", "format": "uri" }, "session_id": { "type": "string" } } } } } },
          "400": { "description": "Invalid payload" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "403": { "$ref": "#/components/responses/Forbidden" }
        }
      }
    },
    "/api/public/v1/demo": {
      "get": {
        "tags": ["Session"],
        "summary": "Launch a demo (fun play) game",
        "parameters": [
          { "$ref": "#/components/parameters/Token" },
          { "name": "game_uid", "in": "query", "required": true, "schema": { "type": "string" } }
        ],
        "responses": { "200": { "description": "Demo game URL" }, "401": { "$ref": "#/components/responses/Unauthorized" } }
      }
    },
    "/api/public/v1/ggr-balance": {
      "get": {
        "tags": ["Account"],
        "summary": "Read the GGR wallet balance",
        "parameters": [{ "$ref": "#/components/parameters/Token" }],
        "responses": { "200": { "description": "Balance and currency" }, "401": { "$ref": "#/components/responses/Unauthorized" } }
      }
    },
    "/api/public/v1/notify/{session_id}": {
      "post": {
        "tags": ["Session"],
        "summary": "Round notification callback",
        "description": "Called by the game server with bet, win and credit amounts for a round. GGR is computed as (bets - wins) x GGR rate and converted to the settlement currency.",
        "parameters": [{ "name": "session_id", "in": "path", "required": true, "schema": { "type": "string" } }],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "bet_amount": { "type": "number" },
                  "win_amount": { "type": "number" },
                  "credit_amount": { "type": "number" },
                  "serial_number": { "type": "string" }
                }
              }
            }
          }
        },
        "responses": { "200": { "description": "Round accepted" }, "404": { "description": "Unknown session" } }
      }
    }
  },
  "components": {
    "parameters": {
      "Token": { "name": "token", "in": "query", "required": true, "schema": { "type": "string" }, "description": "API token issued in the client panel." }
    },
    "responses": {
      "Unauthorized": { "description": "Invalid or missing API token" },
      "Forbidden": { "description": "Server IP not whitelisted" }
    }
  }
}
