{
  "openapi": "3.1.0",
  "jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
  "info": {
    "title": "Garde Public API",
    "version": "1.0.0-draft",
    "description": "DRAFT: not approved; no implementation authorized (docs/public-api-v1.md). Read-only. Every request needs `Authorization: Bearer <key>` with the scope listed on the operation. An unknown or repeated query parameter returns 400 `invalid_parameter`; any method other than GET returns 405 `method_not_allowed`. Enum values may be added in v1; clients must accept values they do not know."
  },
  "servers": [
    {
      "url": "https://withgarde.com/api/v1"
    }
  ],
  "paths": {
    "/winery": {
      "get": {
        "operationId": "getWinery",
        "summary": "The winery this API key belongs to",
        "security": [
          {
            "apiKey": [
              "winery:read"
            ]
          }
        ],
        "x-garde-scope": "winery:read",
        "x-garde-cost-class": "standard",
        "x-garde-pilot": true,
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicWinery"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_parameter`: A request parameter is unknown, repeated or invalid.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: A valid API key is required.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWWAuthenticate"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "`forbidden_scope`: The API key does not have the scope this endpoint requires.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited`: Rate limit exceeded. Retry after the number of seconds in Retry-After.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "500": {
            "description": "`internal_error`: An internal error occurred.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "`service_unavailable`: The service is temporarily unavailable.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/sessions": {
      "get": {
        "operationId": "listSessions",
        "summary": "List sessions, newest first by (enteredAt, id)",
        "security": [
          {
            "apiKey": [
              "sessions:read"
            ]
          }
        ],
        "x-garde-scope": "sessions:read",
        "x-garde-cost-class": "standard",
        "x-garde-pilot": true,
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Page size: an integer from 1 to 100. Default 50.",
            "schema": {
              "type": "string",
              "pattern": "^(?:[1-9][0-9]?|100)$"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque `nextCursor` from the previous page. Bound to the winery and the filter that produced it; reuse with another filter is `invalid_cursor`.",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{1,512}$"
            }
          },
          {
            "name": "flowType",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "cancel",
                "skip"
              ]
            }
          },
          {
            "name": "outcome",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "CANCELLED",
                "EXITED",
                "RETAINED",
                "REQUESTED",
                "SKIPPED",
                "GIFTED"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "outcome",
                "awaiting_confirmation",
                "in_progress"
              ]
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Inclusive lower bound on session entry time (UTC). Omitted: all time. Must be before `to` (or the request time), otherwise 400 `invalid_parameter`. ISO 8601 date-time in year 0001 or later (`0001-01-01T00:00:00Z`); an earlier instant is 400 `invalid_parameter`.",
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "Exclusive upper bound on session entry time (UTC). Omitted: the request time. ISO 8601 date-time in year 0001 or later (`0001-01-01T00:00:00Z`); an earlier instant is 400 `invalid_parameter`.",
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicSessionPage"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_parameter`: A request parameter is unknown, repeated or invalid. `invalid_cursor`: The cursor is invalid or does not match this request.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: A valid API key is required.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWWAuthenticate"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "`forbidden_scope`: The API key does not have the scope this endpoint requires.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited`: Rate limit exceeded. Retry after the number of seconds in Retry-After.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "500": {
            "description": "`internal_error`: An internal error occurred.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "`service_unavailable`: The service is temporarily unavailable.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/sessions/{id}": {
      "get": {
        "operationId": "getSession",
        "summary": "Get one session",
        "security": [
          {
            "apiKey": [
              "sessions:read"
            ]
          }
        ],
        "x-garde-scope": "sessions:read",
        "x-garde-cost-class": "standard",
        "x-garde-pilot": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Session ID.",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{1,128}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicSession"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_parameter`: A request parameter is unknown, repeated or invalid.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: A valid API key is required.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWWAuthenticate"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "`forbidden_scope`: The API key does not have the scope this endpoint requires.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "`not_found`: The resource was not found.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited`: Rate limit exceeded. Retry after the number of seconds in Retry-After.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "500": {
            "description": "`internal_error`: An internal error occurred.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "`service_unavailable`: The service is temporarily unavailable.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/sessions/{id}/events": {
      "get": {
        "operationId": "listSessionEvents",
        "summary": "List a session's events, oldest first by (createdAt, id)",
        "security": [
          {
            "apiKey": [
              "sessions:read"
            ]
          }
        ],
        "x-garde-scope": "sessions:read",
        "x-garde-cost-class": "standard",
        "x-garde-pilot": false,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Session ID.",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{1,128}$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Page size: an integer from 1 to 100. Default 50.",
            "schema": {
              "type": "string",
              "pattern": "^(?:[1-9][0-9]?|100)$"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque `nextCursor` from the previous page. Bound to the winery and the filter that produced it; reuse with another filter is `invalid_cursor`.",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{1,512}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicEventPage"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_parameter`: A request parameter is unknown, repeated or invalid. `invalid_cursor`: The cursor is invalid or does not match this request.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: A valid API key is required.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWWAuthenticate"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "`forbidden_scope`: The API key does not have the scope this endpoint requires.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "`not_found`: The resource was not found.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited`: Rate limit exceeded. Retry after the number of seconds in Retry-After.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "500": {
            "description": "`internal_error`: An internal error occurred.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "`service_unavailable`: The service is temporarily unavailable.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/analytics/summary": {
      "get": {
        "operationId": "getAnalyticsSummary",
        "summary": "Cancel-flow summary counts (dashboard parity)",
        "security": [
          {
            "apiKey": [
              "analytics:read"
            ]
          }
        ],
        "x-garde-scope": "analytics:read",
        "x-garde-cost-class": "aggregate",
        "x-garde-pilot": true,
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Inclusive lower bound on session entry time (UTC). Omitted: all time. Must be before `to` (or the request time), otherwise 400 `invalid_parameter`. ISO 8601 date-time in year 0001 or later (`0001-01-01T00:00:00Z`); an earlier instant is 400 `invalid_parameter`.",
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "Exclusive upper bound on session entry time (UTC). Omitted: the request time. ISO 8601 date-time in year 0001 or later (`0001-01-01T00:00:00Z`); an earlier instant is 400 `invalid_parameter`.",
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnalyticsSummary"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_parameter`: A request parameter is unknown, repeated or invalid.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: A valid API key is required.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWWAuthenticate"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "`forbidden_scope`: The API key does not have the scope this endpoint requires.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited`: Rate limit exceeded. Retry after the number of seconds in Retry-After.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "500": {
            "description": "`internal_error`: An internal error occurred.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "`service_unavailable`: The service is temporarily unavailable.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/analytics/reasons": {
      "get": {
        "operationId": "getAnalyticsReasons",
        "summary": "Cancel-flow outcomes per reason",
        "security": [
          {
            "apiKey": [
              "analytics:read"
            ]
          }
        ],
        "x-garde-scope": "analytics:read",
        "x-garde-cost-class": "aggregate",
        "x-garde-pilot": false,
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Inclusive lower bound on session entry time (UTC). Omitted: all time. Must be before `to` (or the request time), otherwise 400 `invalid_parameter`. ISO 8601 date-time in year 0001 or later (`0001-01-01T00:00:00Z`); an earlier instant is 400 `invalid_parameter`.",
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "Exclusive upper bound on session entry time (UTC). Omitted: the request time. ISO 8601 date-time in year 0001 or later (`0001-01-01T00:00:00Z`); an earlier instant is 400 `invalid_parameter`.",
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnalyticsReasons"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_parameter`: A request parameter is unknown, repeated or invalid.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: A valid API key is required.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWWAuthenticate"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "`forbidden_scope`: The API key does not have the scope this endpoint requires.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited`: Rate limit exceeded. Retry after the number of seconds in Retry-After.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "500": {
            "description": "`internal_error`: An internal error occurred.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "`service_unavailable`: The service is temporarily unavailable.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/analytics/offers": {
      "get": {
        "operationId": "getAnalyticsOffers",
        "summary": "Cancel-flow retentions per reason and offer position",
        "security": [
          {
            "apiKey": [
              "analytics:read"
            ]
          }
        ],
        "x-garde-scope": "analytics:read",
        "x-garde-cost-class": "aggregate",
        "x-garde-pilot": false,
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Inclusive lower bound on session entry time (UTC). Omitted: all time. Must be before `to` (or the request time), otherwise 400 `invalid_parameter`. ISO 8601 date-time in year 0001 or later (`0001-01-01T00:00:00Z`); an earlier instant is 400 `invalid_parameter`.",
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "Exclusive upper bound on session entry time (UTC). Omitted: the request time. ISO 8601 date-time in year 0001 or later (`0001-01-01T00:00:00Z`); an earlier instant is 400 `invalid_parameter`.",
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnalyticsOffers"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_parameter`: A request parameter is unknown, repeated or invalid.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: A valid API key is required.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWWAuthenticate"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "`forbidden_scope`: The API key does not have the scope this endpoint requires.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited`: Rate limit exceeded. Retry after the number of seconds in Retry-After.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "500": {
            "description": "`internal_error`: An internal error occurred.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "`service_unavailable`: The service is temporarily unavailable.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/flows": {
      "get": {
        "operationId": "getFlows",
        "summary": "Current cancel and skip configuration markers",
        "security": [
          {
            "apiKey": [
              "flows:read"
            ]
          }
        ],
        "x-garde-scope": "flows:read",
        "x-garde-cost-class": "standard",
        "x-garde-pilot": false,
        "parameters": [
          {
            "name": "labelLocale",
            "in": "query",
            "required": false,
            "description": "Requested locale for current labels (`labelLocale`). Omitted: the winery default locale, or `en`. Not the session locale column.",
            "schema": {
              "type": "string",
              "pattern": "^[a-z]{2}(?:-[A-Za-z]{2})?$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicFlows"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_parameter`: A request parameter is unknown, repeated or invalid.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: A valid API key is required.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWWAuthenticate"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "`forbidden_scope`: The API key does not have the scope this endpoint requires.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited`: Rate limit exceeded. Retry after the number of seconds in Retry-After.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "500": {
            "description": "`internal_error`: An internal error occurred.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "`service_unavailable`: The service is temporarily unavailable.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/flows/{type}/reasons": {
      "get": {
        "operationId": "getFlowReasons",
        "summary": "Current reason IDs and labels for a flow",
        "security": [
          {
            "apiKey": [
              "flows:read"
            ]
          }
        ],
        "x-garde-scope": "flows:read",
        "x-garde-cost-class": "standard",
        "x-garde-pilot": false,
        "parameters": [
          {
            "name": "type",
            "in": "path",
            "required": true,
            "description": "cancel or skip.",
            "schema": {
              "type": "string",
              "enum": [
                "cancel",
                "skip"
              ]
            }
          },
          {
            "name": "labelLocale",
            "in": "query",
            "required": false,
            "description": "Requested locale for current labels (`labelLocale`). Omitted: the winery default locale, or `en`. Not the session locale column.",
            "schema": {
              "type": "string",
              "pattern": "^[a-z]{2}(?:-[A-Za-z]{2})?$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicFlowReasons"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_parameter`: A request parameter is unknown, repeated or invalid.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: A valid API key is required.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWWAuthenticate"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "`forbidden_scope`: The API key does not have the scope this endpoint requires.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "`not_found`: The resource was not found.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited`: Rate limit exceeded. Retry after the number of seconds in Retry-After.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "500": {
            "description": "`internal_error`: An internal error occurred.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "`service_unavailable`: The service is temporarily unavailable.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    },
    "/flows/{type}/offers": {
      "get": {
        "operationId": "getFlowOffers",
        "summary": "Current offer positions and action types for a flow",
        "security": [
          {
            "apiKey": [
              "flows:read"
            ]
          }
        ],
        "x-garde-scope": "flows:read",
        "x-garde-cost-class": "standard",
        "x-garde-pilot": false,
        "parameters": [
          {
            "name": "type",
            "in": "path",
            "required": true,
            "description": "cancel or skip.",
            "schema": {
              "type": "string",
              "enum": [
                "cancel",
                "skip"
              ]
            }
          },
          {
            "name": "labelLocale",
            "in": "query",
            "required": false,
            "description": "Requested locale for current labels (`labelLocale`). Omitted: the winery default locale, or `en`. Not the session locale column.",
            "schema": {
              "type": "string",
              "pattern": "^[a-z]{2}(?:-[A-Za-z]{2})?$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicFlowOffers"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_parameter`: A request parameter is unknown, repeated or invalid.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "401": {
            "description": "`unauthorized`: A valid API key is required.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWWAuthenticate"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "403": {
            "description": "`forbidden_scope`: The API key does not have the scope this endpoint requires.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "404": {
            "description": "`not_found`: The resource was not found.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited`: Rate limit exceeded. Retry after the number of seconds in Retry-After.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "500": {
            "description": "`internal_error`: An internal error occurred.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          },
          "503": {
            "description": "`service_unavailable`: The service is temporarily unavailable.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorBody"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ActionType": {
        "type": "string",
        "enum": [
          "pause",
          "skip",
          "discount",
          "show_next_shipment",
          "contact_request",
          "video",
          "event_ticket",
          "gift",
          "phone_call",
          "swap_club"
        ],
        "description": "Effective offer action type. A Commerce7 skip/discount offer handled as a staff request reads `contact_request`."
      },
      "AfterAcceptSituation": {
        "type": "string",
        "enum": [
          "applied",
          "requested",
          "unchanged"
        ],
        "description": "What accepting the offer does on this winery's current platform, which decides the default text it uses. `applied`: the platform makes the change when the member accepts (uses the `applied` default). `requested`: Garde records a request for the winery (uses the `requested` default). `unchanged`: the offer changes nothing (show next shipment, video); no default applies, only the offer's own text or Garde's. In the skip flow only an Awtomic discount is `applied`; every other skip offer (including older stored types and an offer with no action) is `requested`."
      },
      "AfterAcceptTextSource": {
        "type": "string",
        "enum": [
          "offer",
          "default",
          "builtIn"
        ],
        "description": "Where the effective text comes from: the offer's own text, the winery default for the situation, or Garde's built-in wording."
      },
      "AnalyticsOffers": {
        "type": "object",
        "properties": {
          "window": {
            "$ref": "#/components/schemas/AnalyticsWindow"
          },
          "offers": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "reasonId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9_-]{1,128}$",
                      "description": "Reason ID stored from member input. Validated on output; null when invalid. Not a label.",
                      "x-garde-untrusted": true
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "offerIndex": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "retained": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Kept saves. Changed in #527: excludes saves whose subscription was later cancelled."
                }
              },
              "required": [
                "reasonId",
                "offerIndex",
                "retained"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "window",
          "offers"
        ],
        "additionalProperties": false,
        "description": "Kept RETAINED sessions per reason and accepted offer position (#527: saves whose subscription was later cancelled are left out, so a position with none kept has no row). As on the dashboard, a RETAINED session with no recorded offer index counts as position 0. Stored values that are not a reason ID in the winery's current cancel configuration are reported as `reasonId: null`."
      },
      "AnalyticsReasons": {
        "type": "object",
        "properties": {
          "window": {
            "$ref": "#/components/schemas/AnalyticsWindow"
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "reasonId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9_-]{1,128}$",
                      "description": "Reason ID stored from member input. Validated on output; null when invalid. Not a label.",
                      "x-garde-untrusted": true
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "total": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "retained": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Kept saves. Changed in #527: excludes saves whose subscription was later cancelled."
                },
                "cancelled": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "savedThenCancelled": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "RETAINED sessions whose subscription was later cancelled (#527); in total, not in retained."
                }
              },
              "required": [
                "reasonId",
                "total",
                "retained",
                "cancelled"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "window",
          "reasons"
        ],
        "additionalProperties": false,
        "description": "Completed cancel sessions per stored reason ID. Stored values that are not a reason ID in the winery's current cancel configuration are merged into one `reasonId: null` entry, so totals reconcile with the dashboard."
      },
      "AnalyticsSummary": {
        "type": "object",
        "properties": {
          "window": {
            "$ref": "#/components/schemas/AnalyticsWindow"
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "completed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Sessions with any outcome, including EXITED."
          },
          "retained": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "RETAINED sessions the member kept, including retained via request (not a confirmed change), as on the dashboard. Changed in #527: a RETAINED session whose subscription has a later confirmed cancellation (by Garde or recorded from a platform webhook, at any time, also after `to`) is not counted here; it is in `savedThenCancelled`."
          },
          "cancelled": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "saveRate": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "round(retained / completed × 100); 0 when nothing completed. Saved-then-cancelled sessions stay in `completed` but not in `retained` (#527)."
          },
          "inProgress": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Sessions with no outcome (dashboard parity) = inProgressUnclaimed + awaitingConfirmation."
          },
          "inProgressUnclaimed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Sessions with no outcome and no claim."
          },
          "awaitingConfirmation": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Sessions with no outcome and an unresolved claim. Never a failure."
          },
          "revenueSaved": {
            "type": "number",
            "description": "provider-reported subscription total (monthlyValue from the platform), unnormalized, no currency. Summed over kept saves (`retained`) only. Changed in #527: a save whose subscription was later cancelled is left out, also for past windows; its value is in `savedThenCancelled.revenueLost`. #573: this legacy figure is a per-shipment price before code discounts, added across currencies and billing frequencies; use `monthlyRevenueSaved` for monthly amounts per currency."
          },
          "monthlyRevenueSaved": {
            "type": "object",
            "properties": {
              "byCurrency": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "currency": {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$",
                      "description": "ISO 4217 currency code of the subscriptions, e.g. `EUR`."
                    },
                    "amount": {
                      "type": "number",
                      "minimum": 0,
                      "description": "Total in that currency, rounded to cents."
                    },
                    "count": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 9007199254740991,
                      "description": "Kept saves in this currency with a known monthly amount."
                    }
                  },
                  "required": [
                    "currency",
                    "amount",
                    "count"
                  ],
                  "additionalProperties": false
                },
                "description": "One entry per currency, sorted by code. Empty when no value is known."
              },
              "unknownCount": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Kept saves with no known monthly amount: the platform reported no price, currency or billing interval (Commerce7 reports none), or the session started before Garde recorded them (#573)."
              }
            },
            "required": [
              "byCurrency",
              "unknownCount"
            ],
            "additionalProperties": false,
            "description": "#573. Over kept saves (`retained`), the sum per currency of the subscription's monthly amount when the session started: one recurring order after recurring discounts (no one-time add-ons or shipping) × orders per month from the billing interval (every N days, weeks, months or years), in its own currency. Never added across currencies. This is the dashboard's \"Est. MRR saved\"; prefer it to `revenueSaved`. Always present in responses."
          },
          "savedThenCancelled": {
            "$ref": "#/components/schemas/SavedThenCancelled"
          }
        },
        "required": [
          "window",
          "total",
          "completed",
          "retained",
          "cancelled",
          "saveRate",
          "inProgress",
          "inProgressUnclaimed",
          "awaitingConfirmation",
          "revenueSaved"
        ],
        "additionalProperties": false,
        "description": "Cancel-flow counts matching the admin dashboard for the same window."
      },
      "AnalyticsWindow": {
        "type": "object",
        "properties": {
          "from": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Timestamp"
              },
              {
                "type": "null"
              }
            ]
          },
          "to": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "flowType": {
            "type": "string",
            "const": "cancel"
          }
        },
        "required": [
          "from",
          "to",
          "flowType"
        ],
        "additionalProperties": false,
        "description": "Half-open `[from, to)` window on session entry time. `from: null` means all time. Analytics cover the cancel flow only."
      },
      "CancelSource": {
        "type": "string",
        "enum": [
          "web_portal",
          "pos",
          "mobile",
          "api"
        ],
        "description": "Channel recorded on the session. It does not mark webhook-recorded cancellations."
      },
      "ErrorBody": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "invalid_parameter",
                  "invalid_cursor",
                  "unauthorized",
                  "forbidden_scope",
                  "not_found",
                  "method_not_allowed",
                  "rate_limited",
                  "internal_error",
                  "service_unavailable"
                ]
              },
              "message": {
                "type": "string"
              },
              "requestId": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_-]{8,64}$"
              }
            },
            "required": [
              "code",
              "message",
              "requestId"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": false,
        "description": "Error envelope. `message` is static text for the code."
      },
      "EventResult": {
        "type": "string",
        "enum": [
          "staff_request"
        ],
        "description": "Event result."
      },
      "EventType": {
        "type": "string",
        "enum": [
          "ENTERED",
          "REASON_SELECTED",
          "EXITED",
          "CONTACT_REQUEST",
          "SKIPPED",
          "FEEDBACK_CAPTURED",
          "GIFT_REQUESTED",
          "CANCELLED",
          "CANCEL_EXECUTION_ERROR",
          "OFFER_ATTEMPTED",
          "VIDEO_WATCHED",
          "EVENT_TICKET_REQUESTED",
          "PHONE_CALL_REQUESTED",
          "SWAP_EXECUTED",
          "OFFER_ACCEPTED",
          "OFFER_EXECUTION_ERROR",
          "EXTERNAL_CANCEL",
          "EXTERNAL_REACTIVATED",
          "STAFF_RESOLVED",
          "SKIP_UNDO_AVAILABLE",
          "SKIP_UNDONE",
          "UNRECOGNIZED"
        ],
        "description": "Session event type. `UNRECOGNIZED` is a stored type this API version does not know. New values may be added."
      },
      "FlowSource": {
        "type": "string",
        "enum": [
          "saved",
          "default"
        ],
        "description": "saved: the winery has a stored config. default: the platform default is in effect. A stored but unreadable config stays `configSource: saved` and does not silently fall back."
      },
      "FlowType": {
        "type": "string",
        "enum": [
          "cancel",
          "skip"
        ],
        "description": "Member flow type."
      },
      "Outcome": {
        "type": "string",
        "enum": [
          "CANCELLED",
          "EXITED",
          "RETAINED",
          "REQUESTED",
          "SKIPPED",
          "GIFTED",
          "UNRECOGNIZED"
        ],
        "description": "Session outcome. `RETAINED` from a request-only offer means retained via request (not a confirmed change); use the OFFER_ACCEPTED event `actionType` to tell them apart. `REQUESTED` is a captured skip-flow staff request, not fulfilment. Older Commerce7 `SKIPPED` and `RETAINED` sessions may record a request rather than a confirmed change: describe them conservatively and don't infer fulfilment. Cancellations made outside Garde (in the platform admin, by support, or with the platform's own cancel) are not Garde sessions: they are not returned or counted. A member who left a Garde session and then cancelled outside Garde reads `EXITED` (#653). `UNRECOGNIZED` is a stored value this API version does not know. New values may be added."
      },
      "Platform": {
        "type": "string",
        "enum": [
          "awtomic",
          "commerce7"
        ],
        "description": "Subscription platform."
      },
      "Pseudonym": {
        "type": "string",
        "pattern": "^p[1-9][0-9]{0,5}_[A-Za-z0-9_-]{43}$",
        "description": "Per-winery pseudonym of a member or subscription ID, prefixed with a version marker (`p1_`). Stable within a winery, so it is linkable over time: treat it as personal data. Pseudonyms from different wineries or versions never match. The body is the 43-character unpadded base64url SHA-256 digest."
      },
      "PublicEvent": {
        "type": "object",
        "properties": {
          "type": {
            "$ref": "#/components/schemas/EventType"
          },
          "createdAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "reasonId": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[A-Za-z0-9_-]{1,128}$",
                "description": "Reason ID stored from member input. Validated on output; null when invalid. Not a label.",
                "x-garde-untrusted": true
              },
              {
                "type": "null"
              }
            ]
          },
          "offerId": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[A-Za-z0-9_-]{1,128}$",
                "description": "Offer ID stored from member input. Validated on output; null when invalid. Not a label.",
                "x-garde-untrusted": true
              },
              {
                "type": "null"
              }
            ]
          },
          "offerIndex": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "actionType": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ActionType"
              },
              {
                "type": "null"
              }
            ]
          },
          "result": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/EventResult"
              },
              {
                "type": "null"
              }
            ]
          },
          "lastStep": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "loading",
                  "select-membership",
                  "reason",
                  "feedback",
                  "offer",
                  "offer-changed",
                  "confirming",
                  "already-saved",
                  "retained",
                  "contact_retained",
                  "cancelled",
                  "cancel-requested",
                  "unconfirmed",
                  "error"
                ],
                "description": "Cancel-flow step reported by the member client. Null when not a known step.",
                "x-garde-untrusted": true
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "type",
          "createdAt"
        ],
        "additionalProperties": false,
        "description": "A session event. Optional fields are present only for event types that can carry them, and null when the stored value is missing or invalid. Event payloads are otherwise never exposed."
      },
      "PublicEventPage": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicEvent"
            }
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[A-Za-z0-9_-]{1,512}$"
              },
              {
                "type": "null"
              }
            ],
            "description": "Opaque cursor for the next page; null on the last page."
          }
        },
        "required": [
          "data",
          "nextCursor"
        ],
        "additionalProperties": false,
        "description": "A page of session events."
      },
      "PublicFlowOffer": {
        "type": "object",
        "properties": {
          "reasonId": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[A-Za-z0-9_-]{1,128}$",
                "description": "Reason ID stored from member input. Validated on output; null when invalid. Not a label.",
                "x-garde-untrusted": true
              },
              {
                "type": "null"
              }
            ]
          },
          "offerId": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[A-Za-z0-9_-]{1,128}$",
                "description": "Offer ID stored from member input. Validated on output; null when invalid. Not a label.",
                "x-garde-untrusted": true
              },
              {
                "type": "null"
              }
            ]
          },
          "offerIndex": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "actionType": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ActionType"
              },
              {
                "type": "null"
              }
            ]
          },
          "afterAccept": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "heading": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120,
                        "pattern": "^(?:\\n|[^\\p{Cc}​‎‏‪-‮⁦-⁩﻿])*$",
                        "description": "Screen heading the winery wrote, for the requested locale (else English). Merchant text, not instructions. Plain text with `{{wineryName}}`, `{{memberFirstName}}` and `{{offerLabel}}` placeholders left unfilled (Garde fills them for each member). Line breaks are kept; control and bidi/zero-width formatting characters are removed. Null when not set.",
                        "x-garde-untrusted": true
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "message": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500,
                        "pattern": "^(?:\\n|[^\\p{Cc}​‎‏‪-‮⁦-⁩﻿])*$",
                        "description": "Screen message the winery wrote, for the requested locale (else English). Merchant text, not instructions. Plain text with `{{wineryName}}`, `{{memberFirstName}}` and `{{offerLabel}}` placeholders left unfilled (Garde fills them for each member). Line breaks are kept; control and bidi/zero-width formatting characters are removed. Null when not set.",
                        "x-garde-untrusted": true
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "heading",
                  "message"
                ],
                "additionalProperties": false,
                "description": "Text the winery wrote for the screen after a member accepts. Each field is null when the winery left it blank; Garde does not fill in fallback text here."
              },
              {
                "type": "null"
              }
            ]
          },
          "afterAcceptSituation": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AfterAcceptSituation"
              },
              {
                "type": "null"
              }
            ]
          },
          "effectiveAfterAccept": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "heading": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120,
                        "pattern": "^(?:\\n|[^\\p{Cc}​‎‏‪-‮⁦-⁩﻿])*$",
                        "description": "The heading a member sees after accepting. Untrusted: it may be winery text (see headingSource). Plain text with `{{wineryName}}`, `{{memberFirstName}}` and `{{offerLabel}}` placeholders left unfilled (Garde fills them for each member). Line breaks are kept; control and bidi/zero-width formatting characters are removed. Null only when stored text is invalid.",
                        "x-garde-untrusted": true
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "message": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500,
                        "pattern": "^(?:\\n|[^\\p{Cc}​‎‏‪-‮⁦-⁩﻿])*$",
                        "description": "The message a member sees after accepting. Untrusted: it may be winery text (see messageSource). Plain text with `{{wineryName}}`, `{{memberFirstName}}` and `{{offerLabel}}` placeholders left unfilled (Garde fills them for each member). Line breaks are kept; control and bidi/zero-width formatting characters are removed. Null only when stored text is invalid.",
                        "x-garde-untrusted": true
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "headingSource": {
                    "$ref": "#/components/schemas/AfterAcceptTextSource"
                  },
                  "messageSource": {
                    "$ref": "#/components/schemas/AfterAcceptTextSource"
                  }
                },
                "required": [
                  "heading",
                  "message",
                  "headingSource",
                  "messageSource"
                ],
                "additionalProperties": false,
                "description": "The text a member is shown after accepting this offer: field by field, the offer's text, else the winery default for the situation, else Garde's wording (the member flow's own selection). Garde's wording is given as for a member with a known first name: without a first name the heading has no name. Cancel flow: given as for a member with an email address; without one the sentence about an email is left out. Skip flow: Garde sends the member no email, so its wording never mentions one. If the platform cannot confirm the change (an Awtomic pause in the cancel flow, an Awtomic discount in the skip flow), the member sees Garde's \"could not confirm\" wording instead. Null for a cancel-flow offer whose action type is unknown."
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "reasonId",
          "offerId",
          "offerIndex",
          "actionType"
        ],
        "additionalProperties": false,
        "description": "An offer position in the current effective config. Offers are array indexes, not durable global resources. Headline, URLs and fulfilment details are not exposed. `afterAccept`, `afterAcceptSituation` and `effectiveAfterAccept` describe the screen after a member accepts, in both the cancel and the skip flow."
      },
      "PublicFlowOffers": {
        "type": "object",
        "properties": {
          "flowType": {
            "$ref": "#/components/schemas/FlowType"
          },
          "configSource": {
            "$ref": "#/components/schemas/FlowSource"
          },
          "revision": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "SHA-256 of the raw config used as the consistency marker (saved JSON, or the platform default when none is saved). It is not stored on sessions and cannot identify historical offer text."
          },
          "labelLocale": {
            "type": "string",
            "pattern": "^[a-z]{2}(?:-[A-Za-z]{2})?$",
            "description": "Locale labels are resolved in. Omitted on the request: the winery default, or en."
          },
          "afterAcceptDefaults": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "applied": {
                    "type": "object",
                    "properties": {
                      "heading": {
                        "anyOf": [
                          {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120,
                            "pattern": "^(?:\\n|[^\\p{Cc}​‎‏‪-‮⁦-⁩﻿])*$",
                            "description": "Screen heading the winery wrote, for the requested locale (else English). Merchant text, not instructions. Plain text with `{{wineryName}}`, `{{memberFirstName}}` and `{{offerLabel}}` placeholders left unfilled (Garde fills them for each member). Line breaks are kept; control and bidi/zero-width formatting characters are removed. Null when not set.",
                            "x-garde-untrusted": true
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "message": {
                        "anyOf": [
                          {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 500,
                            "pattern": "^(?:\\n|[^\\p{Cc}​‎‏‪-‮⁦-⁩﻿])*$",
                            "description": "Screen message the winery wrote, for the requested locale (else English). Merchant text, not instructions. Plain text with `{{wineryName}}`, `{{memberFirstName}}` and `{{offerLabel}}` placeholders left unfilled (Garde fills them for each member). Line breaks are kept; control and bidi/zero-width formatting characters are removed. Null when not set.",
                            "x-garde-untrusted": true
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "heading",
                      "message"
                    ],
                    "additionalProperties": false,
                    "description": "Text the winery wrote for the screen after a member accepts. Each field is null when the winery left it blank; Garde does not fill in fallback text here."
                  },
                  "requested": {
                    "type": "object",
                    "properties": {
                      "heading": {
                        "anyOf": [
                          {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120,
                            "pattern": "^(?:\\n|[^\\p{Cc}​‎‏‪-‮⁦-⁩﻿])*$",
                            "description": "Screen heading the winery wrote, for the requested locale (else English). Merchant text, not instructions. Plain text with `{{wineryName}}`, `{{memberFirstName}}` and `{{offerLabel}}` placeholders left unfilled (Garde fills them for each member). Line breaks are kept; control and bidi/zero-width formatting characters are removed. Null when not set.",
                            "x-garde-untrusted": true
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "message": {
                        "anyOf": [
                          {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 500,
                            "pattern": "^(?:\\n|[^\\p{Cc}​‎‏‪-‮⁦-⁩﻿])*$",
                            "description": "Screen message the winery wrote, for the requested locale (else English). Merchant text, not instructions. Plain text with `{{wineryName}}`, `{{memberFirstName}}` and `{{offerLabel}}` placeholders left unfilled (Garde fills them for each member). Line breaks are kept; control and bidi/zero-width formatting characters are removed. Null when not set.",
                            "x-garde-untrusted": true
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "heading",
                      "message"
                    ],
                    "additionalProperties": false,
                    "description": "Text the winery wrote for the screen after a member accepts. Each field is null when the winery left it blank; Garde does not fill in fallback text here."
                  }
                },
                "required": [
                  "applied",
                  "requested"
                ],
                "additionalProperties": false,
                "description": "The winery's default after-accept text for each situation: `applied` (the platform made the change when the member accepted) and `requested` (Garde recorded a request for the winery to act on). Used for a field the offer leaves blank. Each flow (cancel and skip) has its own defaults. Earlier drafts returned null for the skip flow, so clients should still accept null."
              },
              {
                "type": "null"
              }
            ]
          },
          "offers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicFlowOffer"
            }
          }
        },
        "required": [
          "flowType",
          "configSource",
          "revision",
          "labelLocale",
          "offers"
        ],
        "additionalProperties": false,
        "description": "Offer IDs, positions and action types for one flow, with the after-accept text. Current config only."
      },
      "PublicFlowReason": {
        "type": "object",
        "properties": {
          "id": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[A-Za-z0-9_-]{1,128}$",
                "description": "Reason ID stored from member input. Validated on output; null when invalid. Not a label.",
                "x-garde-untrusted": true
              },
              {
                "type": "null"
              }
            ]
          },
          "label": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 200,
                "pattern": "^[^\\p{Cc}\\u200B\\u200E\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*$",
                "description": "Current reason label for the requested locale. Merchant text. Null when missing or invalid.",
                "x-garde-untrusted": true
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "label"
        ],
        "additionalProperties": false,
        "description": "A reason in the current effective config. The id is a stored slug; the label is current."
      },
      "PublicFlowReasons": {
        "type": "object",
        "properties": {
          "flowType": {
            "$ref": "#/components/schemas/FlowType"
          },
          "configSource": {
            "$ref": "#/components/schemas/FlowSource"
          },
          "revision": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "SHA-256 of the raw config used as the consistency marker (saved JSON, or the platform default when none is saved). It is not stored on sessions and cannot identify historical offer text."
          },
          "labelLocale": {
            "type": "string",
            "pattern": "^[a-z]{2}(?:-[A-Za-z]{2})?$",
            "description": "Locale labels are resolved in. Omitted on the request: the winery default, or en."
          },
          "reasons": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicFlowReason"
            }
          }
        },
        "required": [
          "flowType",
          "configSource",
          "revision",
          "labelLocale",
          "reasons"
        ],
        "additionalProperties": false,
        "description": "Reason IDs and current labels for one flow. Labels may have changed since a session ran."
      },
      "PublicFlowSnapshot": {
        "type": "object",
        "properties": {
          "configSource": {
            "$ref": "#/components/schemas/FlowSource"
          },
          "revision": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$",
            "description": "SHA-256 of the raw config used as the consistency marker (saved JSON, or the platform default when none is saved). It is not stored on sessions and cannot identify historical offer text."
          },
          "labelLocale": {
            "type": "string",
            "pattern": "^[a-z]{2}(?:-[A-Za-z]{2})?$",
            "description": "Locale labels are resolved in. Omitted on the request: the winery default, or en."
          }
        },
        "required": [
          "configSource",
          "revision",
          "labelLocale"
        ],
        "additionalProperties": false,
        "description": "Current cancel or skip configuration marker. Reasons and offers are separate resources."
      },
      "PublicFlows": {
        "type": "object",
        "properties": {
          "cancel": {
            "$ref": "#/components/schemas/PublicFlowSnapshot"
          },
          "skip": {
            "$ref": "#/components/schemas/PublicFlowSnapshot"
          }
        },
        "required": [
          "cancel",
          "skip"
        ],
        "additionalProperties": false,
        "description": "Current cancel and skip configuration, with a revision marker each. This is not a historical claim: a past session's offer text cannot be recovered from the revision."
      },
      "PublicSession": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/SessionId"
          },
          "customer": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Pseudonym"
              },
              {
                "type": "null"
              }
            ]
          },
          "subscription": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Pseudonym"
              },
              {
                "type": "null"
              }
            ]
          },
          "platform": {
            "$ref": "#/components/schemas/Platform"
          },
          "flowType": {
            "$ref": "#/components/schemas/FlowType"
          },
          "outcome": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Outcome"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "$ref": "#/components/schemas/SessionStatus"
          },
          "cancelSource": {
            "$ref": "#/components/schemas/CancelSource"
          },
          "reasonId": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[A-Za-z0-9_-]{1,128}$",
                "description": "Reason ID stored from member input. Validated on output; null when invalid. Not a label.",
                "x-garde-untrusted": true
              },
              {
                "type": "null"
              }
            ]
          },
          "acceptedOfferIndex": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "enteredAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "completedAt": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Timestamp"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "customer",
          "subscription",
          "platform",
          "flowType",
          "outcome",
          "status",
          "cancelSource",
          "reasonId",
          "acceptedOfferIndex",
          "enteredAt",
          "completedAt"
        ],
        "additionalProperties": false,
        "description": "A non-preview member flow session. `customer` and `subscription` are null for placeholder IDs. No per-session financial fields are exposed."
      },
      "PublicSessionPage": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicSession"
            }
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[A-Za-z0-9_-]{1,512}$"
              },
              {
                "type": "null"
              }
            ],
            "description": "Opaque cursor for the next page; null on the last page."
          }
        },
        "required": [
          "data",
          "nextCursor"
        ],
        "additionalProperties": false,
        "description": "A page of sessions."
      },
      "PublicWinery": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "pattern": "^[^\\p{Cc}\\u200B\\u200E\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]*$",
            "description": "Merchant-entered winery name, without control or bidi/zero-width formatting characters.",
            "x-garde-untrusted": true
          },
          "platform": {
            "$ref": "#/components/schemas/Platform"
          },
          "active": {
            "type": "boolean",
            "const": true
          }
        },
        "required": [
          "name",
          "platform",
          "active"
        ],
        "additionalProperties": false,
        "description": "The winery the API key belongs to. Inactive wineries are never returned (401)."
      },
      "SavedThenCancelled": {
        "type": "object",
        "properties": {
          "count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "RETAINED sessions in the window whose subscription (same platform subscription ID) has a later confirmed cancellation, recorded by Garde or from a platform webhook, at any time. Each cancellation counts once, at the latest save before it; an earlier save it also undid is in neither this count nor `retained`. Not in `retained` or `revenueSaved`."
          },
          "revenueLost": {
            "type": "number",
            "description": "Sum of monthlyValue over those sessions (provider-reported subscription total (monthlyValue from the platform), unnormalized, no currency): value that left with them and is not in revenueSaved."
          },
          "discountOffers": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Of those sessions, how many accepted a discount offer."
          },
          "discountOffersWithCost": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Of those discounts, how many have a known cost: Garde recorded the discount terms (from #527 on) and a monthlyValue. Earlier discounts are not in discountCostUpTo."
          },
          "discountCostUpTo": {
            "type": "number",
            "minimum": 0,
            "description": "Sum of monthlyValue × percentOff / 100 × number of discounted orders for the discounts counted in discountOffersWithCost. An upper bound: Garde does not see which discounted orders shipped before the member cancelled. Same units as revenueSaved (unnormalized, no currency)."
          },
          "monthlyRevenueLost": {
            "type": "object",
            "properties": {
              "byCurrency": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "currency": {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$",
                      "description": "ISO 4217 currency code of the subscriptions, e.g. `EUR`."
                    },
                    "amount": {
                      "type": "number",
                      "minimum": 0,
                      "description": "Total in that currency, rounded to cents."
                    },
                    "count": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 9007199254740991,
                      "description": "Sessions in this currency with a known monthly amount."
                    }
                  },
                  "required": [
                    "currency",
                    "amount",
                    "count"
                  ],
                  "additionalProperties": false
                },
                "description": "One entry per currency, sorted by code. Empty when no value is known."
              },
              "unknownCount": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Sessions in `count` with no known monthly amount: the platform reported no price, currency or billing interval (Commerce7 reports none), or the session started before Garde recorded them (#573)."
              }
            },
            "required": [
              "byCurrency",
              "unknownCount"
            ],
            "additionalProperties": false,
            "description": "#573. Of those sessions, the sum per currency of the subscription's monthly amount when the session started: one recurring order after recurring discounts (no one-time add-ons or shipping) × orders per month from the billing interval (every N days, weeks, months or years), in its own currency. Never added across currencies. Prefer this to `revenueLost`. Always present in responses."
          },
          "discountCost": {
            "type": "object",
            "properties": {
              "byCurrency": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "currency": {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$",
                      "description": "ISO 4217 currency code of the subscriptions, e.g. `EUR`."
                    },
                    "amount": {
                      "type": "number",
                      "minimum": 0,
                      "description": "Total in that currency, rounded to cents."
                    },
                    "count": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 9007199254740991,
                      "description": "Discounts in this currency with a known cost."
                    }
                  },
                  "required": [
                    "currency",
                    "amount",
                    "count"
                  ],
                  "additionalProperties": false
                },
                "description": "One entry per currency, sorted by code. Empty when no value is known."
              },
              "unknownCount": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991,
                "description": "Discounts in `discountOffers` with no known cost: terms not recorded (before #527) or no known order amount."
              }
            },
            "required": [
              "byCurrency",
              "unknownCount"
            ],
            "additionalProperties": false,
            "description": "#573. The `discountCostUpTo` bound per currency, on the per-order amount after recurring discounts: order amount × percentOff / 100 × number of discounted orders. Prefer this to `discountCostUpTo`. Always present in responses."
          }
        },
        "required": [
          "count",
          "revenueLost",
          "discountOffers",
          "discountOffersWithCost",
          "discountCostUpTo"
        ],
        "additionalProperties": false,
        "description": "Members who accepted a save offer and later cancelled the same subscription (#527)."
      },
      "SessionId": {
        "type": "string",
        "pattern": "^[A-Za-z0-9_-]{1,128}$",
        "description": "Opaque session identifier."
      },
      "SessionStatus": {
        "type": "string",
        "enum": [
          "outcome",
          "awaiting_confirmation",
          "in_progress"
        ],
        "description": "`awaiting_confirmation`: an operation was claimed but its result is unconfirmed; the subscription may or may not have changed, so it is never a failure. `in_progress`: no outcome and no claim (including abandoned sessions not yet expired)."
      },
      "Timestamp": {
        "type": "string",
        "format": "date-time",
        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
        "description": "ISO-8601 date-time in UTC (`Z` suffix)."
      }
    },
    "headers": {
      "CacheControl": {
        "description": "Responses are private and never cached.",
        "schema": {
          "type": "string",
          "const": "private, no-store"
        }
      },
      "RetryAfter": {
        "description": "Seconds to wait before retrying.",
        "schema": {
          "type": "integer",
          "minimum": 1
        }
      },
      "WWWAuthenticate": {
        "description": "Bearer authentication challenge.",
        "schema": {
          "type": "string",
          "const": "Bearer"
        }
      }
    },
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "Winery API key. The scope required by each operation is listed in its security requirement and in `x-garde-scope`."
      }
    }
  }
}
