{
  "openapi": "3.1.0",
  "jsonSchemaDialect": "http://json-schema.org/draft-07/schema#",
  "info": {
    "title": "Better Beans public catalog",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://betterbeans.com"
    }
  ],
  "paths": {
    "/api/v1/products": {
      "get": {
        "operationId": "listProducts",
        "summary": "Traverse products by stable UUID cursor",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "variant_id",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "roaster_id",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "origin",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "roast",
            "in": "query",
            "schema": {
              "enum": [
                "Light",
                "Medium-Light",
                "Medium",
                "Medium-Dark",
                "Dark"
              ]
            }
          },
          {
            "name": "type",
            "in": "query",
            "schema": {
              "enum": [
                "Single Origin",
                "Blend",
                "Flavored"
              ]
            }
          },
          {
            "name": "decaf",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "available",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current public entities; total counts entities, never variants",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "https://betterbeans.com/developers/catalog.schema.json#/definitions/ProductPage"
                }
              }
            }
          },
          "304": {
            "description": "ETag unchanged"
          },
          "400": {
            "description": "Invalid or unsupported query"
          },
          "429": {
            "description": "Origin read quota exceeded; retry in 60 seconds"
          },
          "503": {
            "description": "Temporarily unavailable; retry or reduce page size"
          }
        }
      }
    },
    "/api/v1/roasters": {
      "get": {
        "operationId": "listRoasters",
        "summary": "Traverse roasters by stable UUID cursor",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "state",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[A-Z]{2}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current public entities; total counts entities, never variants",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "https://betterbeans.com/developers/catalog.schema.json#/definitions/RoasterPage"
                }
              }
            }
          },
          "304": {
            "description": "ETag unchanged"
          },
          "400": {
            "description": "Invalid or unsupported query"
          },
          "429": {
            "description": "Origin read quota exceeded; retry in 60 seconds"
          },
          "503": {
            "description": "Temporarily unavailable; retry or reduce page size"
          }
        }
      }
    },
    "/api/v1/facets": {
      "get": {
        "operationId": "getFacets",
        "summary": "Accepted non-price filter values and published hubs",
        "responses": {
          "200": {
            "description": "Filter enums and qualified hub links"
          },
          "429": {
            "description": "Read quota exceeded"
          },
          "503": {
            "description": "Temporarily unavailable"
          }
        }
      }
    },
    "/api/v1/variants/{id}/history": {
      "get": {
        "summary": "Validated current observation revisions for a public variant",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Latest 500 points within the requested interval (default 90 days, maximum 366); truncated indicates a narrower interval is needed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "https://betterbeans.com/developers/history.schema.json"
                }
              }
            }
          },
          "304": {
            "description": "Unchanged ETag"
          },
          "400": {
            "description": "Invalid ID or date range"
          },
          "404": {
            "description": "No public variant"
          },
          "429": {
            "description": "Rate limited; retry after 60 seconds"
          },
          "503": {
            "description": "Temporarily unavailable"
          }
        }
      }
    }
  }
}
