{
  "openapi": "3.1.0",
  "info": {
    "title": "Game Images API",
    "version": "1.1",
    "description": "Given a game name and a provider, returns Stake lobby art (thumbnailUrl) as WebP at configurable sizes.\n\nDefault sizes: 400×400, 400×300, 300×400. Override with `sizes`, `GAME_IMAGES_SIZES`, or `config.json`.\n\nImages always come from Stake (Chile GraphQL). Extended mode adds SlotCatalog stats. SlotCatalog images are never used.\n\nDocs: `/docs/en` (English), `/docs/es` (Spanish).\n",
    "contact": {
      "name": "Game Images API"
    }
  },
  "servers": [
    {
      "url": "https://grabbr.jailbroken.tech",
      "description": "Public (Arena)"
    },
    {
      "url": "http://127.0.0.1:8790",
      "description": "Local loopback"
    }
  ],
  "tags": [
    {
      "name": "images"
    },
    {
      "name": "catalog"
    },
    {
      "name": "media"
    },
    {
      "name": "meta"
    }
  ],
  "paths": {
    "/v1/images": {
      "get": {
        "tags": [
          "images"
        ],
        "summary": "Resolve official art and return WebP variants",
        "operationId": "getImages",
        "parameters": [
          {
            "$ref": "#/components/parameters/Name"
          },
          {
            "$ref": "#/components/parameters/Game"
          },
          {
            "$ref": "#/components/parameters/Provider"
          },
          {
            "$ref": "#/components/parameters/SizesQuery"
          },
          {
            "$ref": "#/components/parameters/Format"
          },
          {
            "$ref": "#/components/parameters/Mode"
          },
          {
            "$ref": "#/components/parameters/Extended"
          }
        ],
        "responses": {
          "200": {
            "description": "Full object or bare images array when format=array",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ImagesResponse"
                    },
                    {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ImageObject"
                      }
                    }
                  ]
                },
                "examples": {
                  "full": {
                    "summary": "Azure Roulette (measured)",
                    "value": {
                      "game": "Roulette Azure",
                      "query": "azure roulette",
                      "provider": "pragmatic-play-live",
                      "providerLabel": "Pragmatic Play Live",
                      "source": {
                        "url": "https://mediumrare.imgix.net/...",
                        "kind": "stake-thumbnail",
                        "page": "https://stake1017.com/casino/games/..."
                      },
                      "images": [
                        {
                          "id": "square",
                          "size": "400x400",
                          "width": 400,
                          "height": 400,
                          "format": "webp",
                          "url": "http://127.0.0.1:8790/media/1f976b03a7d9dde1cb54/400x400.webp",
                          "path": "/media/1f976b03a7d9dde1cb54/400x400.webp",
                          "bytes": 28968
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "404": {
            "$ref": "#/components/responses/NotFoundGame"
          },
          "502": {
            "$ref": "#/components/responses/Upstream"
          }
        }
      },
      "post": {
        "tags": [
          "images"
        ],
        "summary": "Same as GET, JSON body",
        "operationId": "postImages",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImagesRequest"
              },
              "examples": {
                "azure": {
                  "value": {
                    "name": "azure roulette",
                    "provider": "Pragmatic Play Live"
                  }
                },
                "customSizes": {
                  "value": {
                    "name": "Gates of Olympus",
                    "provider": "Pragmatic Play",
                    "sizes": [
                      {
                        "id": "square",
                        "width": 400,
                        "height": 400
                      },
                      {
                        "id": "poster",
                        "width": 900,
                        "height": 1200
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Full object or bare array",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ImagesResponse"
                    },
                    {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ImageObject"
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "404": {
            "$ref": "#/components/responses/NotFoundGame"
          },
          "502": {
            "$ref": "#/components/responses/Upstream"
          }
        }
      }
    },
    "/v1/info": {
      "get": {
        "tags": [
          "catalog"
        ],
        "summary": "SlotCatalog-style metadata only (no images)",
        "operationId": "getInfo",
        "parameters": [
          {
            "$ref": "#/components/parameters/Name"
          },
          {
            "$ref": "#/components/parameters/Game"
          },
          {
            "$ref": "#/components/parameters/Provider"
          }
        ],
        "responses": {
          "200": {
            "description": "Stats found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InfoResponse"
                },
                "examples": {
                  "bloodSuckers": {
                    "summary": "Blood Suckers / NetEnt",
                    "value": {
                      "game": "Blood Suckers",
                      "query": "Blood Suckers",
                      "provider": "netent",
                      "providerLabel": "NetEnt",
                      "mode": "extended",
                      "info": {
                        "found": true,
                        "source": "slotcatalog",
                        "page": "https://slotcatalog.com/en/slots/Blood-Suckers",
                        "name": "Blood Suckers",
                        "providerName": "NetEnt",
                        "providerPage": "https://slotcatalog.com/en/soft/NetEnt",
                        "rtp": "98%",
                        "rtpValue": 98,
                        "rtpRanges": true,
                        "variance": "Low",
                        "maxWin": "x1014.00",
                        "maxWinValue": 1014,
                        "betways": "25",
                        "betwaysValue": 25,
                        "releaseDate": "2013-11-10"
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not in SlotCatalog search",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InfoResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "catalog"
        ],
        "summary": "Same as GET /v1/info",
        "operationId": "postInfo",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "game": {
                    "type": "string"
                  },
                  "provider": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Stats found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InfoResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InfoResponse"
                }
              }
            }
          }
        }
      }
    },
    "/media/{key}/{dim}.webp": {
      "get": {
        "tags": [
          "media"
        ],
        "summary": "Binary WebP generated by /v1/images",
        "operationId": "getMedia",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{20}$"
            },
            "example": "1f976b03a7d9dde1cb54"
          },
          {
            "name": "dim",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+x[0-9]+$"
            },
            "example": "400x400"
          }
        ],
        "responses": {
          "200": {
            "description": "WebP bytes",
            "content": {
              "image/webp": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "404": {
            "description": "Bad path or missing file",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/providers": {
      "get": {
        "tags": [
          "catalog"
        ],
        "summary": "Canonical provider ids, labels, aliases",
        "operationId": "listProviders",
        "responses": {
          "200": {
            "description": "Provider list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProvidersResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/sizes": {
      "get": {
        "tags": [
          "catalog"
        ],
        "summary": "Default size list currently loaded",
        "operationId": "listSizes",
        "responses": {
          "200": {
            "description": "Sizes",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SizesResponse"
                }
              }
            }
          }
        }
      }
    },
    "/health": {
      "get": {
        "tags": [
          "meta"
        ],
        "summary": "Liveness",
        "operationId": "health",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "service"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "example": true
                    },
                    "service": {
                      "type": "string",
                      "example": "game-images-api"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/": {
      "get": {
        "tags": [
          "meta"
        ],
        "summary": "Tester UI",
        "operationId": "testerUi",
        "responses": {
          "200": {
            "description": "HTML tester",
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/docs": {
      "get": {
        "tags": [
          "meta"
        ],
        "summary": "Documentation index (EN / ES)",
        "operationId": "docsIndex",
        "responses": {
          "200": {
            "description": "HTML index",
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/docs/en": {
      "get": {
        "tags": [
          "meta"
        ],
        "summary": "English HTML docs",
        "operationId": "docsEn",
        "responses": {
          "200": {
            "description": "HTML",
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/docs/es": {
      "get": {
        "tags": [
          "meta"
        ],
        "summary": "Spanish HTML docs",
        "operationId": "docsEs",
        "responses": {
          "200": {
            "description": "HTML",
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/openapi.yaml": {
      "get": {
        "tags": [
          "meta"
        ],
        "summary": "This OpenAPI document",
        "operationId": "openapiYaml",
        "responses": {
          "200": {
            "description": "YAML",
            "content": {
              "application/yaml": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/openapi.json": {
      "get": {
        "tags": [
          "meta"
        ],
        "summary": "This OpenAPI document as JSON",
        "operationId": "openapiJson",
        "responses": {
          "200": {
            "description": "JSON",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "parameters": {
      "Name": {
        "name": "name",
        "in": "query",
        "required": false,
        "description": "Game title. Required unless `game` is set.",
        "schema": {
          "type": "string"
        },
        "example": "azure roulette"
      },
      "Game": {
        "name": "game",
        "in": "query",
        "required": false,
        "description": "Alias of `name`.",
        "schema": {
          "type": "string"
        }
      },
      "Provider": {
        "name": "provider",
        "in": "query",
        "required": true,
        "description": "Provider label, id, or alias (case-insensitive).",
        "schema": {
          "type": "string"
        },
        "example": "pragmatic play live"
      },
      "SizesQuery": {
        "name": "sizes",
        "in": "query",
        "required": false,
        "description": "Comma-separated WIDTHxHEIGHT. Range 16–4000 per side.",
        "schema": {
          "type": "string"
        },
        "example": "400x400,400x300,300x400"
      },
      "Format": {
        "name": "format",
        "in": "query",
        "required": false,
        "description": "`array` returns only the images array.",
        "schema": {
          "type": "string",
          "enum": [
            "array"
          ]
        }
      },
      "Mode": {
        "name": "mode",
        "in": "query",
        "required": false,
        "description": "`extended` attaches SlotCatalog stats in `info`. Images stay official.",
        "schema": {
          "type": "string",
          "enum": [
            "extended",
            "info",
            "full"
          ]
        }
      },
      "Extended": {
        "name": "extended",
        "in": "query",
        "required": false,
        "description": "`1` / `true` — same as mode=extended.",
        "schema": {
          "type": "string"
        }
      }
    },
    "schemas": {
      "SizeSpec": {
        "type": "object",
        "required": [
          "width",
          "height"
        ],
        "properties": {
          "id": {
            "type": "string",
            "example": "square"
          },
          "width": {
            "type": "integer",
            "minimum": 16,
            "maximum": 4000
          },
          "height": {
            "type": "integer",
            "minimum": 16,
            "maximum": 4000
          }
        }
      },
      "ImagesRequest": {
        "type": "object",
        "required": [
          "provider"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "game": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "sizes": {
            "oneOf": [
              {
                "type": "string",
                "example": "400x400,900x1200"
              },
              {
                "type": "array",
                "items": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/SizeSpec"
                    },
                    {
                      "type": "string"
                    }
                  ]
                }
              }
            ]
          },
          "format": {
            "type": "string",
            "enum": [
              "array"
            ]
          },
          "mode": {
            "type": "string",
            "enum": [
              "extended",
              "info",
              "full"
            ]
          },
          "extended": {
            "type": "boolean"
          }
        }
      },
      "Source": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "kind": {
            "type": "string",
            "enum": [
              "stake-thumbnail"
            ]
          },
          "symbol": {
            "type": [
              "string",
              "null"
            ]
          },
          "page": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "ImageObject": {
        "type": "object",
        "required": [
          "id",
          "size",
          "width",
          "height",
          "format",
          "url",
          "path",
          "bytes"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "size": {
            "type": "string",
            "example": "400x400"
          },
          "width": {
            "type": "integer"
          },
          "height": {
            "type": "integer"
          },
          "format": {
            "type": "string",
            "enum": [
              "webp"
            ]
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "path": {
            "type": "string",
            "example": "/media/1f976b03a7d9dde1cb54/400x400.webp"
          },
          "bytes": {
            "type": "integer"
          }
        }
      },
      "ImagesResponse": {
        "type": "object",
        "required": [
          "game",
          "query",
          "provider",
          "providerLabel",
          "source",
          "images"
        ],
        "properties": {
          "game": {
            "type": "string"
          },
          "query": {
            "type": "string"
          },
          "provider": {
            "type": "string",
            "example": "pragmatic-play-live"
          },
          "providerLabel": {
            "type": "string"
          },
          "source": {
            "$ref": "#/components/schemas/Source"
          },
          "images": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ImageObject"
            }
          },
          "mode": {
            "type": "string",
            "example": "extended"
          },
          "info": {
            "$ref": "#/components/schemas/InfoObject"
          },
          "imagesError": {
            "type": "string"
          }
        }
      },
      "InfoObject": {
        "type": "object",
        "properties": {
          "found": {
            "type": "boolean"
          },
          "source": {
            "type": "string",
            "example": "slotcatalog"
          },
          "page": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "providerName": {
            "type": [
              "string",
              "null"
            ],
            "example": "NetEnt"
          },
          "providerPage": {
            "type": [
              "string",
              "null"
            ]
          },
          "rtp": {
            "type": [
              "string",
              "null"
            ],
            "example": "98%"
          },
          "rtpValue": {
            "type": [
              "number",
              "null"
            ]
          },
          "rtpRanges": {
            "type": "boolean"
          },
          "variance": {
            "type": [
              "string",
              "null"
            ],
            "example": "Low"
          },
          "maxWin": {
            "type": [
              "string",
              "null"
            ],
            "example": "x1014.00"
          },
          "maxWinValue": {
            "type": [
              "number",
              "null"
            ]
          },
          "betways": {
            "type": [
              "string",
              "null"
            ]
          },
          "betwaysValue": {
            "type": [
              "integer",
              "null"
            ]
          },
          "releaseDate": {
            "type": [
              "string",
              "null"
            ],
            "example": "2013-11-10"
          },
          "type": {
            "type": [
              "string",
              "null"
            ]
          },
          "layout": {
            "type": [
              "string",
              "null"
            ]
          },
          "features": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "themes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "rating": {
            "type": [
              "string",
              "null"
            ]
          },
          "cached": {
            "type": "boolean"
          }
        }
      },
      "InfoResponse": {
        "type": "object",
        "properties": {
          "game": {
            "type": "string"
          },
          "query": {
            "type": "string"
          },
          "provider": {
            "type": [
              "string",
              "null"
            ]
          },
          "providerLabel": {
            "type": [
              "string",
              "null"
            ]
          },
          "mode": {
            "type": "string",
            "example": "extended"
          },
          "info": {
            "$ref": "#/components/schemas/InfoObject"
          }
        }
      },
      "Provider": {
        "type": "object",
        "required": [
          "id",
          "label",
          "aliases"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "aliases": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "ProvidersResponse": {
        "type": "object",
        "required": [
          "providers"
        ],
        "properties": {
          "providers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Provider"
            }
          }
        }
      },
      "SizesResponse": {
        "type": "object",
        "required": [
          "sizes"
        ],
        "properties": {
          "sizes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SizeSpec"
            }
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "known": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "game": {
            "type": "string"
          }
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Validation error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "missing": {
                "value": {
                  "error": "name and provider are required"
                }
              },
              "unknownProvider": {
                "value": {
                  "error": "unknown provider",
                  "provider": "unknown",
                  "known": [
                    "Pragmatic Play",
                    "Pragmatic Play Live",
                    "KAGaming",
                    "Ruby Play",
                    "Evolution Gaming",
                    "Booming Games",
                    "100HP",
                    "Ezugi",
                    "Live Vegas"
                  ]
                }
              }
            }
          }
        }
      },
      "NotFoundGame": {
        "description": "No official image or unknown route",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Upstream": {
        "description": "Fetch/decode/render failure",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    }
  }
}
