{
  "components": {
    "schemas": {
      "CoverageDay": {
        "properties": {
          "date": {
            "format": "date",
            "type": "string"
          },
          "products": {
            "minimum": 0,
            "type": "integer"
          },
          "retailer": {
            "enum": [
              "lcbo",
              "beerstore",
              "bcliquor",
              "saq",
              "urbancellars",
              "liquormarts",
              "nlliquor",
              "nslc",
              "anbl"
            ],
            "type": "string"
          },
          "status": {
            "enum": [
              "complete",
              "partial",
              "missing"
            ],
            "type": "string"
          },
          "stores": {
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "retailer",
          "date",
          "status",
          "products",
          "stores"
        ],
        "type": "object"
      },
      "DayPrice": {
        "properties": {
          "date": {
            "format": "date",
            "type": "string"
          },
          "on_sale": {
            "type": "boolean"
          },
          "price": {
            "type": [
              "string",
              "null"
            ]
          },
          "price_old": {
            "type": [
              "string",
              "null"
            ]
          },
          "store_count": {
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "date",
          "on_sale",
          "store_count"
        ],
        "type": "object"
      },
      "ErrorEnvelope": {
        "properties": {
          "error": {
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ],
            "type": "object"
          }
        },
        "required": [
          "error"
        ],
        "type": "object"
      },
      "Product": {
        "properties": {
          "abv_text": {
            "type": [
              "string",
              "null"
            ]
          },
          "brand": {
            "type": [
              "string",
              "null"
            ]
          },
          "categories": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "currency": {
            "type": "string"
          },
          "gtin12": {
            "type": [
              "string",
              "null"
            ]
          },
          "gtin13": {
            "type": [
              "string",
              "null"
            ]
          },
          "gtin14": {
            "type": [
              "string",
              "null"
            ]
          },
          "image": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "observed_at": {
            "format": "date-time",
            "type": "string"
          },
          "on_sale": {
            "type": "boolean"
          },
          "price": {
            "description": "Exact CAD decimal string.",
            "type": [
              "string",
              "null"
            ]
          },
          "price_old": {
            "description": "Earlier shelf price as an exact CAD decimal string.",
            "type": [
              "string",
              "null"
            ]
          },
          "product_id": {
            "type": "string"
          },
          "province": {
            "type": "string"
          },
          "retailer": {
            "enum": [
              "lcbo",
              "beerstore",
              "bcliquor",
              "saq",
              "urbancellars",
              "liquormarts",
              "nlliquor",
              "nslc",
              "anbl"
            ],
            "type": "string"
          },
          "size_text": {
            "type": [
              "string",
              "null"
            ]
          },
          "sku": {
            "type": [
              "string",
              "null"
            ]
          },
          "snapshot_date": {
            "format": "date",
            "type": "string"
          },
          "source_url": {
            "format": "uri",
            "type": "string"
          },
          "store_count": {
            "minimum": 0,
            "type": "integer"
          },
          "upc": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "retailer",
          "product_id",
          "name",
          "province",
          "currency",
          "source_url",
          "observed_at",
          "categories",
          "on_sale",
          "store_count",
          "snapshot_date"
        ],
        "type": "object"
      },
      "Stock": {
        "properties": {
          "city": {
            "type": [
              "string",
              "null"
            ]
          },
          "in_stock": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "observed_at": {
            "format": "date-time",
            "type": "string"
          },
          "product_id": {
            "type": "string"
          },
          "quantity": {
            "type": [
              "number",
              "null"
            ]
          },
          "retailer": {
            "enum": [
              "lcbo",
              "beerstore",
              "bcliquor",
              "saq",
              "urbancellars",
              "liquormarts",
              "nlliquor",
              "nslc",
              "anbl"
            ],
            "type": "string"
          },
          "snapshot_date": {
            "format": "date",
            "type": "string"
          },
          "store_id": {
            "type": "string"
          },
          "store_name": {
            "type": "string"
          }
        },
        "required": [
          "retailer",
          "product_id",
          "store_id",
          "store_name",
          "snapshot_date",
          "observed_at"
        ],
        "type": "object"
      },
      "Store": {
        "properties": {
          "city": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_seen": {
            "format": "date",
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "province": {
            "type": "string"
          },
          "retailer": {
            "enum": [
              "lcbo",
              "beerstore",
              "bcliquor",
              "saq",
              "urbancellars",
              "liquormarts",
              "nlliquor",
              "nslc",
              "anbl"
            ],
            "type": "string"
          },
          "store_id": {
            "type": "string"
          }
        },
        "required": [
          "retailer",
          "store_id",
          "name",
          "province",
          "last_seen"
        ],
        "type": "object"
      }
    },
    "securitySchemes": {
      "BearerAuth": {
        "description": "BevSignal API key (bsk_...) or OAuth 2.1 access token (bsa_...).",
        "scheme": "bearer",
        "type": "http"
      }
    }
  },
  "info": {
    "contact": {
      "email": "support@bevsignal.io",
      "name": "BevSignal Support",
      "url": "https://bevsignal.io/contact"
    },
    "description": "Read-only REST API for observed Canadian liquor retail prices, store-level stock, daily price history, and collection coverage across 9 retailers.",
    "title": "BevSignal API",
    "version": "1.0.0"
  },
  "openapi": "3.1.0",
  "paths": {
    "/v1/coverage": {
      "get": {
        "description": "Returns per-retailer daily collection completeness (complete, partial, or missing).",
        "operationId": "getCoverage",
        "parameters": [
          {
            "description": "Optional retailer key filter.",
            "in": "query",
            "name": "retailer",
            "required": false,
            "schema": {
              "enum": [
                "lcbo",
                "beerstore",
                "bcliquor",
                "saq",
                "urbancellars",
                "liquormarts",
                "nlliquor",
                "nslc",
                "anbl"
              ],
              "type": "string"
            }
          },
          {
            "description": "Number of days ending at each retailer's latest collection day (1 to 90, default 7).",
            "in": "query",
            "name": "days",
            "required": false,
            "schema": {
              "default": 7,
              "maximum": 90,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "items": {
                        "$ref": "#/components/schemas/CoverageDay"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Daily coverage status"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Invalid request parameters"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Missing or invalid bearer token"
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Per-minute or daily plan limit reached"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Catalog temporarily unavailable"
          }
        },
        "summary": "Get daily collection coverage"
      }
    },
    "/v1/history": {
      "get": {
        "description": "Returns daily price, earlier price, sale flag, and store count for one product over up to 400 days.",
        "operationId": "getHistory",
        "parameters": [
          {
            "description": "Retailer key.",
            "in": "query",
            "name": "retailer",
            "required": true,
            "schema": {
              "enum": [
                "lcbo",
                "beerstore",
                "bcliquor",
                "saq",
                "urbancellars",
                "liquormarts",
                "nlliquor",
                "nslc",
                "anbl"
              ],
              "type": "string"
            }
          },
          {
            "description": "Retailer product_id.",
            "in": "query",
            "name": "product_id",
            "required": true,
            "schema": {
              "maxLength": 200,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "description": "Start date (YYYY-MM-DD). Defaults to 29 days before to.",
            "in": "query",
            "name": "from",
            "required": false,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "End date (YYYY-MM-DD). Defaults to the product's latest observed day.",
            "in": "query",
            "name": "to",
            "required": false,
            "schema": {
              "format": "date",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "items": {
                        "$ref": "#/components/schemas/DayPrice"
                      },
                      "type": "array"
                    },
                    "note": {
                      "description": "Present when the Free plan history window clamped the requested range.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Daily price history"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Invalid request parameters"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Missing or invalid bearer token"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Product not found"
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Per-minute or daily plan limit reached"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Catalog temporarily unavailable"
          }
        },
        "summary": "Get daily price history"
      }
    },
    "/v1/inventory": {
      "get": {
        "description": "Returns observed stock for one product across stores, or one store across products. Supply exactly one of product_id or store_id.",
        "operationId": "getInventory",
        "parameters": [
          {
            "description": "Retailer key.",
            "in": "query",
            "name": "retailer",
            "required": true,
            "schema": {
              "enum": [
                "lcbo",
                "beerstore",
                "bcliquor",
                "saq",
                "urbancellars",
                "liquormarts",
                "nlliquor",
                "nslc",
                "anbl"
              ],
              "type": "string"
            }
          },
          {
            "description": "List stock for this product across stores. Mutually exclusive with store_id.",
            "in": "query",
            "name": "product_id",
            "required": false,
            "schema": {
              "maxLength": 200,
              "type": "string"
            }
          },
          {
            "description": "List stock for this store across products. Mutually exclusive with product_id.",
            "in": "query",
            "name": "store_id",
            "required": false,
            "schema": {
              "maxLength": 200,
              "type": "string"
            }
          },
          {
            "description": "Page size, 1 to 100. Default 25.",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 25,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "Rows to skip, 0 to 10,000. Default 0.",
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "maximum": 10000,
              "minimum": 0,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "items": {
                        "$ref": "#/components/schemas/Stock"
                      },
                      "type": "array"
                    },
                    "has_more": {
                      "type": "boolean"
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "offset": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "data",
                    "limit",
                    "offset",
                    "has_more"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Observed inventory rows"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Invalid request parameters"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Missing or invalid bearer token"
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Per-minute or daily plan limit reached"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Catalog temporarily unavailable"
          }
        },
        "summary": "Get store-level stock"
      }
    },
    "/v1/products": {
      "get": {
        "description": "Finds beverage listings by case-insensitive substring in name or brand.",
        "operationId": "searchProducts",
        "parameters": [
          {
            "description": "Literal text matched in name or brand, ignoring case. Up to 200 bytes.",
            "in": "query",
            "name": "query",
            "required": true,
            "schema": {
              "maxLength": 200,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "description": "Optional retailer key filter.",
            "in": "query",
            "name": "retailer",
            "required": false,
            "schema": {
              "enum": [
                "lcbo",
                "beerstore",
                "bcliquor",
                "saq",
                "urbancellars",
                "liquormarts",
                "nlliquor",
                "nslc",
                "anbl"
              ],
              "type": "string"
            }
          },
          {
            "description": "Page size, 1 to 100. Default 25.",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 25,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "Rows to skip, 0 to 10,000. Default 0.",
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "maximum": 10000,
              "minimum": 0,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "items": {
                        "$ref": "#/components/schemas/Product"
                      },
                      "type": "array"
                    },
                    "has_more": {
                      "type": "boolean"
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "offset": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "data",
                    "limit",
                    "offset",
                    "has_more"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Matching products"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Invalid request parameters"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Missing or invalid bearer token"
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Per-minute or daily plan limit reached"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Catalog temporarily unavailable"
          }
        },
        "summary": "Search product listings"
      }
    },
    "/v1/products/{retailer}/{product_id}": {
      "get": {
        "description": "Returns one listing with every identifier the retailer publishes. Pass ?by=sku to look up by the retailer website's SKU.",
        "operationId": "getProduct",
        "parameters": [
          {
            "description": "Retailer key.",
            "in": "path",
            "name": "retailer",
            "required": true,
            "schema": {
              "enum": [
                "lcbo",
                "beerstore",
                "bcliquor",
                "saq",
                "urbancellars",
                "liquormarts",
                "nlliquor",
                "nslc",
                "anbl"
              ],
              "type": "string"
            }
          },
          {
            "description": "Retailer product_id, or SKU when by=sku.",
            "in": "path",
            "name": "product_id",
            "required": true,
            "schema": {
              "maxLength": 200,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "description": "Identifier type passed in product_id: product_id (default) or sku.",
            "in": "query",
            "name": "by",
            "required": false,
            "schema": {
              "default": "product_id",
              "enum": [
                "product_id",
                "sku"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Product"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Single product listing"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Invalid request parameters"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Missing or invalid bearer token"
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Product not found"
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Per-minute or daily plan limit reached"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Catalog temporarily unavailable"
          }
        },
        "summary": "Get a single product listing"
      }
    },
    "/v1/stores": {
      "get": {
        "description": "Finds stores by name or city and returns stable store IDs and last-seen dates.",
        "operationId": "searchStores",
        "parameters": [
          {
            "description": "Optional literal text matched in store name or city, ignoring case. Up to 200 bytes.",
            "in": "query",
            "name": "query",
            "required": false,
            "schema": {
              "maxLength": 200,
              "type": "string"
            }
          },
          {
            "description": "Optional retailer key filter.",
            "in": "query",
            "name": "retailer",
            "required": false,
            "schema": {
              "enum": [
                "lcbo",
                "beerstore",
                "bcliquor",
                "saq",
                "urbancellars",
                "liquormarts",
                "nlliquor",
                "nslc",
                "anbl"
              ],
              "type": "string"
            }
          },
          {
            "description": "Page size, 1 to 100. Default 25.",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 25,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "Rows to skip, 0 to 10,000. Default 0.",
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "maximum": 10000,
              "minimum": 0,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "items": {
                        "$ref": "#/components/schemas/Store"
                      },
                      "type": "array"
                    },
                    "has_more": {
                      "type": "boolean"
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "offset": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "data",
                    "limit",
                    "offset",
                    "has_more"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Matching stores"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Invalid request parameters"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Missing or invalid bearer token"
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Per-minute or daily plan limit reached"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Catalog temporarily unavailable"
          }
        },
        "summary": "Search retail stores"
      }
    }
  },
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "servers": [
    {
      "description": "BevSignal API",
      "url": "https://bevsignal.io"
    }
  ]
}
