openapi: 3.2.0
info:
  title: Lucky Landing API
  version: "2026-11-05"
  description: |
    Spec-first: this document is the source of truth. The Go server (ogen), request
    validation, HTTP policy, MCP tools and clients are all generated or derived from it.

    Conventions follow the Anthropic API:
    - `GET` reads, `POST` writes. There is no PUT, PATCH or DELETE.
      Updates are `POST /v1/<resource>/{id}`; actions are `POST /v1/<resource>/{id}/<action>`.
    - Every object has a `type`. Every list is `GET`, newest first, and returns
      `{data, has_more, first_id, last_id}`. Paginate with cursors, never offsets:
      `limit` (1 to 1000, default 20) and one of `after_id` (the previous page's `last_id`)
      or `before_id` (the previous page's `first_id`). Sending both is a 400.
    - Errors are RFC 9457 problem details (`application/problem+json`). Branch on `code`, which is one of
      `components.x-luckylanding-problems`; `type` is that code's page at `https://luckylanding.io/errors/<code>`.
      `retryable` says whether the same request can succeed later, after `Retry-After` when it is set, and
      `errors` points at each invalid field (`pointer`, a JSON Pointer into the body) or parameter (`parameter`).
    - A dashboard session sends `X-LuckyLanding-Project` with the `project_id` last read from `getCurrentSession`.
      Product writes using a session require this precondition. A stale project or missing required header returns
      409 `project_changed` before the write. Read the current session again before resubmitting.
    - Every response carries a `request-id` header. The version is the `/v1` path; there is
      no version header.
    - Each API key's and connected app's requests, to `/v1` and to the MCP server alike, count toward a limit of
      its own and toward one its org's keys and apps share. A request over either answers 429 `rate_limited`, and
      `Retry-After` says when the next one is let through.
    - There is no `Idempotency-Key` header. A checkout `money` write keys its records and every
      processor call on the payment generation, an ID the server owns, so a retry never charges
      twice. Other writes are not deduplicated: a retried create can make a second object, so
      read before retrying.
    - Response enums are open strings (`x-luckylanding-known-values`), so clients don't break when
      values are added. Request enums are closed.

    LL extensions on operations:
    - Each `oauth` entry in an operation's `security` is one way in: a caller needs the scope of one of them.
    - `x-luckylanding-live`, on a public operation that starts a shopper's charge: the product that must be live in the
      org for it to run, bought with the saved card or granted by Lucky Landing's staff and not ended, as one is when a
      Lucky Landing bill it is on is still unpaid at the bill's grace end. Otherwise it answers 409 `store_unavailable`,
      which tells the shopper nothing about the org's bills. Nothing a merchant or agent does needs a product live, so
      setting the checkout up is free.
    - `x-luckylanding-org`: `required` (default), `person` (no org yet) or `public`.
    - `x-luckylanding-closed`: the operation stays open to an owner of the org, signed in to the dashboard, while an owner
      has closed the org. Every other operation that acts for a closed org, and every call by its API keys, its connected
      apps and its members who aren't owners, answers 403 `org_closed`, whose `detail` names when the org is deleted.
    - `x-luckylanding-mcp`: the MCP tool this operation is exposed as. The MCP server serves payment
      orchestration and the account flows alone, so an operation is a tool only if its one tag sets
      `x-luckylanding-mcp` too, as only their tags do. On a tag, `title` and `summary` name the tag's tools for a
      person, as the dashboard's Settings › Agents lists them in tag order, and stay out of what an agent reads. `guide` is
      an order or a rule across several of the tag's tools that no one tool's description can state,
      worded so it stays true for a caller listed only some of them, or none. A rule for one tool goes in that
      tool's description, which only callers listed the tool read. The MCP server's instructions, the same for
      every caller, are a server-wide opening, then each tag's guide, in tag order.
      On an operation, `opens` names the field of the 200 response that holds a URL the person opens in their
      browser, and the `message` shown with it: a client that takes URL elicitation asks the person to open it
      before the tool's result comes back. `destructive: true` marks a write that deletes, overwrites, cancels,
      or sends or moves money for good, and `idempotent: true` a write whose repeat with the same arguments
      changes, charges, sends and creates nothing more. `open_world: true` marks a tool whose call can reach a system
      outside Lucky Landing, such as the store, a processor, Google or Cloudflare, before it answers or through work the
      call starts or makes due.
    - `x-luckylanding-self`: the operation reads only the credential that calls it, so any credential of an org may call
      it with no scope.
    - `x-luckylanding-site`: LL's public site calls the operation from the browser, without credentials. Only the
      site's origins may call it cross-origin; any other origin gets 403.
    - `x-luckylanding-txn`: the operation crosses into `luckylanding checkout` (tier-0). Before the handler runs,
      the caller's token is exchanged for a short-lived Txn-Token
      (draft-ietf-oauth-transaction-tokens) that pins the org, principal, operation and the
      resource it acts on. The external token never leaves `luckylanding api`.
servers:
  - url: https://api.luckylanding.io
tags:
  - name: setup
    x-luckylanding-mcp:
      title: Setup
      summary: Read what setup has left, and add Lucky Landing to your store's theme.
      guide: >-
        Start with `setup_get_status`, which lists the setup steps the org needs and which of them are done.
  - { name: orgs }
  - name: checkout
    description: "Merchant offer publication and hosted anonymous checkout. Shopper operations require an expiring session capability cookie and hostname binding, independently verified by TTS. Public published offers authorize only creating a fresh shopper session. Session IDs alone grant no access. Prices and accepted payment generations are server owned."
    x-luckylanding-mcp:
      title: Checkout and payments
      summary: Design and publish your checkout, set its domain, draft offers, and read, refund and route payments.
      guide: >-
        A payment's `order_review` says why a paid payment waits for a person, and is null when it doesn't. Read it on the payment before a tool acts on that payment, and act only as that tool's description says for that reason.
  - name: connections
    x-luckylanding-mcp:
      title: Connections
      summary: Connect Shopify, Whop and your tracking accounts, test them and disconnect them.
  - name: billing
    x-luckylanding-mcp:
      title: Billing
      summary: Read your bills, products and prices, save a card and pay what is due.
  - { name: ad_canvas, description: "Ad Canvas: a merchant drops in a video ad, their own or a competitor's, and Lucky Landing breaks it into its scenes, in order. A breakdown runs only where Lucky Landing has turned a breakdown model on; everywhere else it is refused with 501 `not_implemented`." }
  - { name: outreach, description: "Customer Connect setup (personas, product choices and abandoned cart flows), its conversation inbox with AI drafts a person approves or rejects, and its alert list. Every operation fails closed for an org that is not on the Customer Connect allowlist. No operation in this tag sends a message." }
paths:
  /v1/session:
    get:
      operationId: getCurrentSession
      x-ogen-operation-group: Identity
      tags: [orgs]
      summary: Read the verified current human and organization without credentials
      security: [{ session: ["org:read"] }]
      x-luckylanding-closed: true
      responses:
        "200": { description: Current identity, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CurrentSession" } } } }
        default: { $ref: "#/components/responses/Error" }
    post:
      operationId: switchSessionOrg
      x-ogen-operation-group: Identity
      tags: [orgs]
      summary: Move the signed-in person's dashboard session to another org they belong to
      description: |
        From the next request on, the session acts for `org_id`, as if the person had chosen it when signing in, and returns the session as it is there. The person stays signed in. The org's audit log records the switch.

        Errors:
        - 403 `person_required`. Only a person's own dashboard session switches; an agent's token and an API key stay with the org they were made for.
        - 404 `not_found`. The person is not an active member of `org_id`, or no such org exists.
      security: [{ session: ["org:write"] }]
      x-luckylanding-org: person
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/SessionOrgParams" } } } }
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CurrentSession" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/support_access:
    get:
      operationId: getMerchantSupportAccess
      x-ogen-operation-group: Identity
      tags: [orgs]
      summary: Read support access preferences and active merchant views
      security: [{ session: [] }]
      x-luckylanding-org: person
      responses:
        "200": { description: Success, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/MerchantSupportAccess" } } } }
        default: { $ref: "#/components/responses/Error" }
    post:
      operationId: updateMerchantSupportAccess
      x-ogen-operation-group: Identity
      tags: [orgs]
      summary: Set whether support can open a view as this member
      security: [{ session: [] }]
      x-luckylanding-org: person
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/SupportPreference" } } } }
      responses:
        "200": { description: Success, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/SupportActionResult" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/support_access/{view_id}/approve:
    post:
      operationId: approveMerchantSupportEdit
      x-ogen-operation-group: Identity
      tags: [orgs]
      summary: Allow the requested checkout draft edits
      security: [{ session: [] }]
      x-luckylanding-org: person
      parameters: [{ $ref: "#/components/parameters/SupportViewID" }]
      responses:
        "200": { description: Success, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/SupportActionResult" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/support_access/{view_id}/revoke:
    post:
      operationId: revokeMerchantSupportView
      x-ogen-operation-group: Identity
      tags: [orgs]
      summary: Revoke this support view
      security: [{ session: [] }]
      x-luckylanding-org: person
      parameters: [{ $ref: "#/components/parameters/SupportViewID" }]
      responses:
        "200": { description: Success, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/SupportActionResult" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/projects:
    get:
      operationId: listProjects
      x-ogen-operation-group: Identity
      tags: [orgs]
      summary: List the projects in the signed-in organization
      security: [{ session: [] }]
      x-luckylanding-org: person
      parameters: [{ $ref: "#/components/parameters/Limit" }, { $ref: "#/components/parameters/AfterID" }, { $ref: "#/components/parameters/BeforeID" }]
      responses:
        "200": { description: Success, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/ProjectList" } } } }
        default: { $ref: "#/components/responses/Error" }
    post:
      operationId: createProject
      x-ogen-operation-group: Identity
      tags: [orgs]
      summary: Create a project in the organization as an owner or admin
      security: [{ session: ["org:write"] }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/ProjectCreateParams" } } } }
      responses:
        "200": { description: Success, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/Project" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/session/project:
    post:
      operationId: switchSessionProject
      x-ogen-operation-group: Identity
      tags: [orgs]
      summary: Select the project for this dashboard session
      security: [{ session: ["org:read"] }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/SessionProjectParams" } } } }
      responses:
        "200": { description: Success, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/Project" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/session/person:
    get:
      operationId: getSessionPerson
      x-ogen-operation-group: Identity
      tags: [orgs]
      summary: Read the signed-in person, whether or not they belong to an org yet
      description: |
        Errors:
        - 403 `person_required`. Only a person's own dashboard session reads it; an agent's token and an API key name no person to read.
      security: [{ session: ["org:read"] }]
      x-luckylanding-org: person
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/Person" } } } }
        default: { $ref: "#/components/responses/Error" }
    post:
      operationId: updateSessionPerson
      x-ogen-operation-group: Identity
      tags: [orgs]
      summary: Change the signed-in person's name
      description: |
        Sets the name every org the person belongs to shows for them, and returns the person. A later sign-in keeps it, whatever name the sign-in provider gives.

        Errors:
        - 400 `invalid_field`, `errors[].pointer` `/name`. The name is blank, or holds a character nobody sees, such as a control or a zero-width space.
        - 403 `person_required`. Only the person, signed in to the dashboard, changes their name; an agent, a connected app or an API key can't.
      security: [{ session: ["org:write"] }]
      x-luckylanding-org: person
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/PersonUpdateParams" } } } }
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/Person" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/credential:
    get:
      operationId: getCredential
      x-ogen-operation-group: Credential
      tags: [orgs]
      summary: The operations the API key or the app's token that calls may call now
      description: |
        Any API key or app token of an org reads its own list, with no scope. The operations are the ones the same check that guards each call lets it call now: its scopes, its person's role for an app, and whether the org is closed.
      security: [{ oauth: [] }, { api_key: [] }]
      x-luckylanding-self: true
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/Credential" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/session/orgs:
    get:
      operationId: listSessionOrgs
      x-ogen-operation-group: Identity
      tags: [orgs]
      summary: The orgs the signed-in person is an active member of, each with its name
      description: |
        Lists only the orgs `switchSessionOrg` takes, newest org first, the session's own org among them.

        Errors:
        - 403 `person_required`. Only a person's own dashboard session lists them; an agent's token and an API key see only the org they were made for.
      security: [{ session: ["org:read"] }]
      x-luckylanding-org: person
      parameters: [{ $ref: "#/components/parameters/Limit" }, { $ref: "#/components/parameters/AfterID" }, { $ref: "#/components/parameters/BeforeID" }]
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/SessionOrgList" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/dashboard/products:
    get:
      operationId: getDashboardProducts
      x-ogen-operation-group: Setup
      tags: [setup]
      summary: Shows the organization's products and the setup they share in this project
      description: A signed-in merchant sees which products their organization holds, which products this project and role can open, and whether each product is available to acquire. Setup steps are shared by ID. Billing actions require their own permissions.
      security: [{ session: ["org:read"] }]
      responses:
        "200": { description: Dashboard products, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/DashboardProducts" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/setup:
    get:
      operationId: getSetupStatus
      x-ogen-operation-group: Setup
      tags: [setup]
      summary: Shows what the org has connected and bought, and each setup step it needs.
      description: |
        Returns `project_id` and this project’s connection status and setup steps. Organization credentials also receive billing details and the `buy_product` step. For those credentials, the response includes `connections`, each provider's connection status; `entitlements`, the products the org has now; `card_billing`, whether the org can add the checkout with its saved card here; and `steps`, the setup steps the org needs, each with whether it is done. Every step but `buy_product` works before the checkout is live, and the checkout takes the store's payments only once it is. It changes nothing.
      security: [{ oauth: ["org:read"] }, { api_key: [] }, { session: [] }]
      x-luckylanding-mcp: { tool: setup_get_status, title: Setup status }
      responses:
        "200": { $ref: "#/components/responses/SetupStatus" }
        default: { $ref: "#/components/responses/Error" }
  /v1/setup/store_script:
    get:
      operationId: getStoreScript
      x-ogen-operation-group: Setup
      tags: [setup]
      summary: Reads the line that puts Lucky Landing's checkout script in the store's theme, and whether the store's pages load it.
      description: |
        Returns `script_tag`, the one line the person pastes into the published theme's `layout/theme.liquid`, just before `</body>`. It is null until the org's checkout domain is verified (`checkout_get_domain`), since the line names that hostname. With the line in, the store's checkout button opens the org's checkout; a cart Lucky Landing can't take, and any failure, goes on to the store's own checkout. The person also turns off the store's Buy it now and wallet buttons, which skip the cart.

        `state` is what the store's own pages have reported. The script reports that it loaded, at most once a day from each browser, so `state` changes only after someone opens a page of the store. Behind a store password, the person opens the store and enters the password.
        - `missing`. Shopify reported another published theme after Lucky Landing last found the line in the published one, by its own write or a page's report, so the line may not be in the live theme and the `install_store_script` setup step isn't done. With `install` `automatic`, Lucky Landing is writing it, and `setup_write_store_script` writes it again when that write keeps failing; with `paste`, the person pastes the line into the newly published theme.
        - `waiting`. No page of the connected store has loaded the script.
        - `draft`. A page loaded it only in a theme that isn't published. The person publishes that theme, or pastes the line into the published one.
        - `seen`. A page of the published theme loaded it recently, and the `install_store_script` setup step is done.
        - `silent`. No page has loaded it since `seen_at`. A store nobody visited reads the same as a theme that lost the line, as when another theme is published, so the person opens the store, and pastes the line again if `state` stays `silent`.

        `install` says how the line gets there. `automatic`: the store's app holds the optional `write_themes` scope, so Lucky Landing wrote the line into the published theme at `written_at`, writes it again when another theme is published, and removes it on disconnect; nobody pastes it. `paste`: the person pastes `script_tag`, and `install_reason` says why Lucky Landing doesn't write it:
        - `domain_not_ready`. The checkout domain isn't verified yet.
        - `scope_missing`. The store's app lacks `write_themes`. The person adds it to the app, releases the new version, approves it in Shopify, then calls `setup_write_store_script`; or pastes the line.
        - `refused`. Shopify refused Lucky Landing's write to the theme. The person pastes the line.
        - `no_body_tag`. The published theme's `layout/theme.liquid` has no `</body>`, so Lucky Landing can't tell where the line goes. The person pastes it.
        - null. Lucky Landing hasn't tried yet; it does within minutes of the domain being verified.

        After disconnecting the store, the person deletes a line Lucky Landing didn't write. It changes nothing.
      security: [{ api_key: ["org:read"] }, { session: ["org:read"] }]
      x-luckylanding-mcp: { tool: setup_get_store_script, title: Store theme script }
      responses:
        "200": { description: OK, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/StoreScript" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/setup/store_script/write:
    post:
      operationId: writeStoreScript
      x-ogen-operation-group: Setup
      tags: [setup]
      summary: Writes Lucky Landing's checkout script line into the store's published theme now, when the store's app allows it, and returns what `setup_get_store_script` returns.
      description: |
        Call it when the person has just added the `write_themes` scope to the store's app, or wants the line back after it was deleted from the theme. Lucky Landing reads the scopes the app holds now; with `write_themes`, it puts its one line just before `</body>` in the published theme's `layout/theme.liquid`, replaces a line it wrote for an older checkout domain, and from then on writes it again when another theme is published. In the theme it changes only that line. Without the scope, or when Shopify refuses, nothing in the theme changes and `install` is `paste`, with `install_reason`. Calling it again when the line is there writes nothing.
        Errors:
        - 503 `unavailable`. Shopify didn't answer; try again in a minute.
      security: [{ api_key: ["connections:write"] }, { session: ["connections:write"] }]
      x-luckylanding-txn: true
      x-luckylanding-mcp: { tool: setup_write_store_script, title: Write the script into the store's theme, destructive: true, idempotent: true, open_world: true }
      responses:
        "200": { description: OK, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/StoreScript" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/waitlist:
    post:
      operationId: joinWaitlist
      x-ogen-operation-group: Identity
      tags: [orgs]
      summary: Ask for early access from LL's site. The answer is the same whether or not the email is already on the waitlist.
      description: |
        A new request is kept unconfirmed, and LL emails the address a link to `confirmWaitlist`; only a confirmed request reaches staff's CRM. Sent again for an address that has not confirmed, it emails a new link, which replaces the old one, at most once an hour.
      security: []
      x-luckylanding-org: public
      x-luckylanding-site: true
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/WaitlistParams" } } } }
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/WaitlistReceipt" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/waitlist/confirm:
    post:
      operationId: confirmWaitlist
      x-ogen-operation-group: Identity
      tags: [orgs]
      summary: Confirm the email address of an early-access request with the token from LL's email
      description: |
        The token is the credential: it is the one in the newest link LL emailed the address. Confirming again with the same token answers the same.

        Errors:
        - 404 `waitlist_request_not_found`. No request has this token, or a newer link replaced it.
      security: []
      x-luckylanding-org: public
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/WaitlistConfirmParams" } } } }
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/WaitlistReceipt" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/orgs:
    post:
      operationId: createOrg
      x-ogen-operation-group: Identity
      tags: [orgs]
      summary: Create an org and become its owner
      description: |
        The signed-in person becomes the owner of a new org, and their session moves to it. With `invite_token`, the org is the one the invite was issued for: the token works once, before it expires, and only for a person whose verified email is the address the invite was sent to. Creating the org records that the person accepted the current versions of Lucky Landing's Terms of service, Privacy policy and Acceptable use policy, in the same write, so no org exists without it.

        Errors:
        - 403 `invite_required`. Production needs `invite_token` until public launch, or the token cannot be used.
      security: [{ session: ["org:write"] }]
      x-luckylanding-org: person
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/OrgCreateParams" } } } }
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" }, ETag: { $ref: "#/components/headers/ETag" } }, content: { application/json: { schema: { $ref: "#/components/schemas/Org" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/orgs/{org_id}:
    get:
      operationId: getOrg
      x-ogen-operation-group: Identity
      tags: [orgs]
      summary: Read the org, and whether it is closed and when it is deleted
      security: [{ api_key: ["org:read"] }, { session: ["org:read"] }]
      x-luckylanding-closed: true
      parameters: [{ $ref: "#/components/parameters/OrgID" }]
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" }, ETag: { $ref: "#/components/headers/ETag" } }, content: { application/json: { schema: { $ref: "#/components/schemas/Org" } } } }
        default: { $ref: "#/components/responses/Error" }
    post:
      operationId: updateOrg
      x-ogen-operation-group: Identity
      tags: [orgs]
      summary: Rename the org
      description: |
        Errors:
        - 403 `role_not_allowed`. Renaming requires an owner or admin session, or an organization API key with `org:write`. Connected apps receive `transaction_denied` when they hold the scope.
        - 400 `invalid_field`, `errors[].pointer` `/name`. The name is blank or longer than 120 characters.
      security: [{ api_key: ["org:write"] }, { session: ["org:write"] }]
      parameters: [{ $ref: "#/components/parameters/OrgID" }, { $ref: "#/components/parameters/IfMatch" }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/OrgUpdateParams" } } } }
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" }, ETag: { $ref: "#/components/headers/ETag" } }, content: { application/json: { schema: { $ref: "#/components/schemas/Org" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/orgs/{org_id}/close:
    post:
      operationId: closeOrg
      x-ogen-operation-group: Identity
      tags: [orgs]
      summary: Close the org; it is deleted 7 days later unless an owner undoes it
      description: |
        An owner, signed in to the dashboard, closes the org by sending its name exactly as it is. At once the org's checkout takes no payments and its store's checkout button stays on the store's own checkout; its API keys and connected apps, and its members who aren't owners, get 403 `org_closed`; nothing is deleted, revoked or cancelled. Every owner is emailed who closed it, when it is deleted and how to undo it. Any owner undoes it with `reopenOrg` until `closing.deletes_at`, when Lucky Landing deletes the org and its data and keeps the records the law needs. Closing an org that is already closed changes nothing and returns it as it is.

        Errors:
        - 403 `person_required`. Only a person signed in to the dashboard closes the org; an API key or a connected app can't.
        - 403 `role_not_allowed`. Only an owner closes the org.
        - 400 `invalid_field`. `name` is not the org's name.
      security: [{ api_key: ["org:write"] }, { session: ["org:write"] }]
      x-luckylanding-closed: true
      parameters: [{ $ref: "#/components/parameters/OrgID" }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/OrgCloseParams" } } } }
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" }, ETag: { $ref: "#/components/headers/ETag" } }, content: { application/json: { schema: { $ref: "#/components/schemas/Org" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/orgs/{org_id}/reopen:
    post:
      operationId: reopenOrg
      x-ogen-operation-group: Identity
      tags: [orgs]
      summary: Undo the org's closing before it is deleted
      description: |
        An owner, signed in to the dashboard, undoes the closing, and everything works as it did before it: the checkout, API keys, connected apps, members and connections. Reopening an org that isn't closed changes nothing and returns it as it is.

        Errors:
        - 403 `person_required`. Only a person signed in to the dashboard undoes the closing; an API key or a connected app can't.
        - 403 `role_not_allowed`. Only an owner undoes the closing.
        - 403 `org_closed`. Lucky Landing closed the org, so an owner can't undo it.
        - 404 `not_found`. The org is deleted, or its deletion has started.
      security: [{ api_key: ["org:write"] }, { session: ["org:write"] }]
      x-luckylanding-closed: true
      parameters: [{ $ref: "#/components/parameters/OrgID" }]
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" }, ETag: { $ref: "#/components/headers/ETag" } }, content: { application/json: { schema: { $ref: "#/components/schemas/Org" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/orgs/{org_id}/members:
    get:
      operationId: listMembers
      x-ogen-operation-group: Identity
      tags: [orgs]
      summary: The people who belong to the org, with their roles
      security: [{ api_key: ["org:read"] }, { session: ["org:read"] }]
      parameters: [{ $ref: "#/components/parameters/OrgID" }, { $ref: "#/components/parameters/Limit" }, { $ref: "#/components/parameters/AfterID" }, { $ref: "#/components/parameters/BeforeID" }]
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/MemberList" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/orgs/{org_id}/members/{person_id}:
    post:
      operationId: updateMember
      x-ogen-operation-group: Identity
      tags: [orgs]
      summary: Change a member's role
      description: |
        Owners and admins change roles, signed in to the dashboard. Only an owner can make someone an owner or change an owner's role, and the org always keeps one owner. The new role applies on the member's next request.
        Errors:
        - 403 `person_required`. Only a person signed in to the dashboard manages the team; an API key or a connected app cannot.
      security: [{ api_key: ["org:write"] }, { session: ["org:write"] }]
      parameters: [{ $ref: "#/components/parameters/OrgID" }, { $ref: "#/components/parameters/PersonID" }, { $ref: "#/components/parameters/IfMatch" }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/MemberUpdateParams" } } } }
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" }, ETag: { $ref: "#/components/headers/ETag" } }, content: { application/json: { schema: { $ref: "#/components/schemas/Member" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/orgs/{org_id}/members/{person_id}/remove:
    post:
      operationId: removeMember
      x-ogen-operation-group: Identity
      tags: [orgs]
      summary: End a person's membership of the org
      description: |
        Owners and admins remove members, signed in to the dashboard. Only an owner can remove an owner, and the org always keeps one owner. The person's next request no longer acts for the org.
        Errors:
        - 403 `person_required`. Only a person signed in to the dashboard manages the team; an API key or a connected app cannot.
      security: [{ api_key: ["org:write"] }, { session: ["org:write"] }]
      parameters: [{ $ref: "#/components/parameters/OrgID" }, { $ref: "#/components/parameters/PersonID" }, { $ref: "#/components/parameters/IfMatch" }]
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" }, ETag: { $ref: "#/components/headers/ETag" } }, content: { application/json: { schema: { $ref: "#/components/schemas/Member" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/orgs/{org_id}/invites:
    get:
      operationId: listInvites
      x-ogen-operation-group: Identity
      tags: [orgs]
      summary: The invites that are still waiting to be accepted
      description: An invite that was accepted, revoked or has expired is not listed.
      security: [{ api_key: ["org:read"] }, { session: ["org:read"] }]
      parameters: [{ $ref: "#/components/parameters/OrgID" }, { $ref: "#/components/parameters/Limit" }, { $ref: "#/components/parameters/AfterID" }, { $ref: "#/components/parameters/BeforeID" }]
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/InviteList" } } } }
        default: { $ref: "#/components/responses/Error" }
    post:
      operationId: createInvite
      x-ogen-operation-group: Identity
      tags: [orgs]
      summary: Invite a person to the org by email
      description: |
        Owners and admins invite, signed in to the dashboard, and only an owner can invite an owner. Lucky Landing emails the address one link, which works once, only for a person signed in with that address, until `expires_at`. Inviting an address that already has a pending invite revokes the earlier one and sends a new link.
        Errors:
        - 403 `person_required`. Only a person signed in to the dashboard manages the team; an API key or a connected app cannot.
      security: [{ api_key: ["org:write"] }, { session: ["org:write"] }]
      parameters: [{ $ref: "#/components/parameters/OrgID" }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/InviteCreateParams" } } } }
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" }, ETag: { $ref: "#/components/headers/ETag" } }, content: { application/json: { schema: { $ref: "#/components/schemas/Invite" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/orgs/{org_id}/invites/{invite_id}/revoke:
    post:
      operationId: revokeInvite
      x-ogen-operation-group: Identity
      tags: [orgs]
      summary: Revoke a pending invite, so its link stops working
      description: |
        Owners and admins revoke invites, signed in to the dashboard.
        Errors:
        - 403 `person_required`. Only a person signed in to the dashboard manages the team; an API key or a connected app cannot.
      security: [{ api_key: ["org:write"] }, { session: ["org:write"] }]
      parameters: [{ $ref: "#/components/parameters/OrgID" }, { $ref: "#/components/parameters/InviteID" }, { $ref: "#/components/parameters/IfMatch" }]
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" }, ETag: { $ref: "#/components/headers/ETag" } }, content: { application/json: { schema: { $ref: "#/components/schemas/Invite" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/orgs/{org_id}/api_keys:
    get:
      operationId: listKeys
      x-ogen-operation-group: Identity
      tags: [orgs]
      summary: The org's API keys that still work
      description: A revoked key is not listed. No operation returns a key's secret after the key is made.
      security: [{ api_key: ["org:read"] }, { session: ["org:read"] }]
      parameters: [{ $ref: "#/components/parameters/OrgID" }, { $ref: "#/components/parameters/Limit" }, { $ref: "#/components/parameters/AfterID" }, { $ref: "#/components/parameters/BeforeID" }]
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/ApiKeyList" } } } }
        default: { $ref: "#/components/responses/Error" }
    post:
      operationId: createKey
      x-ogen-operation-group: Identity
      tags: [orgs]
      summary: Make an API key for an agent or a script
      description: |
        The response is the only time the secret is shown. Send it as `Authorization: Bearer <secret>` to `/v1` or to the MCP endpoint. The key belongs to the org, not to the person who makes it: it acts in every store of the org within its scopes, keeps working when that person leaves or changes role, and stops working when it is revoked or reaches `expires_at`. A key never makes keys or manages the team.
        Errors:
        - 400 `invalid_field`, `errors[].pointer` `/scopes`. A scope is not one of the API's scopes.
        - 400 `invalid_field`, `errors[].pointer` `/expires_at`. The time is not in the future.
        - 403 `person_required`. An API key or connected app cannot manage API keys. Sign in to the dashboard.
        - 403 `api_key_not_allowed`. The signed-in person needs the owner or admin role.
      security: [{ session: ["org:read"] }]
      parameters: [{ $ref: "#/components/parameters/OrgID" }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/ApiKeyCreateParams" } } } }
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" }, ETag: { $ref: "#/components/headers/ETag" } }, content: { application/json: { schema: { $ref: "#/components/schemas/ApiKeyCreated" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/orgs/{org_id}/api_keys/{api_key_id}/revoke:
    post:
      operationId: revokeKey
      x-ogen-operation-group: Identity
      tags: [orgs]
      summary: Revoke an API key, so its next request is refused
      description: |
        A key is revoked by an owner or an admin, signed in to the dashboard.
        Errors:
        - 403 `person_required`. An API key or connected app cannot manage API keys. Sign in to the dashboard.
        - 403 `api_key_not_allowed`. The signed-in person needs the owner or admin role.
        - 404 `not_found`. The org has no key with this ID that is not revoked.
      security: [{ session: ["org:read"] }]
      parameters: [{ $ref: "#/components/parameters/OrgID" }, { $ref: "#/components/parameters/ApiKeyID" }, { $ref: "#/components/parameters/IfMatch" }]
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" }, ETag: { $ref: "#/components/headers/ETag" } }, content: { application/json: { schema: { $ref: "#/components/schemas/ApiKey" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/orgs/{org_id}/agent_grants:
    get:
      operationId: listGrants
      x-ogen-operation-group: Identity
      tags: [orgs]
      summary: The apps connected to the org that still work
      description: Each grant is one app a person connected, with the access they gave it. A revoked grant is not listed.
      security: [{ api_key: ["org:read"] }, { session: ["org:read"] }]
      parameters: [{ $ref: "#/components/parameters/OrgID" }, { $ref: "#/components/parameters/Limit" }, { $ref: "#/components/parameters/AfterID" }, { $ref: "#/components/parameters/BeforeID" }]
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/AgentGrantList" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/orgs/{org_id}/agent_grants/{agent_grant_id}/revoke:
    post:
      operationId: revokeGrant
      x-ogen-operation-group: Identity
      tags: [orgs]
      summary: Disconnect an app, so its next request is refused
      description: |
        A grant is revoked by the person who gave it, an owner or an admin, signed in to the dashboard. Every token that names the grant is refused from its next request.
        Errors:
        - 403 `role_not_allowed`. The caller is not the grant's person, an owner or an admin, or is not a signed-in person.
        - 404 `not_found`. The org has no working grant with this ID.
      security: [{ api_key: ["org:read"] }, { session: ["org:read"] }]
      parameters: [{ $ref: "#/components/parameters/OrgID" }, { $ref: "#/components/parameters/AgentGrantID" }, { $ref: "#/components/parameters/IfMatch" }]
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" }, ETag: { $ref: "#/components/headers/ETag" } }, content: { application/json: { schema: { $ref: "#/components/schemas/AgentGrant" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/audit_log:
    get:
      operationId: listAuditLog
      x-ogen-operation-group: AuditLog
      tags: [orgs]
      summary: Who did what in the org, newest first
      description: |
        Each entry is one action recorded in the org's audit log: who acted, through which API key or app, what they did, to what and with what result. An entry shows no other detail the action recorded, so it never holds a secret, an argument's value or a shopper's data.
        Errors:
        - 403 `role_not_allowed`. Only an owner or admin session can read the audit log. A connected app holding `org:read` receives `transaction_denied`.
      security: [{ api_key: ["org:read"] }, { session: ["org:read"] }]
      parameters: [{ $ref: "#/components/parameters/Limit" }, { $ref: "#/components/parameters/AfterID" }, { $ref: "#/components/parameters/BeforeID" }]
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/AuditEntryList" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/invites/accept:
    post:
      operationId: acceptInvite
      x-ogen-operation-group: Identity
      tags: [orgs]
      summary: Join the org an invite names
      description: The signed-in person joins the org with the invite's role, and their session moves to that org. The token works once, before it expires, and only for a person whose verified email is the address the invite was sent to. Joining records that the person accepted the current versions of Lucky Landing's Terms of service, Privacy policy and Acceptable use policy, in the same write, so no membership starts without it.
      security: [{ session: ["org:write"] }]
      x-luckylanding-org: person
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/InviteAcceptParams" } } } }
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" }, ETag: { $ref: "#/components/headers/ETag" } }, content: { application/json: { schema: { $ref: "#/components/schemas/Org" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/invites/preview:
    get:
      operationId: getInvitePreview
      x-ogen-operation-group: Identity
      tags: [orgs]
      summary: Read what an invite link offers before joining, without signing in
      description: |
        The token is the credential, so anyone holding the link reads what the invite email already told the person it was sent to: the org's name, the address of the member who sent it, the role, and whether the link can still be used. The address the invite was sent to is never returned. Sent with a dashboard session, the answer also names the signed-in person's address and whether the invite is theirs to accept. It changes nothing.

        Errors:
        - 404 `invite_not_found`. No invite has this token, or its org no longer exists. A malformed token gets the same answer.
      security: []
      x-luckylanding-org: public
      parameters: [{ $ref: "#/components/parameters/InviteToken" }]
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/InvitePreview" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/policies/accept:
    post:
      operationId: acceptPolicies
      x-ogen-operation-group: Identity
      tags: [orgs]
      summary: Accept the current versions of Lucky Landing's policies
      description: |
        Records that the signed-in person accepted, in the session's org, each current version of the Terms of service, Privacy policy and Acceptable use policy listed in the session's `policies_to_accept`, and returns the ones it recorded. Every member can accept, whatever their role. Accepting again records nothing more. Each acceptance is kept as it was made and never changed.
        Errors:
        - 403 `person_required`. A person accepts in the dashboard, signed in; an agent, a connected app or an API key can't accept for them.
        - 403 `org_required`. The session acts for no org yet; creating or joining one accepts the policies.
      security: [{ session: ["org:write"] }]
      x-luckylanding-org: person
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/PolicyAcceptance" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/billing/catalogue:
    get:
      operationId: getCatalogue
      x-ogen-operation-group: Billing
      deprecated: true
      tags: [billing]
      description: The list prices only, without sign-in. It stays public only because the rollout's analysis probe reads it to check that a new api answers; D49 publishes no prices, so an org reads the prices it pays with `listPrices`. A price that names one org is left out (BILL-R1).
      security: []
      x-luckylanding-org: public
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/Catalogue" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/billing/prices:
    get:
      operationId: listPrices
      x-ogen-operation-group: Billing
      tags: [billing]
      summary: Lists the prices this org pays for each product.
      description: Returns a page of prices. Each is the list price for a product, currency and interval, unless this org has its own price for them, which takes its place while it is in effect. A price with `org_id` is this org's own, and `effective_until` says when it stops. The org comes from the caller's credential. For an org with a saved card they are the prices in effect at the start of the current hour, which a person's add in Billing bills from; for one without, the prices in effect now. It changes nothing.
      security: [{ api_key: ["billing:read"] }, { session: ["billing:read"] }]
      x-luckylanding-mcp: { tool: billing_list_prices, title: Prices this organization pays }
      parameters: [{ $ref: "#/components/parameters/Limit" }, { $ref: "#/components/parameters/AfterID" }, { $ref: "#/components/parameters/BeforeID" }]
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/PriceList" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/billing/entitlements:
    get:
      operationId: listEntitlements
      x-ogen-operation-group: Billing
      tags: [billing]
      summary: Lists the products this org has, bought or granted, with their status.
      description: Returns a page of entitlements, each with `product`, `source`, `status`, `period_end` and `cancel_at_period_end`. `source` is `bill` for a product the org added with its saved card, `grant` for a product staff granted, and `purchase` for one bought through a checkout link on the billing rail before products moved to the saved card, which stays on until `period_end` and doesn't renew. Use it to see whether an add went through or when a product ends; `setup_get_status` gives only the names of the products the org has now. It changes nothing.
      security: [{ api_key: ["billing:read"] }, { session: ["billing:read"] }]
      x-luckylanding-mcp: { tool: billing_list_entitlements, title: Products this organization has }
      parameters: [{ $ref: "#/components/parameters/Limit" }, { $ref: "#/components/parameters/AfterID" }, { $ref: "#/components/parameters/BeforeID" }]
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/EntitlementList" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/billing/entitlements/{entitlement_id}/cancel:
    post:
      operationId: cancelEntitlement
      x-ogen-operation-group: Billing
      tags: [billing]
      summary: Cancels a product this org pays for.
      description: |
        Call it only when the person asks. Takes an entitlement's `id` from `billing_list_entitlements` and returns that entitlement. A product added with the saved card goes off at once: `status` turns `canceled`, `period_end` is now, and what the org paid for the rest of its period becomes account credit for its next bills, before tax, once the bill that charged it is paid; if that bill is still unpaid, the credit comes off it first. `billing_preview_cancellation` shows that credit before the person decides. One whose first bill isn't paid, carried or being charged yet is undone instead: `period_end` is when it was added, and nothing is owed for it. One bought through a checkout link before products moved to the saved card already ends at `period_end` and doesn't renew, so cancelling it returns it unchanged, as does cancelling one already ended. No tool undoes a cancel; once the product has ended, a person signed in to the dashboard adds it again in Billing. It refunds nothing.
        It needs `billing:money`, which only the owner and admin roles hold.
        Errors:
        - 404 `not_found`. No entitlement with this ID exists in the org.
        - 409 `entitlement_not_purchased`. Staff granted this product, so there is nothing to cancel.
        - 503 `unavailable` or `outcome_unknown`. Lucky Landing did not answer; call again.
      security: [{ api_key: ["billing:money"] }, { session: ["billing:money"] }]
      x-luckylanding-mcp: { tool: billing_cancel_entitlement, title: Cancel a product, destructive: true, idempotent: true, open_world: true }
      parameters: [{ $ref: "#/components/parameters/EntitlementID" }]
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/Entitlement" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/billing/entitlements/{entitlement_id}/cancel_preview:
    get:
      operationId: previewEntitlementCancel
      x-ogen-operation-group: Billing
      tags: [billing]
      summary: Shows what cancelling a product now would give back as account credit, without cancelling it.
      description: |
        Takes an entitlement's `id` from `billing_list_entitlements`. `credit` is the account credit that `billing_cancel_entitlement` gives if it is called in this hour, before tax, computed the same way: for each bill that charged the product, its share of the product's line after the start of this hour, rounded half up to the cent. It comes back once its bill is paid, and on a bill still unpaid it comes off that bill first. `undone` is true when the product's first bill isn't paid, carried or being charged yet: a cancel then takes the product off instead, nothing is owed for it and no credit comes back. A product that has ended, or one bought through a checkout link before products moved to the saved card, gives none. The checkout fee on sales already recorded stays owed and goes on the next bill, which `billing_list_upcoming_bills` shows, whatever is cancelled. It changes nothing.
        Errors:
        - 404 `not_found`. No entitlement with this ID exists in the org.
        - 409 `entitlement_not_purchased`. Staff granted this product, so there is nothing to cancel.
        - 503 `unavailable`. Lucky Landing did not answer; call again.
      security: [{ api_key: ["billing:read"] }, { session: ["billing:read"] }]
      x-luckylanding-mcp: { tool: billing_preview_cancellation, title: What cancelling a product gives back }
      parameters: [{ $ref: "#/components/parameters/EntitlementID" }]
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CancelPreview" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/billing/add_preview:
    get:
      operationId: previewBillingProductAdd
      x-ogen-operation-group: Billing
      tags: [billing]
      summary: Shows what adding a product now would bill and charge to the saved card today, without adding it.
      description: |
        Computed the same way an add in this hour bills and charges it. `prorated` is the product's price for the rest of this month, from the start of this hour (`starts_at`) to the 1st (`ends_before`), as its share of the month's hours rounded half up to the cent, the way the billing engine prorates it. `credit` is the account credit that comes off that bill, up to its amount. `carried` is what the org's earlier bills under the billing rail's minimum charge come to, which join this charge. `charge` is today's charge before sales tax. `tax` and `total` are the billing rail's price of it, sales tax included, for the org's billing location; the charge is made at exactly `total`, or not at all. `tax_status` is `calculated` or `not_applicable` once the rail has priced it; `location_required` when the org has saved no billing location, which a person does in Billing in the dashboard; `unavailable` when the rail could not price it; and `not_charged` when nothing is charged today. Unless it is priced, `tax` is zero, `total` is `charge`, and an add with a charge is refused. `bill_status` says what happens to the add's bill: `open` when the card is charged `charge` now; `paid` when nothing is due, because the credit pays it in full or it comes to zero; `carried` when it comes to less than the billing rail's minimum charge, so it isn't charged yet and joins the org's next charge. An add sends `prorated`, `charge` and `total` back as the amounts the person accepted, and is refused once they change: at the start of each hour, and on the 1st, when the month starts again. Only a person signed in to the dashboard adds a product, so an agent reads this to tell the person what adding it charges today. It changes nothing on the org: it asks the billing rail to price today's charge and keeps a priced answer for the hour, for each amount and billing location. An unpriced answer is asked for again after a minute, and a call the rail didn't answer is asked again on the next read.
        It refuses with the same errors as an add would now, except that it previews an org with no saved card, which saves one before it adds.
        Errors:
        - 409 `not_on_sale`. The product has no monthly price in effect for this org on Lucky Landing's bills, so it can't be added with the saved card.
        - 409 `product_purchased`, `bill_unpaid`, `billing_managed`, `billing_retired` or `product_change_pending`. An add now is refused for the same reason; the add's errors say what each means.
        - 503 `unavailable`. Lucky Landing did not answer; call again.
      security: [{ api_key: ["billing:read"] }, { session: ["billing:read"] }]
      x-luckylanding-mcp: { tool: billing_preview_addition, title: What adding a product charges today }
      parameters: [{ $ref: "#/components/parameters/BillingProduct" }]
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/AddPreview" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/billing/products:
    post:
      operationId: addBillingProduct
      x-ogen-operation-group: Billing
      tags: [billing]
      summary: Adds a product to this org now and charges its first bill to the org's saved card, once the signed-in person accepted the card terms.
      description: |
        A person signed in to the dashboard adds a product after reading and accepting the card terms the dashboard shows beside it: the saved card is charged now for the rest of the month, prorated, then each month at the prices `billing_list_prices` and `billing_list_fee_rates` give the org, plus any sales tax, until the product is removed. `consent_version` is the version of that wording the person accepted, `price_id` the price it showed, the first of its product's schedule in `getPriceSchedules`, and `prorated`, `charge` and `total` the amounts `billing_preview_addition` showed for today, `total` with its sales tax. Today's charge is made at exactly `total`, or not at all. The add records the person, the version, the price and the time in its own transaction, and is refused unless all of them are the ones it bills now. An agent, a connected app or an API key can't accept the terms for a person, so it can't add one: the person adds it in Billing. Name one product in `product`; it is priced at the price `billing_list_prices` lists for this org. The product is on at once and the entitlement comes back with `source` `bill`. Lucky Landing then bills the rest of the current period and charges the org's saved card for that bill, which already has any account credit the org holds taken off it, and charges each later period's bill to the saved card until the product is cancelled, or ends because a bill it is on is still unpaid at the bill's `grace_until` (`billing_get_due`). If the bill is not paid within the hour and no charge for it is still waiting on the rail, the product is taken off again and nothing is owed. A bill the credit pays in full is settled without a charge, and one left under the rail's minimum charge is not charged yet: the product stays on and the bill is added to the org's next charge. A first charge that comes to more than `charge`, as when the billing engine took less account credit off the bill than Lucky Landing's records hold, is never sent: the product is taken off again within the hour and nothing is owed. It charges the saved card.
        It needs `billing:money`, which only the owner and admin roles hold.
        Errors:
        - 403 `person_required`. Only a person signed in to the dashboard accepts the card terms and adds a product; an agent, a connected app or an API key can't.
        - 409 `card_terms_changed`. `consent_version` is not the version of the card terms in force, `price_id` is not the price the add bills now, or `prorated`, `charge` or `total` is not what it bills and charges today, as at the start of each hour, on the 1st, or once the billing location changes; show the person the current terms, price and `billing_preview_addition`, and send them once the person accepts them.
        - 409 `card_billing_off`. Adding a product with the saved card is not open in this environment, so the org can't buy one here; Lucky Landing's staff can grant it.
        - 409 `card_required`. The org has no saved card; `billing_create_card_setup` saves one.
        - 409 `location_required`. The org has saved no billing location, so today's sales tax can't be worked out; a person saves it in Billing in the dashboard.
        - 409 `not_on_sale`. The product has no monthly price in effect for this org on Lucky Landing's bills.
        - 409 `product_purchased`. The org already pays for this product.
        - 409 `bill_unpaid`. A bill or another product the org added is not paid yet, or a carried bill's charge failed; `billing_get_due` shows what is owed.
        - 409 `billing_managed`. Lucky Landing's staff look after this org's bills, so they add its products.
        - 409 `billing_retired`. Lucky Landing's staff retired this org from its bills, so nothing can be added with its saved card.
        - 409 `product_change_pending`. The last change to this product is not on Lucky Landing's bills yet; `billing_list_entitlements` shows the product as it is.
        - 503 `unavailable` or `outcome_unknown`. Lucky Landing did not answer; call `billing_list_entitlements` before calling again.
      security: [{ session: ["billing:money"] }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/BillingProductParams" } } } }
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/Entitlement" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/billing/price_schedules:
    get:
      operationId: getPriceSchedules
      x-ogen-operation-group: Billing
      tags: [billing]
      summary: Shows, for each product, the one price an add with the saved card bills, and each price that takes its place later.
      description: |
        Returns one schedule for each product an add can name. Its `prices` are oldest first. The first is the price an add of that product with the saved card bills now: this org's own monthly price where staff set one, or else the monthly list price, in effect at the start of the current hour for an org with a saved card; a product with no monthly price has none. Each later one takes its place from its `starts_at`, as a scheduled list price or the end of this org's own price does, and a product already added moves to it at its first period that starts then or after. `prices` is empty when the product has no price an add could bill. Its first `id` is the `price_id` an add sends. It changes nothing.
      security: [{ api_key: ["billing:read"] }, { session: ["billing:read"] }]
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/PriceSchedules" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/billing/due:
    get:
      operationId: getBillingDue
      x-ogen-operation-group: Billing
      tags: [billing]
      summary: Shows what this org owes on Lucky Landing's own bills.
      description: Returns `amount_due`, what the org's unpaid bills come to, and each such bill in `bills`, oldest first. A bill with `status` `open` is charged to the saved card, or waits until the org saves one. Lucky Landing tries it 4 times over 7 days, and its `retry_at` is when it next tries the saved card for it by itself; its `grace_until` is when the products on it end if it is still unpaid then, which turns the checkout off, and then nothing more is charged for them and the bill is still owed. A bill with `status` `carried` is under the billing rail's minimum charge and is added to the org's next charge. A bill is gone from the list once it is paid. `billing_pay_due` charges the saved card for what is owed now. It changes nothing.
      security: [{ api_key: ["billing:read"] }, { session: ["billing:read"] }]
      x-luckylanding-mcp: { tool: billing_get_due, title: What the organization owes }
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/BillingDue" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/billing/due/pay:
    post:
      operationId: payBillingDue
      x-ogen-operation-group: Billing
      tags: [billing]
      summary: Charges the org's saved card now for its unpaid Lucky Landing bills.
      description: |
        Call it only when the person asks to pay. A card the org saves is charged for its open bills anyway. When the bank asked to confirm a bill's last charge and it wasn't confirmed, a signed-in person's call answers `confirm_url`, the page where they pay that bill and confirm it with their bank; any other caller's call charges the saved card again. Each open bill not already being charged is charged to the saved card within moments (an org with no saved card is charged nothing until it saves one with `billing_create_card_setup`), carried bills with it, and it returns what `billing_get_due` shows; a bill waiting for a product change to reach Lucky Landing's bills is charged once the change is on them. Paying a bill after its `grace_until` clears what is owed and turns no ended product back on; a person adds it again in Billing. Calling it again while a charge is being made starts no second charge. It charges the saved card.
        It needs `billing:money`, which only the owner and admin roles hold.
        Errors:
        - 409 `nothing_to_pay`. The org owes no open bill now: nothing is owed, or only bills under the billing rail's minimum, which join the next bill.
        - 409 `billing_managed`. Lucky Landing's staff settle this org's bills.
        - 503 `unavailable` or `outcome_unknown`. Lucky Landing did not answer; call `billing_get_due` before calling again.
      security: [{ api_key: ["billing:money"] }, { session: ["billing:money"] }]
      x-luckylanding-mcp: { tool: billing_pay_due, title: Pay what the organization owes with the saved card, destructive: true, open_world: true }
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/BillingDue" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/billing/bills:
    get:
      operationId: listBills
      x-ogen-operation-group: Billing
      tags: [billing]
      summary: Lists this org's Lucky Landing bills, newest first, each with its lines and its last charge.
      description: Returns a page of the bills Lucky Landing copied from its billing engine for this org, newest first. Each bill has its `status`, every line as the engine billed it, the account credit spent on it, the earlier bills under the billing rail's minimum that its charge took with it, and its last charge to the saved card as the billing rail recorded it, with the sales tax the rail added and any decline. Every amount is one Lucky Landing stored, before tax unless it says otherwise. `billing_get_due` shows what is owed now, and `billing_get_account_credit` the account credit. It changes nothing.
      security: [{ api_key: ["billing:read"] }, { session: ["billing:read"] }]
      x-luckylanding-mcp: { tool: billing_list_bills, title: Bills }
      parameters: [{ $ref: "#/components/parameters/Limit" }, { $ref: "#/components/parameters/AfterID" }, { $ref: "#/components/parameters/BeforeID" }]
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/BillList" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/billing/account_credit:
    get:
      operationId: getAccountCredit
      x-ogen-operation-group: Billing
      tags: [billing]
      summary: Shows this org's account credit and the newest entries of its ledger.
      description: Returns `balance`, the account credit the org holds now, and `entries`, the newest 100 entries of its ledger, newest first, each naming the bill it belongs to. Account credit is the unused part of a cancelled product's period and the amount of a bill below zero. The billing engine takes it off the next bills it issues, and on a bill that was still unpaid when its product was cancelled Lucky Landing takes it off that bill first; either way before tax, so the tax the billing rail added is never credited. Only support pays it out. It changes nothing.
      security: [{ api_key: ["billing:read"] }, { session: ["billing:read"] }]
      x-luckylanding-mcp: { tool: billing_get_account_credit, title: Account credit }
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/AccountCredit" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/billing/fee_rates:
    get:
      operationId: getFeeRates
      x-ogen-operation-group: Billing
      tags: [billing]
      summary: Lists the usage prices this org pays on each product, such as Checkout's share of sales, now and from each later month they change.
      description: Returns, for each meter of each product, the rate in force now and each later one set, oldest first, each this org's own rate where Lucky Landing's staff set one for it, or else the list rate. A rate's `unit_price` and its `tiers` are exactly the prices Lucky Landing gives its billing engine for one `unit` of the meter, so a `unit` of `sales_cent` makes `unit_price` the share of each sale (`0.008` US cents a cent is 0.8%). The engine bills each month's usage on the bill issued after that month ends, at the rate in force when Lucky Landing recorded the sale or refund. `billing_list_prices` lists the monthly prices. It changes nothing.
      security: [{ api_key: ["billing:read"] }, { session: ["billing:read"] }]
      x-luckylanding-mcp: { tool: billing_list_fee_rates, title: Usage prices this organization pays }
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/FeeRates" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/billing/upcoming_bills:
    get:
      operationId: getUpcomingBills
      x-ogen-operation-group: Billing
      tags: [billing]
      summary: Lists this org's bills that the billing engine has not issued yet, such as the open month's, with their total so far.
      description: |
        Returns each of this org's period bills that the billing engine holds as a draft, oldest first, as the engine holds it now: its period, its `total` so far, fractions of a cent included, and its lines, which change as sales, refunds and changes to products are recorded. The first one is the org's next bill: the engine issues it at its `issues_at`, and Lucky Landing charges the saved card for it that day (UTC), less any account credit it takes. An org that has never been billed has none. `billing_list_bills` lists the bills already issued. It changes nothing.
        Errors:
        - 503 `unavailable` or `outcome_unknown`. Lucky Landing or its billing engine did not answer; call again.
      security: [{ api_key: ["billing:read"] }, { session: ["billing:read"] }]
      x-luckylanding-mcp: { tool: billing_list_upcoming_bills, title: Bills not issued yet, open_world: true }
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/UpcomingBills" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/billing/card:
    get:
      operationId: getBillingCard
      x-ogen-operation-group: Billing
      tags: [billing]
      summary: Shows the card this org has saved on the billing rail for Lucky Landing's own bills.
      description: Returns the org's saved card as `brand`, `last4`, `exp_month` and `exp_year`, each null when the billing rail did not give it, and `saved_at`, when the rail saved it. Every field is null while the org has no saved card. A newer card replaces an older one. `billing_create_card_setup` saves or changes it. It changes nothing.
      security: [{ api_key: ["billing:read"] }, { session: ["billing:read"] }]
      x-luckylanding-mcp: { tool: billing_get_card, title: Saved card }
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/BillingCard" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/billing/tax_location:
    get:
      operationId: getBillingTaxLocation
      x-ogen-operation-group: Billing
      tags: [billing]
      summary: Shows the country, state and postal code this org's sales tax is worked out for.
      description: Returns the place the org gave for its card's billing address, or 404 `not_found` when it has given none. Lucky Landing prices today's charge for an added product, sales tax included, for this place, and the charge carries it. It changes nothing.
      security: [{ api_key: ["billing:read"] }, { session: ["billing:read"] }]
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/BillingTaxLocation" } } } }
        default: { $ref: "#/components/responses/Error" }
    post:
      operationId: saveBillingTaxLocation
      x-ogen-operation-group: Billing
      tags: [billing]
      summary: Saves the country, state and postal code this org's sales tax is worked out for.
      description: |
        Sets the place the org's card is billed in: an ISO 3166-1 country, the state where the country is the United States or Canada, and the postal code. Lucky Landing prices today's charge for an added product, sales tax included, for this place, and the charge carries it. Saving again replaces it; a charge already being made keeps the place it was priced for.
        It needs `billing:money`, which only the owner and admin roles hold.
        Errors:
        - 400 `invalid_field`. The country isn't two capital letters, the state is missing for the United States or Canada, or the postal code is empty or longer than 12 characters.
      security: [{ api_key: ["billing:money"] }, { session: ["billing:money"] }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/BillingTaxLocationParams" } } } }
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/BillingTaxLocation" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/billing/card_setups:
    post:
      operationId: createBillingCardSetup
      x-ogen-operation-group: Billing
      tags: [billing]
      summary: Creates a link to the billing rail's page, where a person saves a card for this org's Lucky Landing bills.
      description: |
        Returns the setup's `id` and `url`. Use it when the person you act for wants to save a card or change the saved one. Give the `url` to the person, who enters the card on the rail's page in their browser; no tool takes a card. Once they have saved it, `billing_sync_card_setup` with the setup's `id` records the card at once, and the rail's webhook records it anyway. The newest saved card replaces the one before. Each call makes a new setup. It records the setup and creates a page on the billing rail, and charges nothing; the card it saves is then charged for any open bill the org owes, unless Lucky Landing's staff settle the org's bills.
        It needs `billing:money`, which only the owner and admin roles hold.
        Errors:
        - 502 `billing_rail_refused`. The billing rail refused the page; calling again won't help.
        - 503 `unavailable` or `outcome_unknown`. The billing rail or Lucky Landing did not answer; call again.
      security: [{ api_key: ["billing:money"] }, { session: ["billing:money"] }]
      x-luckylanding-mcp: { tool: billing_create_card_setup, title: Create a link to save a card, open_world: true, opens: { field: url, message: "Opens the page where you save a card for Lucky Landing's bills." } }
      requestBody: { required: false, content: { application/json: { schema: { $ref: "#/components/schemas/CardSetupParams" } } } }
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CardSetup" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/billing/card_setups/{card_setup_id}/sync:
    post:
      operationId: syncBillingCardSetup
      x-ogen-operation-group: Billing
      tags: [billing]
      summary: Records the card saved through a card setup, so it shows at once.
      description: |
        Call it with the setup's `id` from `billing_create_card_setup` once the person says they have saved the card. Reads the billing rail for a card saved through the setup, records it for this org, and returns the org's saved card as `billing_get_card` does. The rail's webhook records the card anyway, so this only saves waiting for it. Calling it again records nothing new. It charges nothing itself; a card it records is then charged for any open bill the org owes, unless Lucky Landing's staff settle the org's bills.
        It needs `billing:money`, which only the owner and admin roles hold.
        Errors:
        - 404 `not_found`. No card setup with this ID exists in the org.
        - 409 `card_not_saved`. The billing rail has saved no card through this setup yet; ask again after a few seconds.
        - 502 `billing_rail_refused`. The billing rail refused the read; calling again won't help.
        - 503 `unavailable` or `outcome_unknown`. The billing rail or Lucky Landing did not answer; call again.
      security: [{ api_key: ["billing:money"] }, { session: ["billing:money"] }]
      x-luckylanding-mcp: { tool: billing_sync_card_setup, title: Record a saved card, destructive: true, idempotent: true, open_world: true }
      parameters: [{ $ref: "#/components/parameters/CardSetupID" }]
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/BillingCard" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/verification_stores:
    get:
      operationId: listCheckoutVerificationStores
      x-ogen-operation-group: Connect
      tags: [connections]
      summary: List verified Shopify stores for checkout verification
      description: Lists verified Shopify stores the caller can read in this project.
      security: [{ api_key: ["checkout:read"] }, { session: ["checkout:read"] }]
      parameters: [{ $ref: "#/components/parameters/Limit" }, { $ref: "#/components/parameters/AfterID" }, { $ref: "#/components/parameters/BeforeID" }]
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/ProcessorStoreList" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/connections/stripe_onboarding_countries:
    get:
      operationId: getStripeOnboardingCountries
      x-ogen-operation-group: Connect
      tags: [connections]
      summary: Stripe account countries for a verified store
      description: An unverified store or missing Stripe registration returns 409 processor_environment_unavailable. Stripe’s final account-creation checks still apply.
      security: [{ api_key: ["connections:write"] }, { session: ["connections:write"] }]
      x-luckylanding-txn: true
      x-luckylanding-store-resource: query
      parameters: [{ $ref: "#/components/parameters/CheckoutStoreQuery" }]
      responses:
        "200": { description: Stripe country choices and the country fixed by an earlier opening, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/StripeOnboardingCountries" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/connections/processor_stores:
    get:
      operationId: listProcessorStores
      x-ogen-operation-group: Connect
      tags: [connections]
      summary: List stores for payment setup
      description: Lists verified Shopify stores the caller can manage in this project.
      security: [{ api_key: ["connections:write"] }, { session: ["connections:write"] }]
      x-luckylanding-mcp: { tool: connections_list_processor_stores, title: Stores for payment setup }
      parameters: [{ $ref: "#/components/parameters/Limit" }, { $ref: "#/components/parameters/AfterID" }, { $ref: "#/components/parameters/BeforeID" }]
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/ProcessorStoreList" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/connect_links:
    post:
      operationId: createConnectLink
      x-ogen-operation-group: Connect
      tags: [connections]
      summary: Creates a single-use, 15-minute link a person opens to connect Shopify, Whop or Stripe; only a person signed in to the dashboard starts one for Klaviyo or Google Analytics.
      description: |
        Give the merchant the link’s `url`. They approve access at the provider. Read `connections_get_link` until it returns `completed` and a `connection_id`.
        For Google Analytics, only the requesting person can select from `google_streams`, when Google’s `connects` is true. Manual measurement ID entry remains available.
        Stripe keeps the opened link pending for up to a day while the person enters their details on Stripe. Its connection stays pending until card payments are enabled; `requirements` lists outstanding items. Only the person can finish from Continue on Stripe in the dashboard. No response returns a Stripe onboarding URL or secret.
        Errors:
        - 400 `invalid_field`, `errors[].pointer` `/return_to`. The provider has no such page to come back to.
        - 403 `person_required`. Only a person signed in to the dashboard starts a Klaviyo or Google discovery link; an agent sends them to Checkout, under Tracking.
        - 403 `coming_soon`. The requested tracking or processor capability is still in testing, or GA4 `connects` or Ads `google_ads_discovery` is false. NMI does not support connect links.
        - 501 `not_implemented`. This deployment can't connect that provider by link, as with `meta`: a Meta pixel connects with `connections_connect_tracking_id`.
      security: [{ api_key: ["connections:write"] }, { session: ["connections:write"] }]
      x-luckylanding-mcp: { tool: connections_create_link, title: Create a link to connect an account, opens: { field: url, message: "Opens Lucky Landing, where you sign in and approve its access to the account you are connecting." } }
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/ConnectLinkParams" } } } }
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/ConnectLink" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/connect_links/{connect_link_id}:
    get:
      operationId: getConnectLink
      x-ogen-operation-group: Connect
      tags: [connections]
      summary: Reads a connect link's status, and the connection it made once the person finished.
      description: |
        Returns the link with `status` `pending`, `completed` or `expired`, and `connection_id` once it is `completed`. Use it after `connections_create_link` to learn whether the person finished; an `expired` link can't be used, so create a new one. While `found` is set, the person has signed in at the provider and has yet to confirm the account in the dashboard. It changes nothing.
        On a pending Google link, `google_streams` appears after discovery and is visible only to its original person and project. An empty array means no accessible web stream was returned. When `google_streams_partial` is true, some resources could not be read.
      security: [{ api_key: ["connections:read"] }, { session: ["connections:read"] }]
      x-luckylanding-mcp: { tool: connections_get_link, title: Connect link status }
      parameters: [{ $ref: "#/components/parameters/ConnectLinkID" }]
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/ConnectLink" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/connect_links/{connect_link_id}/open:
    post:
      operationId: openConnectLink
      x-ogen-operation-group: Connect
      tags: [connections]
      summary: Open a pending connect link in the signed-in person's browser
      description: |
        Returns the URL that takes this browser to the provider's consent, and sets the cookie that lets only this browser follow it. Only a signed-in person can open a link: the person who requested it, the person the requesting agent acts for, or, for a link one of the org's API keys requested, anyone in the org whose role can write connections (CONN-R4, CONN-R10). Opening again returns a URL for the browser that opens it, and the browser that went on last finishes the provider's leg. Following that URL discards what an earlier sign-in found (`found`), and then asks the provider to show its login, so the person can sign in to another account.
        Errors:
        - 403 `person_required`. An agent or API token called; the person opens the link in the dashboard.
        - 403 `connect_link_not_yours`. Another person, or their agent, requested the link.
        - 403 `coming_soon`. The link's provider is still in testing and no longer available to this organization.
        - 409 `connect_link_closed`. The link was already used or has expired.
        - 400 `invalid_field`, `errors[].pointer` `/shop`, `/client_id` or `/client_secret`. A Shopify link needs the store's `*.myshopify.com` domain and the client ID and secret of the app the merchant made for it in Shopify's Dev Dashboard (CONN-R13).
        - 400 `invalid_field`, `errors[].pointer` `/country`. The country differs from the one Lucky Landing has already asked Stripe to open the org's account in, which no link changes; open it with that country, or with none.
      security: [{ session: ["connections:write"] }]
      parameters: [{ $ref: "#/components/parameters/ConnectLinkID" }]
      requestBody: { required: false, content: { application/json: { schema: { $ref: "#/components/schemas/ConnectLinkOpenParams" } } } }
      responses:
        "200":
          headers:
            request-id: { $ref: "#/components/headers/RequestId" }
            Set-Cookie: { required: true, description: "The link's start secret, as a __Host- cookie that only this browser sends on to the provider leg.", schema: { type: string } }
          content: { application/json: { schema: { $ref: "#/components/schemas/ConnectLinkOpening" } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/connect_links/{connect_link_id}/confirm:
    post:
      operationId: confirmConnectLink
      x-ogen-operation-group: Connect
      tags: [connections]
      summary: Connect the account a connect link found, once the person has seen which it is
      description: |
        For a Google link, only the original person in the original project may select a stream. Send its `measurement_id` from `google_streams`; `found` is null. The selected stream receives checkout purchases. Manage its optional Measurement Protocol API secret separately.
        A provider that signs a person in without asking which account leaves the link `pending` with `found` set (CONN-R10). This connects the account in `found` to the org and returns the link `completed` with its `connection_id`. Only a signed-in person can confirm, and only the person who requested the link, the person the requesting agent acts for, or, for a link one of the org's API keys requested, anyone in the org whose role can write connections. Starting the provider's leg again instead, by following the URL openConnectLink returns, discards `found`.
        Errors:
        - 403 `person_required`. An agent or API token called; the person confirms in the dashboard.
        - 403 `connect_link_not_yours`. Another person, or their agent, requested the link.
        - 403 `coming_soon`. The link's provider is still in testing and no longer available to this organization.
        - 409 `connect_link_closed`. The link was already used or has expired.
        - 409 `connect_link_found_nothing`. The link holds no account to confirm: nobody has signed in at the provider yet, or the sign-in found nothing LL can connect (`found.refusal`).
        - 409 `connection_owned_elsewhere`. The account is connected to another org.
        - 503 `unavailable`. The account's earlier connection is still being disconnected, or the link changed meanwhile; get the link and try again.
      security: [{ session: ["connections:write"] }]
      parameters:
        - { $ref: "#/components/parameters/ConnectLinkID" }
        - { $ref: "#/components/parameters/GoogleMeasurementID" }
        - { $ref: "#/components/parameters/GoogleAdsDestination" }
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/ConnectLink" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/connections/shopify_app_setup:
    get:
      operationId: getShopifyAppSetup
      x-ogen-operation-group: Connect
      tags: [connections]
      summary: The values a merchant enters in the Shopify app they make for LL
      description: |
        Setup shows these with a copy button while the merchant makes the app in Shopify's Dev Dashboard, from their store's admin (CONN-R13): the app's one redirect URL, the scopes to paste and the webhooks API version to pick. Once the store is connected, the dashboard offers LL's egress addresses for the app's optional IP allowlist.
      security: [{ api_key: ["connections:read"] }, { session: ["connections:read"] }]
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/ShopifyAppSetup" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/connections/google_places_setup:
    get:
      operationId: getGooglePlacesSetup
      x-ogen-operation-group: Connect
      tags: [connections]
      summary: What a merchant sets up in Google for the checkout's address suggestions, and what Google charges them
      description: |
        Address suggestions are optional: with no Google key, the shopper's browser autofill fills the delivery form. To turn them on, the person makes an API key in their own Google Cloud project, with billing on, at `key_page_url`; enables `api_name` at `api_page_url`; restricts the key to that API and, under Application restrictions, to IP addresses, listing `egress_ips`; and pastes the key in the dashboard's Address suggestions setup step. A tool never takes the key. Then `connections_test_google_key` tests it. `pricing` says what Google bills the merchant for it, and `pricing_url` is Google's price list. It changes nothing.
      security: [{ api_key: ["connections:read"] }, { session: ["connections:read"] }]
      x-luckylanding-mcp: { tool: connections_get_google_key_setup, title: Google key setup }
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/GooglePlacesSetup" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/connections/whop_signup:
    get:
      operationId: getWhopSignup
      x-ogen-operation-group: Connect
      tags: [connections]
      summary: Where a person with no Whop account makes one before connecting Whop
      description: |
        The Connect Whop step offers this link to a person who has no Whop account yet (CONN-R14). It is LL's Whop partner referral link in this environment, so Whop credits the business that signs up through it to LL. It also says whether Whop will ask the person twice when they connect. It changes nothing.
      security: [{ api_key: ["connections:read"] }, { session: ["connections:read"] }]
      parameters:
        - { $ref: "#/components/parameters/ProcessorStoreQuery" }
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/WhopSignup" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/connections:
    get:
      operationId: listConnections
      x-ogen-operation-group: Connect
      tags: [connections]
      summary: Lists the org's connections to providers such as Shopify, Meta and Whop.
      description: Returns a page of connections, each with `provider`, `kind`, `status`, `external_id`, `display_name` and `has_credential`. No response returns a credential. It changes nothing.
      security: [{ api_key: ["connections:read"] }, { session: ["connections:read"] }]
      x-luckylanding-mcp: { tool: connections_list, title: Connections }
      parameters: [{ $ref: "#/components/parameters/Limit" }, { $ref: "#/components/parameters/AfterID" }, { $ref: "#/components/parameters/BeforeID" }]
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/ConnectionList" } } } }
        default: { $ref: "#/components/responses/Error" }
    post:
      operationId: createConnection
      x-ogen-operation-group: Connect
      tags: [connections]
      summary: Connects a Meta or TikTok pixel, a Google Ads conversion or a GA4 stream by its ID; a Google key for address suggestions or a Meta ad account also needs a `credential`, which no tool takes.
      description: |
        Connects a tracking destination to the current project. A person enters credentials in the dashboard. For a Places key, use Address suggestions in setup. `connections_get_google_key_setup` describes the step and `connections_test_google_key` checks the key. A Meta ad account token is entered on Ad Canvas.
        - `meta_events`: the Meta dataset (pixel) ID as `external_id`. The checkout reports each purchase to it from the shopper's browser, and with its Conversions API token as `credential` from Lucky Landing's server too. It is not a Meta ad account, `meta_ads`. An org connects a dataset once: connecting it again keeps its token and makes it `active` again. Other orgs may connect it too. Lucky Landing stores the token as pasted, before the merchant accepts its Meta Service Provider terms, which admission checks, and uses it only to send events.
        - `tiktok_events`: the TikTok pixel code as `external_id`. The checkout reports to it from Lucky Landing's server only, so it gets nothing until the pixel's Events API token is pasted as `credential`.
        - `google_ads_conversions`: the Google Ads tag ID and purchase conversion label as `external_id`, such as `AW-123456789/AbC-D_efG`. `google_analytics_events`: the GA4 web data stream's measurement ID as `external_id`, such as `G-PSW1MY7HB4`. The browser sends Ads conversions and tag-only GA4 purchases. With a Measurement Protocol secret as `credential` and a GA client ID at checkout start, the server sends GA4 checkout steps and purchases even after the page closes. A project connects one of each. Disconnect a stream before moving it to another project.
        - `meta_ads`: a Meta ad account's ID without `act_` as `external_id` and a system-user token as `credential`. It is stored once the organization accepts Meta's terms and Meta reads the active account with the token. A person pastes it on Ad Canvas.
        - `google_places`: a Google Maps Platform API key from the merchant's own Google Cloud project as `credential`, without `external_id`. Lucky Landing tests it with one Places Autocomplete (New) call from its servers and saves it whatever Google answered: `active` when Google took it, else `needs_reauth` with `credential_refused` saying why. While it is `active`, the checkout suggests addresses as shoppers type, on the merchant's Google bill. Each project has one key. Sending a new key replaces it.

        A `credential` is sealed with the org's key, and no response returns it. For a pixel's token or a GA4 stream's secret, sending it replaces it, `null` removes it, and leaving it out keeps it. Disconnecting deletes it; revoke it where it was made too.
        Connect Klaviyo from Checkout → Tracking in the dashboard.
        Errors:
        - 400 `invalid_field`, `errors[].pointer` naming the field. The `external_id` is missing or not in its kind's format, or a `credential` was sent to a kind that takes none or is missing where one is needed.
        - 403 `person_required`. Only a person pastes a `meta_ads` token.
        - 403 `coming_soon`. The tracking destination is still in testing for this organization. The merchant can disconnect a saved destination or remove its saved tracking credential.
        - 409 `connection_owned_elsewhere`. Another org connects the Meta ad account.
        - 409 `google_tag_connected`. The project already connects another Google Ads conversion or GA4 stream; disconnect it first.
        - 409 `meta_terms_not_accepted`. The organization hasn't accepted the terms Meta requires.
        - 422 `meta_ad_account_refused` or `meta_token_refused`. Meta refused the ad account or the token.
        - 429 `rate_limited`. Too many tokens were tried just now.
        - 501 `not_implemented`. Lucky Landing can't reach Meta here, so no `meta_ads` is stored.
        - 503 `unavailable`. This pixel's, tag's or key's earlier connection is still being disconnected, or Google didn't answer, and nothing was saved; retry shortly.
      security: [{ api_key: ["connections:write"] }, { session: ["connections:write"] }]
      x-luckylanding-mcp: { tool: connections_connect_tracking_id, title: Connect a pixel or Google tag by its ID, idempotent: true }
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/PastedConnectionParams" } } } }
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/Connection" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/connections/providers:
    get:
      operationId: getConnectionProviders
      x-ogen-operation-group: Connect
      tags: [connections]
      summary: Lists each provider the org's products need or the org holds, with what each connection there can do and which products use it.
      description: |
        Lists each product’s providers and capabilities in declaration order, then the org’s other connected providers by provider and kind. Whop, Stripe and NMI are checkout payment providers. A capability in testing has `availability: coming_soon`.
        For GA4, Google’s `connects` controls stream discovery. Manual measurement ID entry remains available when it is false.
        Each capability has a status and lists non-revoked connections newest first. An org can have multiple accounts, such as separate Meta pixels. Before disconnecting the last connection, tell the person which products marked `in_use` will stop using it. `start` gives the tool or dashboard URL for connecting. A capability that needs a setup step first lists it in `requires`. Credentials are never returned.
      security: [{ api_key: ["connections:read"] }, { session: ["connections:read"] }]
      x-luckylanding-mcp: { tool: connections_list_providers, title: Providers and what each connection can do }
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/ConnectionProviders" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/connections/{connection_id}:
    get:
      operationId: getConnection
      x-ogen-operation-group: Connect
      tags: [connections]
      summary: Reads one connection by its ID.
      description: |
        Returns the connection's `provider`, `kind`, `status`, `external_id`, `display_name`, `has_credential`, `missing_scopes`, `processor_settings`, `requirements` and `updated_at`. For a processor such as Whop, `processor_settings` says whether the account's tax setting and buyer fee let the checkout take payments; `connections_check_processor_settings` reads them again. For Stripe, it first reads the account's status and `requirements` from Stripe again when `requirements_read_at` is over a minute old, and saves what Stripe answers; a `pending` Stripe connection is finished only by the person, on Stripe, from the connection's Continue on Stripe button in the dashboard. Use it to check one connection, such as the `connection_id` a connect link made, or one you disconnected; `connections_list` returns them all. No response returns a credential.
        Errors:
        - 404 `not_found`. No connection with this ID exists in the org.
      security: [{ api_key: ["connections:read"] }, { session: ["connections:read"] }]
      x-luckylanding-mcp: { tool: connections_get, title: Get a connection, open_world: true }
      parameters: [{ $ref: "#/components/parameters/ConnectionID" }]
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/Connection" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/connections/{connection_id}/disconnect:
    post:
      operationId: disconnectConnection
      x-ogen-operation-group: Connect
      tags: [connections]
      summary: Disconnects an account, deleting the credential Lucky Landing holds for it.
      description: |
        Call it only when the person asks, after telling them what stops: `connections_list_providers` lists the products that use this connection's capability, and each one with `in_use` true stops using the account. Marks the connection `revoking` and returns it. A background job then deletes the stored credential and marks the connection `revoked`. For Shopify, the job first uninstalls from the store the app Lucky Landing connects through. For Whop, Lucky Landing deletes the tokens it holds and stops using the account, but the Lucky Landing app stays installed on the person's Whop business and its App key can still act there until they remove the app in their Whop settings, so tell them that, and the connection stays `revoking` until the checkout hostname's wallet domain for that Whop company is released. For Stripe, the connection stays `revoking` until each checkout hostname's payment method domain on the account is released, and Lucky Landing never closes or deletes the Stripe account, which stays the merchant's; connecting Stripe again reuses it. Calling it again on a `revoking` connection starts the job again if its last run stopped, and a `revoked` connection is returned unchanged. To use the account again, connect it again: a Shopify, Whop or Stripe account with `connections_create_link`, a Meta pixel with `connections_connect_tracking_id`, and a Klaviyo account by signing in to it in the dashboard, in Checkout, under Tracking.
        Errors:
        - 404 `not_found`. No connection with this ID exists in the org.
        - 503 `unavailable`. The disconnect could not start; call it again.
      security: [{ api_key: ["connections:write"] }, { session: ["connections:write"] }]
      x-luckylanding-mcp: { tool: connections_disconnect, title: Disconnect an account, destructive: true, idempotent: true, open_world: true }
      parameters: [{ $ref: "#/components/parameters/ConnectionID" }]
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/Connection" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/connections/{connection_id}/check_processor_settings:
    post:
      operationId: checkProcessorSettings
      x-ogen-operation-group: Connect
      tags: [connections]
      summary: Reads a processor account's tax setting and buyer fee from the processor now, and returns what Lucky Landing found.
      description: |
        The checkout charges the store's total, so it needs the processor account to add no tax of its own and to charge buyers no fee on top: on Whop, "I'll handle tax myself" and no buyer fee. Lucky Landing reads both within minutes of the processor connecting and again each day; call this after the person changes either one at the processor, to read them now. Returns `processor_settings`, which `connections_get` also returns. It reads from the processor and changes nothing there.
        Errors:
        - 404 `not_found`. No connection with this ID exists in the org.
        - 409 `processor_connection_required`. The connection isn't an active processor connection.
        - 429 `rate_limited`. Lucky Landing asked the processor for this connection's settings less than a minute ago; wait the Retry-After interval.
        - 503 `unavailable`. The processor hasn't answered yet. Lucky Landing keeps asking and records the answer on the connection, so get the connection again in a minute.
      security: [{ api_key: ["connections:write"] }, { session: ["connections:write"] }]
      x-luckylanding-txn: true
      x-luckylanding-mcp: { tool: connections_check_processor_settings, title: Check processor settings again, idempotent: true, open_world: true }
      parameters: [{ $ref: "#/components/parameters/ConnectionID" }]
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/ProcessorSettings" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/connections/{connection_id}/test_event:
    post:
      operationId: sendConnectionTestEvent
      x-ogen-operation-group: Tracking
      tags: [connections]
      summary: Sends one test event to a connected Meta pixel, TikTok pixel or GA4 stream, and says what the platform answered.
      description: |
        Proves the org's own connection. Lucky Landing sends one synthetic event from its servers with the saved token or secret, and it carries no person's data: a custom event named `LLConnectionTest` (GA4: `ll_connection_test`), never a conversion, with one random ID. Meta keeps a test event: "Events sent with `test_event_code` are not dropped", so a custom name keeps it out of every purchase count.
        - `meta_events` and `tiktok_events` need `test_event_code`: the code that pixel's Test Events tab shows in Meta's Events Manager or TikTok's. It goes on this one request only and is never saved. The event then shows in that Test Events tab.
        - `google_analytics_events` takes no code. The event goes with `debug_mode`, so it shows in GA4's DebugView. Google gives no answer on the secret, so `unverified` means Google took the request and only DebugView can show it arrived.
        `outcome`: `received` (the platform took it), `token_refused` (the token was refused: paste a new one; the next checkout event marks the connection as it does today), `destination_not_found` (the token can't reach this pixel), `refused` (another refusal, in `vendor_message`) or `unverified` (GA4). GA4 rate limits and server errors return `rate_limited` and `vendor_error` respectively. `title` and `detail` say it in plain words with what to do next.
        Errors:
        - 400 `invalid_field`. `test_event_code` is missing for a Meta or TikTok pixel, sent for a GA4 stream, or not letters and digits.
        - 404 `not_found`. The org has no connection with this ID.
        - 409 `event_destination_required`. The connection needs an active Meta pixel, TikTok pixel or GA4 stream with a saved credential.
        - 429 `rate_limited`. This connection was tested too often; Retry-After says when the oldest counted test leaves the window.
        - 503 `unavailable`. No HTTP reply was available. Check the destination before sending a new test.
      security: [{ api_key: ["connections:write"] }, { session: ["connections:write"] }]
      x-luckylanding-mcp: { tool: connections_send_test_event, title: Send a test event, destructive: true, open_world: true }
      parameters: [{ $ref: "#/components/parameters/ConnectionID" }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/ConnectionTestEventParams" } } } }
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/ConnectionTestEvent" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/connections/{connection_id}/test_key:
    post:
      operationId: testConnectionKey
      x-ogen-operation-group: Connect
      tags: [connections]
      summary: Tests the org's saved Google key for address suggestions now, and turns suggestions on again when Google takes it.
      description: |
        Lucky Landing makes one Places Autocomplete (New) call from its servers with the saved key and a fixed address that is no shopper's, which Google bills the merchant as one Autocomplete request. When Google takes the key, the connection is `active` and the org's checkout suggests addresses again; when it doesn't, it is `needs_reauth`, the checkout suggests none, and `credential_refused` says what Google refused, so the person fixes that in Google and tests again. Google may take a few minutes to apply a change there. Returns the connection.
        Errors:
        - 404 `not_found`. No connection with this ID exists in the org.
        - 409 `google_places_connection_required`. The connection isn't the org's Google key, or it is being disconnected.
        - 429 `rate_limited`. The org tested its key too often; wait the Retry-After interval.
        - 503 `unavailable`. Google didn't answer, and the connection is unchanged; test again shortly.
      security: [{ api_key: ["connections:write"] }, { session: ["connections:write"] }]
      x-luckylanding-mcp: { tool: connections_test_google_key, title: Test the Google key, destructive: true, open_world: true }
      parameters: [{ $ref: "#/components/parameters/ConnectionID" }]
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/Connection" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/design:
    get:
      operationId: getCheckoutDesign
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Reads the checkout design, both the draft being edited and the live one, with the etag a change needs.
      description: |
        Read hosted settings and authored source for the default and published checkout. Compare the returned `project_id` with the merchant’s selected project before editing.
      security: [{ oauth: ["checkout:read"] }, { api_key: [] }, { session: [] }]
      x-luckylanding-mcp: { tool: checkout_get_design, title: Checkout design }
      responses:
        "200": { description: OK, headers: { request-id: { $ref: "#/components/headers/RequestId" }, ETag: { $ref: "#/components/headers/ETag" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutDesignState" } } } }
        default: { $ref: "#/components/responses/Error" }
    post:
      operationId: saveCheckoutDesign
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Replaces the checkout draft with the design you send, leaving the live checkout as it is.
      description: |
        Replace default hosted settings using the ETag from checkout_get_design. To change merchant presentation, patch a named draft’s HTML and CSS files.
      security: [{ oauth: ["checkout:write"] }, { api_key: [] }, { session: [] }]
      x-luckylanding-mcp: { tool: checkout_save_design, title: Save the checkout draft, destructive: true, idempotent: true }
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutDesignSaveParams" } } } }
      parameters: [{ $ref: "#/components/parameters/IfMatch" }]
      responses:
        "200": { description: Saved, headers: { request-id: { $ref: "#/components/headers/RequestId" }, ETag: { $ref: "#/components/headers/ETag" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutDesignState" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/design/drafts:
    get:
      operationId: listCheckoutDesignDrafts
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Lists named checkout designs in the authorized project.
      description: |
        Newest first; IDs are shared with the dashboard.
      security: [{ oauth: ["checkout:read"] }, { api_key: [] }, { session: [] }]
      x-luckylanding-mcp: { tool: checkout_list_design_drafts, title: List checkout drafts }
      parameters: [{ $ref: "#/components/parameters/Limit" }, { $ref: "#/components/parameters/AfterID" }, { $ref: "#/components/parameters/BeforeID" }]
      responses:
        "200": { description: OK, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutDesignDraftList" } } } }
        default: { $ref: "#/components/responses/Error" }
    post:
      operationId: createCheckoutDesignDraft
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Forks a named checkout design for this project.
      description: |
        Fork the current project design or the specified draft revision. Starts at revision 1 with independent undo. Inspect files for editable filenames and exact source.
      security: [{ oauth: ["checkout:write"] }, { api_key: [] }, { session: [] }]
      x-luckylanding-mcp: { tool: checkout_create_design_draft, title: Create a checkout draft }
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutDesignDraftParams" } } } }
      responses:
        "200": { description: OK, headers: { request-id: { $ref: "#/components/headers/RequestId" }, ETag: { $ref: "#/components/headers/ETag" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutDesignDraft" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/design/drafts/find:
    get:
      operationId: findCheckoutDesignDraft
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Find a checkout draft by its exact display name in the current project.
      description: |
        A unique name returns the full draft, including its files, ID and current revision. Multiple matches return choices, newest first; ask which draft the person means before editing. An unknown name returns no matches.
      security: [{ oauth: ["checkout:read"] }, { api_key: [] }, { session: [] }]
      x-luckylanding-mcp: { tool: checkout_get_design_draft_by_name, title: Find a checkout draft by name }
      parameters: [{ $ref: "#/components/parameters/CheckoutDesignDraftName" }]
      responses:
        "200": { description: Draft or matching choices, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutDesignDraftLookup" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/design/drafts/{draft_id}:
    get:
      operationId: getCheckoutDesignDraft
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Reads one named checkout draft and its current revision.
      description: |
        Read files for the editable filenames and exact source. Use revision for edits, undo, preview or publish.
      security: [{ oauth: ["checkout:read"] }, { api_key: [] }, { session: [] }]
      x-luckylanding-mcp: { tool: checkout_get_design_draft, title: Read a checkout draft }
      parameters: [{ $ref: "#/components/parameters/CheckoutDesignDraftID" }]
      responses:
        "200": { description: OK, headers: { request-id: { $ref: "#/components/headers/RequestId" }, ETag: { $ref: "#/components/headers/ETag" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutDesignDraft" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/design/drafts/{draft_id}/edits:
    post:
      operationId: editCheckoutDesignDraft
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Changes the checkout-owned settings of a named draft.
      description: |
        Update hosted checkout settings as one undo step. Use checkout_edit_draft_source for HTML/CSS. Reread on 412.
      security: [{ oauth: ["checkout:write"] }, { api_key: [] }, { session: [] }]
      x-luckylanding-mcp: { tool: checkout_edit_design_draft, title: Edit a checkout draft, destructive: true }
      parameters: [{ $ref: "#/components/parameters/CheckoutDesignDraftID" }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutDesignEditsParams" } } } }
      responses:
        "200": { description: OK, headers: { request-id: { $ref: "#/components/headers/RequestId" }, ETag: { $ref: "#/components/headers/ETag" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutDesignDraft" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/design/drafts/{draft_id}/source/diff:
    post:
      operationId: diffCheckoutDraftSource
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Diff checkout source files.
      description: |
        Diff without saving. checkout_edit_draft_source matching and size limits apply: 16 KiB UTF-8/file, 128 KiB total find+replace, 1 MiB encoded request.
      security: [{ oauth: ["checkout:read"] }, { api_key: [] }, { session: [] }]
      x-luckylanding-mcp: { tool: checkout_dry_run_draft_source, title: Diff checkout source files, read_only: true }
      parameters: [{ $ref: "#/components/parameters/CheckoutDesignDraftID" }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutSourcePatchParams" } } } }
      responses:
        "200": { description: OK, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutSourceDiff" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/design/drafts/{draft_id}/source:
    post:
      operationId: patchCheckoutDraftSource
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Patch checkout source files.
      description: |
        Patch names from the draft’s files in order as one undo. Find matches once; empty find initializes an empty file. Static HTML/CSS, project images. Limits: 16 KiB UTF-8/file, 128 KiB total find+replace, 1 MiB encoded request.
      security: [{ oauth: ["checkout:write"] }, { api_key: [] }, { session: [] }]
      x-luckylanding-mcp: { tool: checkout_edit_draft_source, title: Patch checkout source files, destructive: true }
      parameters: [{ $ref: "#/components/parameters/CheckoutDesignDraftID" }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutSourcePatchParams" } } } }
      responses:
        "200": { description: OK, headers: { request-id: { $ref: "#/components/headers/RequestId" }, ETag: { $ref: "#/components/headers/ETag" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutDesignDraft" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/design/drafts/{draft_id}/undo:
    post:
      operationId: undoCheckoutDesignDraft
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Undoes the latest remaining edit in this draft.
      description: |
        Restores one undo step as a new revision. Reread on 412.
      security: [{ oauth: ["checkout:write"] }, { api_key: [] }, { session: [] }]
      x-luckylanding-mcp: { tool: checkout_undo_design_draft, title: Undo a checkout edit, destructive: true }
      parameters: [{ $ref: "#/components/parameters/CheckoutDesignDraftID" }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutDesignUndoParams" } } } }
      responses:
        "200": { description: OK, headers: { request-id: { $ref: "#/components/headers/RequestId" }, ETag: { $ref: "#/components/headers/ETag" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutDesignDraft" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/design/drafts/{draft_id}/publish:
    post:
      operationId: publishCheckoutDesignDraft
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Audits the named draft and makes that exact revision live.
      description: |
        Publish only on request. Pass the current draft revision and live version ID (null for first publish). Reread on 412. New sessions pin the audited version.
      security: [{ oauth: ["checkout:write"] }, { api_key: [] }, { session: [] }]
      x-luckylanding-mcp: { tool: checkout_publish_design_draft, title: Publish a checkout draft, destructive: true }
      parameters: [{ $ref: "#/components/parameters/CheckoutDesignDraftID" }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutDesignDraftPublishParams" } } } }
      responses:
        "200": { description: OK, headers: { request-id: { $ref: "#/components/headers/RequestId" }, ETag: { $ref: "#/components/headers/ETag" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutDesignDraft" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/design/preview:
    post:
      operationId: previewCheckoutDesign
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Renders a named checkout draft for desktop and phone.
      description: |
        Capture sample checkout at 1440 and 390px with audit findings. A hidden selected block returns the page and selected=false. Reread on 412.
      security: [{ oauth: ["checkout:read"] }, { api_key: [] }, { session: [] }]
      x-luckylanding-mcp: { tool: checkout_preview_design, title: Preview the checkout design, read_only: true, images: { field: captures, data: image, mime_type: image/jpeg } }
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutDesignPreviewParams" } } } }
      responses:
        "200": { description: Preview, headers: { request-id: { $ref: "#/components/headers/RequestId" }, Cache-Control: { description: Prevents caching of draft images and findings., schema: { type: string, const: no-store } } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutDesignPreview" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/design/publish:
    post:
      operationId: publishCheckoutDesign
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Makes the saved checkout draft the live design.
      description: |
        Publish only on request. Send If-Match from checkout_get_design. Both pages are audited on desktop and phone. New sessions pin the version. Reread and confirm on 412; see findings on 422; retry on 503.
      security: [{ oauth: ["checkout:write"] }, { api_key: [] }, { session: [] }]
      x-luckylanding-mcp: { tool: checkout_publish_design, title: Publish the checkout design, destructive: true, idempotent: true }
      parameters: [{ $ref: "#/components/parameters/IfMatch" }]
      responses:
        "200": { description: Published, headers: { request-id: { $ref: "#/components/headers/RequestId" }, ETag: { $ref: "#/components/headers/ETag" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutDesignState" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/design/versions:
    get:
      operationId: listCheckoutDesignVersions
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Lists the checkout design's published versions, newest first.
      description: |
        Newest first. Set state to live to read the currently published version and its source draft’s current name and revision.
      security: [{ oauth: ["checkout:read"] }, { api_key: [] }, { session: [] }]
      x-luckylanding-mcp: { tool: checkout_list_design_versions, title: Checkout design versions }
      parameters:
        - { $ref: "#/components/parameters/Limit" }
        - { $ref: "#/components/parameters/AfterID" }
        - { $ref: "#/components/parameters/BeforeID" }
        - { $ref: "#/components/parameters/CheckoutVersionState" }
      responses:
        "200": { description: OK, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutDesignVersionList" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/design/rollback:
    post:
      operationId: rollbackCheckoutDesign
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Makes an earlier published version of the checkout design live again, leaving the draft as it is.
      description: |
        Only on request. Send the audited version ID and current If-Match. Existing sessions keep their version. Reread and confirm on 412.
      security: [{ oauth: ["checkout:write"] }, { api_key: [] }, { session: [] }]
      x-luckylanding-mcp: { tool: checkout_rollback_design, title: Roll the checkout design back, destructive: true, idempotent: true }
      parameters: [{ $ref: "#/components/parameters/IfMatch" }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutDesignRollbackParams" } } } }
      responses:
        "200": { description: Rolled back, headers: { request-id: { $ref: "#/components/headers/RequestId" }, ETag: { $ref: "#/components/headers/ETag" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutDesignState" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/logos:
    post:
      operationId: createCheckoutLogo
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Stores an image for the checkout's logo or an offer's logo, and returns its link, which a design or offer draft takes as `logo_url`.
      description: |
        Send base64 PNG, JPEG, WebP or HEIC bytes in image (1 MiB request limit). Use the stable url in checkout logo_url, authored img src or offer content.logo_url. The same bytes return the same URL. Publish the design or offer to show it. Shoppers receive a resized image with metadata removed. Unsupported images return 400 checkout_logo_unreadable; oversized requests return 413.
      security: [{ oauth: ["checkout:write"] }, { api_key: [] }, { session: [] }]
      x-luckylanding-mcp: { tool: checkout_upload_logo, title: Upload a checkout or offer logo, idempotent: true }
      requestBody:
        required: true
        content:
          application/json: { schema: { $ref: "#/components/schemas/CheckoutLogoParams" } }
      responses:
        "200": { description: Stored, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutLogo" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/hero_images:
    post:
      operationId: createCheckoutHeroImage
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Stores a photo for an offer's hero image as it was taken, and returns its link, which an offer draft takes as `hero_image_url`.
      description: |
        Send base64 PNG, JPEG, WebP or HEIC bytes in image (12 MiB request limit). The stable url is accepted as content.hero_image_url. The same bytes return the same URL. Publish the offer to show it. Shoppers receive a resized image with metadata removed. Unsupported images return 400 checkout_hero_image_unreadable; oversized requests return 413.
      security: [{ oauth: ["checkout:write"] }, { api_key: [] }, { session: [] }]
      x-luckylanding-mcp: { tool: checkout_upload_hero_image, title: Upload an offer's hero image, idempotent: true }
      requestBody:
        required: true
        content:
          application/json: { schema: { $ref: "#/components/schemas/CheckoutHeroImageParams" } }
      responses:
        "200": { description: Stored, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutHeroImage" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/domain:
    get:
      operationId: getCheckoutDomain
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Reads the project's checkout hostname, the DNS records the person must add for it, and whether checkout serves on it yet.
      description: |
        Returns `hostname`, or null while the org has none; `records`, the DNS records the hostname needs; `state`; and `checked_at`, the time of the latest check. Give the person each record as it is: `type`, `name` as the record's host, and `value` as its target or content. The `CNAME` record points the hostname at Lucky Landing and must be DNS-only, not proxied. The `TXT` record at `_ll-verify.<hostname>` holds a token issued to this org, which proves it controls the domain. The certificate needs no record of its own.
        `state` is `pending` until both records check out and the hostname's certificate is live; then it is `verified`, and checkout serves on the hostname. It is `failed` with `reason` `zone_on_cloudflare` when the merchant's own Cloudflare proxies the hostname, so the person must set that record to DNS only, and with `reason` `caa_blocks` when the domain's CAA records let no certificate authority Cloudflare uses issue the certificate. It is `failed` with `reason` `not_available`, and no records, when Lucky Landing has not turned checkout hostnames on in this environment: the person has nothing to add yet, and Lucky Landing starts checking the hostname on its own once it turns them on. A record's `state` is `verified` when the latest check found it; `failed` when it found something else, with `reason` `record_wrong` for a TXT record with another value, `record_elsewhere` for another record at the hostname, such as an A record or a CNAME to another target, or `record_proxied`; and `pending` until a check finds it, with `reason` `record_missing` once a check has looked.
        After a claim, Lucky Landing checks every minute for a day and every 15 minutes after that; once the person says they added the records, call `checkout_check_domain` to check them at once. It checks a verified hostname daily, and moves one whose CNAME or certificate stops checking out back to `pending` or `failed` and emails the org's owners. It changes nothing.
      security: [{ oauth: ["checkout:read"] }, { api_key: [] }, { session: [] }]
      x-luckylanding-mcp: { tool: checkout_get_domain, title: Checkout domain }
      responses:
        "200": { description: OK, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutDomain" } } } }
        default: { $ref: "#/components/responses/Error" }
    post:
      operationId: claimCheckoutDomain
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Claims a hostname such as checkout.shop.example for the org's checkout, and returns the DNS records it needs.
      description: |
        Use it when the person wants the checkout on their own subdomain. Send `hostname`, a label in front of a domain the person controls. Returns the domain as `checkout_get_domain` does, with `state` `pending` and the records to add; tell the person to add each one at their DNS provider, then call `checkout_check_domain` once they have, and read `checkout_get_domain` until `state` is `verified`. Checkout does not serve on the hostname before then. The `TXT` value is a token Lucky Landing issues to this org for this hostname, and Lucky Landing checks it before it asks Cloudflare for the hostname and its certificate. Claiming the org's current hostname again returns it unchanged. Claiming a hostname the org released before issues a new token, so the person must change the `TXT` record's value.
        Errors:
        - 400 `checkout_domain_invalid`, `errors[].pointer` `#/hostname`. The hostname is a bare domain, a label in front of a public suffix such as `checkout.co.uk`, a wildcard or another label that is not a valid DNS label, has letters outside ASCII (send its `xn--` form), is an IP address, or is under Lucky Landing's own checkout domain.
        - 409 `checkout_domain_exists`. The project already has another checkout hostname. Moving the checkout means releasing that one with `checkout_release_domain`, which stops checkout serving on it at once, so ask the person first.
        - 409 `checkout_domain_taken`. Another project holds this hostname. The person must ask its owner to release it, or choose another hostname.
        - 501 `not_implemented`. Lucky Landing has not turned checkout hostnames on in this environment, so nothing was claimed. Tell the person; calling again changes nothing until Lucky Landing turns them on.
        - 503 `outcome_unknown`. Lucky Landing did not answer; read `checkout_get_domain` before you call again.
      security: [{ oauth: ["checkout:write"] }, { api_key: [] }, { session: [] }]
      x-luckylanding-mcp: { tool: checkout_claim_domain, title: Claim a checkout hostname, idempotent: true, open_world: true }
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutDomainParams" } } } }
      responses:
        "200": { description: Claimed, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutDomain" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/domain/release:
    post:
      operationId: releaseCheckoutDomain
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Releases the project's checkout hostname, so checkout stops serving on it at once.
      description: |
        Call it only when the person asks to stop using this hostname, or to move the checkout to another one. Send the current `hostname` from `checkout_get_domain`. Returns the domain with `hostname` null and no records.
        Checkout stops serving on the hostname at once: a shopper who opens a checkout or offer link on it, or is partway through a checkout there, is turned away. Lucky Landing then deletes the hostname and its certificate from Cloudflare, and within the hour withdraws the hostname from Apple Pay and Google Pay at the payment processor. It deletes no offer, design or tracking setting, and changes none of the person's DNS records.
        To serve on the hostname again, claim it with `checkout_claim_domain`. The claim issues a new token, because a released token is never accepted again, so the person replaces the value of the `TXT` record at `_ll-verify.<hostname>`; the `CNAME` record stays as it is. Checks start over as after a first claim. Once the hostname is `verified`, checkout serves on it again, offers published to it that have not expired come back, and Apple Pay and Google Pay return once the payment processor verifies the hostname.
        Errors:
        - 404 `not_found`. `hostname` is not the org's current checkout hostname.
        - 503 `outcome_unknown`. Lucky Landing did not answer; read `checkout_get_domain` before you call again.
      security: [{ oauth: ["checkout:write"] }, { api_key: [] }, { session: [] }]
      x-luckylanding-mcp: { tool: checkout_release_domain, title: Release the checkout hostname, destructive: true, idempotent: true, open_world: true }
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutDomainParams" } } } }
      responses:
        "200": { description: Released, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutDomain" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/domain/check:
    post:
      operationId: checkCheckoutDomain
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Checks the project's checkout hostname's DNS records and certificate now, and returns what the check found.
      description: |
        Call it after the person adds or fixes the DNS records for the project's checkout hostname, rather than waiting for Lucky Landing's next check. It reads the `CNAME` and `TXT` records now and, once the `TXT` record verifies, asks Cloudflare for the hostname and its certificate, then returns the domain as `checkout_get_domain` does, with `checked_at` the time of this check. A certificate takes Cloudflare a few minutes to issue after the records verify, so `state` can stay `pending` until a later check. A call within 10 seconds of the latest check returns that check without checking again. When Lucky Landing has not turned checkout hostnames on in this environment, it returns the domain unchanged, with `reason` `not_available`.
        Errors:
        - 404 `not_found`. The project has no checkout hostname; claim one with `checkout_claim_domain`.
        - 503 `unavailable`. The check didn't finish in time. Lucky Landing finishes it on its own, so read `checkout_get_domain` again in a minute.
      security: [{ oauth: ["checkout:write"] }, { api_key: [] }, { session: [] }]
      x-luckylanding-mcp: { tool: checkout_check_domain, title: Check the checkout hostname now, idempotent: true, open_world: true }
      responses:
        "200": { description: Checked, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutDomain" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/tracking/evidence:
    get:
      operationId: getTrackingEvidence
      x-ogen-operation-group: Tracking
      tags: [checkout]
      summary: Read the latest native test and successful server send for each checkout tracking connection in the selected project
      description: |
        Returns only recorded observations for the selected project. A browser tag supplies no delivery receipt. A GA4 server send records the HTTP acknowledgement, which does not confirm processing.
      security: [{ api_key: ["connections:read"] }, { session: ["connections:read"] }]
      responses:
        "200": { description: OK, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/TrackingEvidence" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/tracking/meta_refusals:
    get:
      operationId: getMetaRefusals
      x-ogen-operation-group: Tracking
      tags: [checkout]
      summary: Which connected Meta and TikTok pixels their platform refused checkout events for in the last 7 days, and why
      description: |
        One entry per active Meta or TikTok pixel connection whose platform refused at least one server event in the last 7 days; a pixel with no refusal is absent. `reason` reads the platform's error code on the most recent refusal. For Meta: `permission` when the token may not send to the pixel (codes 10 and 200 to 299, and code 100 with subcode 33, an object that doesn't exist or the token can't reach), `invalid_event` when Meta refused the event itself (any other code 100), `other` for any other code. For TikTok: `invalid_event` for code 40002, TikTok's refusal of the event's data, and `other` for any other code. A rejected token is not a refusal here: the connection's status shows it as `needs_reauth`.
      security: [{ api_key: ["checkout:read"] }, { session: ["checkout:read"] }]
      responses:
        "200": { description: OK, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/MetaRefusals" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/wallets:
    get:
      operationId: listCheckoutWallets
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: List wallet status
      description: |
        Lists each express wallet's state on the checkout domain: `active` once the payment processor has verified the domain for Apple Pay, which Google Pay needs too; `pending` while it verifies it; `degraded` when the verification failed, with a fix hint in `message`; `unavailable` otherwise. It never returns certificates, domain-association files or credentials.
      security: [{ api_key: ["checkout:read"] }, { session: ["checkout:read"] }]
      parameters: [{ $ref: "#/components/parameters/Limit" }, { $ref: "#/components/parameters/AfterID" }, { $ref: "#/components/parameters/BeforeID" }]
      responses:
        "200": { description: OK, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutWalletList" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/stores:
    get:
      operationId: listCheckoutStores
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Lists the stores the checkout sells for that this credential may use.
      description: Returns a page of stores, each with `id`, `domain`, `currency` and `platform`. Every offer draft tool needs one of these `id`s as `store_id`. A credential lists the stores it can use in its project. It reads what Lucky Landing holds and asks no store platform. It changes nothing.
      security: [{ oauth: ["checkout:read"] }, { api_key: [] }, { session: [] }]
      x-luckylanding-txn: true
      x-luckylanding-mcp: { tool: checkout_list_stores, title: Checkout stores }
      parameters: [{ $ref: "#/components/parameters/Limit" }, { $ref: "#/components/parameters/AfterID" }, { $ref: "#/components/parameters/BeforeID" }]
      responses:
        "200": { description: Configured data, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutMerchantStoreList" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/catalog:
    get:
      operationId: listCheckoutCatalog
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: List a store’s checkout variants
      description: Returns a page of active catalogue variants and their prices in the selected store’s currency. Use the store ID from checkout_list_stores. To configure Order protection, choose a positively priced variant that does not require shipping and pass its ID to checkout_edit_design_draft.
      security: [{ oauth: ["checkout:read"] }, { api_key: [] }, { session: [] }]
      x-luckylanding-mcp: { tool: checkout_list_catalog, title: Checkout catalogue variants }
      x-luckylanding-txn: true
      x-luckylanding-store-resource: query
      parameters: [{ $ref: "#/components/parameters/Limit" }, { $ref: "#/components/parameters/AfterID" }, { $ref: "#/components/parameters/BeforeID" }, { $ref: "#/components/parameters/CheckoutStoreQuery" }]
      responses:
        "200": { description: Configured data, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutMerchantCatalogList" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/design/protection_preview:
    post:
      operationId: previewCheckoutProtection
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Resolve the live Order protection terms for a checkout design preview
      description: Returns the first eligible variant by store ID. Each store must be readable by the caller. Returns 404 when no readable store offers the variant.
      security: [{ api_key: ["checkout:read"] }, { session: ["checkout:read"] }]
      x-luckylanding-txn: true
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutProtectionPreviewParams" } } } }
      responses:
        "200": { description: The preview store and its live protection price, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutProtectionPreview" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/offer_drafts:
    get:
      operationId: listCheckoutOfferDrafts
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Lists a store's offer drafts, newest first.
      description: |
        Returns a page of the store's drafts, each as `checkout_get_offer_draft` returns it. Use it to find the draft the person means before you create another. It changes nothing.
        Errors:
        - 400 `invalid_store`. `store_id` is missing or is not a store ID.
        - 403 `store_access_denied`. The store is not one this credential may use; list them with `checkout_list_stores`.
      security: [{ oauth: ["checkout:read"] }, { api_key: [] }, { session: [] }]
      x-luckylanding-mcp: { tool: checkout_list_offer_drafts, title: Offer drafts }
      x-luckylanding-txn: true
      x-luckylanding-store-resource: query
      parameters: [{ $ref: "#/components/parameters/CheckoutStoreQuery" }, { $ref: "#/components/parameters/Limit" }, { $ref: "#/components/parameters/AfterID" }, { $ref: "#/components/parameters/BeforeID" }]
      responses:
        "200": { description: Offer workspace, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutOfferDraftList" } } } }
        default: { $ref: "#/components/responses/Error" }
    post:
      operationId: createCheckoutOfferDraft
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Creates an offer draft for one store, which shoppers do not see.
      description: |
        Send the store_id from checkout_list_stores and a complete draft. Use the hostname from checkout_get_domain, catalog variant IDs, and logo or hero URLs from the corresponding checkout upload tools. Empty lines are allowed. Only landing offers can show the expires_at countdown. The returned revision 1 is paused and unpublished. Publish by REST. Each successful call creates a draft; list drafts before retrying an uncertain result. A 400 names invalid data, and 403 means this credential cannot use the store.
      security: [{ oauth: ["checkout:write"] }, { api_key: [] }, { session: [] }]
      x-luckylanding-mcp: { tool: checkout_create_offer_draft, title: Create an offer draft }
      x-luckylanding-txn: true
      x-luckylanding-store-resource: body
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutOfferDraftCreateParams" } } } }
      responses:
        "200": { description: Offer workspace, headers: { request-id: { $ref: "#/components/headers/RequestId" }, ETag: { $ref: "#/components/headers/ETag" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutOfferDraft" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/offer_drafts/{draft_id}:
    get:
      operationId: getCheckoutOfferDraft
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Reads one offer draft with the etag a save needs.
      description: |
        Send the draft's `draft_id` and its `store_id`. Returns `draft`, the content being edited; `revision` and `etag`, which `checkout_save_offer_draft` needs as If-Match; `paused`; `active_publication_id`, the version shoppers see, empty while none is live; `live_is_draft`, whether that version is exactly the draft; and `republish_currency`, set when the live version charges in a currency the store no longer uses, so checkout refuses it until it is published again. Read it right before a save. It changes nothing.
        Errors:
        - 404 `not_found`. No draft with this ID exists in that store.
        - 400 `invalid_store`. `store_id` is missing or is not a store ID.
        - 403 `store_access_denied`. The store is not one this credential may use.
      security: [{ oauth: ["checkout:read"] }, { api_key: [] }, { session: [] }]
      x-luckylanding-mcp: { tool: checkout_get_offer_draft, title: Offer draft }
      x-luckylanding-txn: true
      x-luckylanding-store-resource: query
      parameters: [{ $ref: "#/components/parameters/CheckoutDraftID" }, { $ref: "#/components/parameters/CheckoutStoreQuery" }]
      responses:
        "200": { description: Offer workspace, headers: { request-id: { $ref: "#/components/headers/RequestId" }, ETag: { $ref: "#/components/headers/ETag" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutOfferDraft" } } } }
        default: { $ref: "#/components/responses/Error" }
    post:
      operationId: saveCheckoutOfferDraft
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Replaces an offer draft's content, leaving any live version as it is.
      description: |
        Send store_id, draft_id, current If-Match etag and the complete draft; omitted fields are removed. The create rules apply. The result contains the new revision and etag; shoppers see changes on publish. Repeating the same save and etag returns its result. A missing etag returns 428, a conflicting edit returns 412. Read the current draft before retrying. Unknown drafts return 404, invalid fields 400, and inaccessible stores 403.
      security: [{ oauth: ["checkout:write"] }, { api_key: [] }, { session: [] }]
      x-luckylanding-mcp: { tool: checkout_save_offer_draft, title: Save an offer draft, destructive: true, idempotent: true }
      x-luckylanding-txn: true
      x-luckylanding-store-resource: body
      parameters: [{ $ref: "#/components/parameters/CheckoutDraftID" }, { $ref: "#/components/parameters/IfMatch" }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutOfferDraftSaveParams" } } } }
      responses:
        "200": { description: Offer workspace, headers: { request-id: { $ref: "#/components/headers/RequestId" }, ETag: { $ref: "#/components/headers/ETag" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutOfferDraft" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/offer_drafts/{draft_id}/preview:
    get:
      operationId: previewCheckoutOfferDraft
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Preview a draft without creating a shopper session
      security: [{ oauth: ["checkout:read"] }, { api_key: [] }, { session: [] }]
      x-luckylanding-txn: true
      x-luckylanding-store-resource: query
      parameters: [{ $ref: "#/components/parameters/CheckoutDraftID" }, { $ref: "#/components/parameters/CheckoutStoreQuery" }]
      responses:
        "200": { description: Offer workspace, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutOfferPreview" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/offer_drafts/{draft_id}/versions:
    get:
      operationId: listCheckoutOfferVersions
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: List immutable published versions
      security: [{ oauth: ["checkout:read"] }, { api_key: [] }, { session: [] }]
      x-luckylanding-txn: true
      x-luckylanding-store-resource: query
      parameters: [{ $ref: "#/components/parameters/CheckoutDraftID" }, { $ref: "#/components/parameters/CheckoutStoreQuery" }, { $ref: "#/components/parameters/Limit" }, { $ref: "#/components/parameters/AfterID" }, { $ref: "#/components/parameters/BeforeID" }]
      responses:
        "200": { description: Offer workspace, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutOfferVersionList" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/offer_drafts/{draft_id}/choices:
    get:
      operationId: listCheckoutOfferChoices
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: List available next offers for the saved draft's store and hostname
      description: Returns compatible, unexpired published post-purchase offers from configured data. Save hostname changes before selecting a next offer. Publishing revalidates the selected immutable version.
      security: [{ oauth: ["checkout:read"] }, { api_key: [] }, { session: [] }]
      x-luckylanding-txn: true
      x-luckylanding-store-resource: query
      parameters: [{ $ref: "#/components/parameters/CheckoutDraftID" }, { $ref: "#/components/parameters/CheckoutStoreQuery" }, { $ref: "#/components/parameters/Limit" }, { $ref: "#/components/parameters/AfterID" }, { $ref: "#/components/parameters/BeforeID" }]
      responses:
        "200": { description: Available next offers, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutOfferChoiceList" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/offer_drafts/{draft_id}/publish:
    post:
      operationId: publishCheckoutOfferDraft
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Publish a saved draft as an immutable version
      security: [{ api_key: ["checkout:write"] }, { session: ["checkout:write"] }]
      x-luckylanding-txn: true
      x-luckylanding-store-resource: body
      parameters: [{ $ref: "#/components/parameters/CheckoutDraftID" }, { $ref: "#/components/parameters/IfMatch" }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutOfferStoreParams" } } } }
      responses:
        "200": { description: Offer workspace, headers: { request-id: { $ref: "#/components/headers/RequestId" }, ETag: { $ref: "#/components/headers/ETag" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutOfferDraft" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/offer_drafts/{draft_id}/pause:
    post:
      operationId: pauseCheckoutOfferDraft
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Pause new admissions to this offer
      security: [{ api_key: ["checkout:write"] }, { session: ["checkout:write"] }]
      x-luckylanding-txn: true
      x-luckylanding-store-resource: body
      parameters: [{ $ref: "#/components/parameters/CheckoutDraftID" }, { $ref: "#/components/parameters/IfMatch" }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutOfferStoreParams" } } } }
      responses:
        "200": { description: Offer workspace, headers: { request-id: { $ref: "#/components/headers/RequestId" }, ETag: { $ref: "#/components/headers/ETag" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutOfferDraft" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/offer_drafts/{draft_id}/republish:
    post:
      operationId: republishCheckoutOfferDraft
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Republish a live offer in the store's current currency
      description: "For an offer whose republish_currency is set: publishes its live version again at the prices of the store's catalog in that currency, pointing its next offers at their own offers' live versions, so a store that changed currency (CHK-R22) gets its offers back without retyping them. Refused with 409 offer_not_republishable when the draft has edits that aren't live, or when republish_currency is empty, and with 400 invalid_field when its logo_url or hero_image_url links outside this org's uploads."
      security: [{ api_key: ["checkout:write"] }, { session: ["checkout:write"] }]
      x-luckylanding-txn: true
      x-luckylanding-store-resource: body
      parameters: [{ $ref: "#/components/parameters/CheckoutDraftID" }, { $ref: "#/components/parameters/IfMatch" }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutOfferStoreParams" } } } }
      responses:
        "200": { description: Offer workspace, headers: { request-id: { $ref: "#/components/headers/RequestId" }, ETag: { $ref: "#/components/headers/ETag" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutOfferDraft" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/offer_drafts/{draft_id}/rollback:
    post:
      operationId: rollbackCheckoutOfferDraft
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Activate an unexpired immutable version
      description: "Makes an unexpired earlier version of the offer the live one again. Refused with 400 invalid_field when that version's logo_url or hero_image_url links outside this org's uploads, as a publish is."
      security: [{ api_key: ["checkout:write"] }, { session: ["checkout:write"] }]
      x-luckylanding-txn: true
      x-luckylanding-store-resource: body
      parameters: [{ $ref: "#/components/parameters/CheckoutDraftID" }, { $ref: "#/components/parameters/IfMatch" }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutOfferRollbackParams" } } } }
      responses:
        "200": { description: Offer workspace, headers: { request-id: { $ref: "#/components/headers/RequestId" }, ETag: { $ref: "#/components/headers/ETag" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutOfferDraft" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/cart_evidence:
    get:
      operationId: getCheckoutCartEvidence
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Read the selected store’s latest quoted cart and its payment and order progress
      security: [{ api_key: ["checkout:read"] }, { session: ["checkout:read"] }]
      x-luckylanding-txn: true
      x-luckylanding-store-resource: query
      parameters: [{ $ref: "#/components/parameters/CheckoutStoreQuery" }]
      responses:
        "200": { description: Store checkout evidence, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutCartEvidence" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/catalog/readiness:
    get:
      operationId: getCheckoutCatalogReadiness
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Read catalog connection and import readiness
      security: [{ api_key: ["checkout:read"] }, { session: ["checkout:read"] }]
      x-luckylanding-txn: true
      x-luckylanding-store-resource: query
      parameters: [{ $ref: "#/components/parameters/CheckoutStoreQuery" }]
      responses:
        "200": { description: Catalog data, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutCatalogReadiness" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/catalog/sources:
    get:
      operationId: listCheckoutCatalogSources
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: List imported source snapshots, with why any variant is not offerable
      security: [{ api_key: ["checkout:read"] }, { session: ["checkout:read"] }]
      x-luckylanding-txn: true
      x-luckylanding-store-resource: query
      parameters: [{ $ref: "#/components/parameters/CheckoutStoreQuery" }, { $ref: "#/components/parameters/Limit" }, { $ref: "#/components/parameters/AfterID" }, { $ref: "#/components/parameters/BeforeID" }]
      responses:
        "200": { description: Catalog data, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutCatalogSourceList" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/catalog/imports:
    post:
      operationId: createCheckoutCatalogImport
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Create an empty server-owned catalog import for an explicit refresh
      security: [{ api_key: ["checkout:write"] }, { session: ["checkout:write"] }]
      x-luckylanding-txn: true
      x-luckylanding-store-resource: body
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutCatalogImportCreateParams" } } } }
      responses:
        "200": { description: Empty catalog import, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutCatalogImportRun" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/catalog/imports/{import_id}/pages:
    post:
      operationId: importCheckoutCatalog
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Import or replay a page within a server-owned catalog import
      security: [{ api_key: ["checkout:write"] }, { session: ["checkout:write"] }]
      x-luckylanding-txn: true
      x-luckylanding-store-resource: body
      parameters: [{ $ref: "#/components/parameters/CheckoutCatalogImportID" }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutCatalogImportParams" } } } }
      responses:
        "200": { description: Immutable imported catalog page, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutCatalogImport" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/offers:
    post:
      operationId: publishCheckoutOffer
      x-ogen-operation-group: Checkout
      x-luckylanding-store-resource: body
      tags: [checkout]
      summary: Publish an immutable offer from the store's trusted catalog
      security: [{ oauth: ["checkout:write"] }, { api_key: [] }, { session: [] }]
      x-luckylanding-txn: true
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutOfferPublishParams" } } } }
      responses:
        "200": { description: Published offer, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutPublishedOffer" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/offers/{offer_id}:
    get:
      operationId: getCheckoutOffer
      x-ogen-operation-group: Shopper
      tags: [checkout]
      summary: Read an available published landing offer on its verified hostname
      security: []
      x-luckylanding-org: public
      parameters: [{ $ref: "#/components/parameters/CheckoutOfferID" }]
      responses:
        "200": { description: Offer, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutPublishedOffer" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/offers/{offer_id}/start:
    post:
      operationId: startCheckoutOffer
      x-ogen-operation-group: Shopper
      tags: [checkout]
      summary: Start a new anonymous checkout from a public offer without charging
      description: |
        Errors:
        - 409 `store_unavailable`. No active connection of the store and its payment processor matches the offer's store, merchant account and currency, none of the processor connections the store routes to can take a card, or the org's checkout isn't live, so no checkout starts and nothing is stored.
      security: []
      x-luckylanding-org: public
      x-luckylanding-txn: true
      x-luckylanding-live: checkout
      parameters: [{ $ref: "#/components/parameters/CheckoutOfferID" }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutStartParams" } } } }
      responses:
        "200": { description: New shopper session and HttpOnly access cookie, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutStarted" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/cart/start:
    post:
      operationId: startCheckoutCart
      x-ogen-operation-group: Shopper
      tags: [checkout]
      summary: Start a new anonymous checkout from the store cart a theme script handed over, without charging
      description: |
        The checkout's cart page posts the cart the store's theme script handed over (CHK-R2). The hostname names the org, which must have exactly one active store. Nothing in the request is trusted: the store reads each variant and its stock as the session starts, and prices the cart at its own prices again when the shopper prepares the payment. An ad cookie the checkout sees on this request wins over a carried one, and the only consent a cart carries is a denial.
        The cart page sends the shopper to the store's own checkout, where the cart is intact, on any answer but 200: a refused credential exchange, a hostname that doesn't serve checkout yet, a throttled or unavailable store, or a cart refusal.
        Errors:
        - 409 `store_unavailable`. The org's checkout isn't live, or none of the processor connections the store routes to can take a card, so no checkout starts and nothing is stored.
        - 422 `cart_refused`. The cart start won't take this cart and stored nothing; the detail is a short reason code for logs.
      security: []
      x-luckylanding-org: public
      x-luckylanding-txn: true
      x-luckylanding-live: checkout
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutCartStartParams" } } } }
      responses:
        "200": { description: New shopper session and HttpOnly access cookie, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutStarted" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/sessions/{session_id}/contact:
    post:
      operationId: saveCheckoutContact
      x-ogen-operation-group: Shopper
      tags: [checkout]
      summary: Save the shopper's email, from the checkout form's first field or from a wallet at authorization (CHK-R7)
      description: |
        Authenticated by the shopper cookie and answered no-store. The email is sealed with the org's key, and saving it again replaces it. The payment step offers it to the processor, and an org that connected Klaviyo may receive it for an abandoned checkout, as TRK-R4 sets out. The email is saved only when the shopper sends this step, never as they type.
        Errors:
        - 409 `store_unavailable`. The store has no active binding in the session's currency, or the processor connection the session was routed to is no longer an active connection of the org, or its settings check found that it adds tax or a buyer fee, so nothing changes.
        - 400 `invalid_checkout_request`. The email is not one address.
      security: []
      x-luckylanding-org: public
      x-luckylanding-txn: true
      parameters: [{ $ref: "#/components/parameters/CheckoutSessionID" }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutContactParams" } } } }
      responses:
        "200": { description: Saved contact, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutContact" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/sessions/{session_id}/address_suggestions:
    post:
      operationId: suggestCheckoutAddresses
      x-ogen-operation-group: Shopper
      tags: [checkout]
      summary: Suggest street addresses for what the shopper has typed in the delivery form, from Google Places on the merchant's own key (CHK-R11)
      description: |
        Authenticated by the shopper cookie and answered no-store. `luckylanding` asks Google Places Autocomplete (New) for street addresses in `country` only, with the Google key the org pasted, and stores and caches nothing. Calls with the same `session_token` up to the pick are one Places session; the checkout starts a new token after each pick. The checkout shows "Google Maps" beside the suggestions.
        Errors:
        - 400 `invalid_checkout_request`. The body isn't valid: under three characters typed, a country that isn't a code, or a session token that isn't a UUID.
        - 404 `not_found`. Address suggestions are off: the org has no Google key that Google takes, so the shopper's browser autofill fills the form. Answered before the token exchange, or after it when Google refuses the key at this call; the checkout stops asking.
        - 429 `rate_limited`. This session or this client asked for too many suggestions; the shopper types the address.
        - 503 `unavailable`. Google didn't answer; the shopper types the address.
      security: []
      x-luckylanding-org: public
      x-luckylanding-txn: true
      parameters: [{ $ref: "#/components/parameters/CheckoutSessionID" }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutAddressSuggestParams" } } } }
      responses:
        "200": { description: Suggested addresses, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutAddressSuggestions" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/sessions/{session_id}/address_details:
    post:
      operationId: getCheckoutAddressDetails
      x-ogen-operation-group: Shopper
      tags: [checkout]
      summary: Read the address of the suggestion the shopper picked, to fill the delivery form (CHK-R11)
      description: |
        Authenticated by the shopper cookie and answered no-store. `luckylanding` asks Google Places Details (New) for the address fields only, with the org's Google key, which ends the Places session `session_token` started. The address only fills the form: LL stores the delivery address when the shopper sends the delivery step, as typed or edited there.
        Errors:
        - 400 `invalid_checkout_request`. The body isn't valid: a place ID that isn't one, or a session token that isn't a UUID.
        - 404 `not_found`. Address suggestions are off: the org has no Google key that Google takes. Answered before the token exchange, or after it when Google refuses the key at this call.
        - 429 `rate_limited`. This session or this client read too many addresses; the shopper types the address.
        - 503 `unavailable`. Google didn't answer; the shopper types the address.
      security: []
      x-luckylanding-org: public
      x-luckylanding-txn: true
      parameters: [{ $ref: "#/components/parameters/CheckoutSessionID" }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutAddressDetailsParams" } } } }
      responses:
        "200": { description: The picked address, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutAddressDetails" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/sessions/{session_id}/prepare:
    post:
      operationId: prepareCheckoutPayment
      x-ogen-operation-group: Shopper
      tags: [checkout]
      summary: Prepare authoritative payment terms for this capability-authenticated shopper
      description: |
        Errors:
        - 409 `store_unavailable`. The store has no active binding in the session's currency, the processor connection the session was routed to is no longer an active connection of the org, or its settings check found that it adds tax or a buyer fee, or the org's checkout isn't live, so nothing changes and nothing is charged.
        - 409 `below_minimum_charge`. The store's total is under the smallest amount the payment processor charges; `detail` names it, and nothing was asked of the processor.
        - 409 `email_required`. The checkout has no saved email for this shopper, and every order is priced and placed with it, so nothing was priced; the shopper saves it in the contact step.
        - 400 `email_refused`. The store refused the shopper's saved email when it priced the order; the shopper corrects it in the contact step.
        - 400 `name_refused`. The store refused the shopper's name when it priced the order, because it has an emoji. `errors[0].pointer` is `#/given_name` or `#/family_name`, the part the store refused, which is the part the server split from `name` when the request sent none; the shopper changes it in the name field.
      security: []
      x-luckylanding-org: public
      x-luckylanding-txn: true
      x-luckylanding-live: checkout
      parameters: [{ $ref: "#/components/parameters/CheckoutSessionID" }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutPrepareParams" } } } }
      responses:
        "200": { description: Prepared payment, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutPaymentState" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/sessions/{session_id}/express_price:
    post:
      operationId: priceCheckoutExpress
      x-ogen-operation-group: Shopper
      tags: [checkout]
      summary: Price the session's items for the address an Apple Pay or Google Pay sheet gives before the shopper authorizes, for the express buttons above the delivery form (CHK-R7)
      description: |
        Authenticated by the shopper cookie and answered no-store. Before the shopper authorizes, a wallet sheet gives only an address's city, state, postal code and country. The store prices the session's items for it as `prepareCheckoutPayment` would, with its own delivery rates, its tax under the merchant's settings and the discount code the shopper typed, or else the session's own (CHK-R3), and the checkout shows the sheet those rates and that total. Nothing is stored and nothing is created at the processor: at authorization the checkout prepares the payment for the full address the wallet gives, and lets the wallet go ahead only when that prepared total equals the one the shopper authorized. When an item ships, the price includes the rate the request names when the store offers it for the address, and the cheapest rate otherwise; `shipping_unsupported` means the store offers none. When an item ships, the state and postal code are checked against Shopify's rule for the country first, taking the partial postal code a wallet redacts the sheet's address to (CA's `K1A`, GB's `SW1A`), which the full address must then complete at authorization; `address_invalid` means they can't be right. A cart with nothing to ship is priced on the country, state and postal code alone, as its prepare is.
        Errors:
        - 409 `store_unavailable`. The store has no active binding in the session's currency, or the processor connection the session was routed to is no longer an active connection of the org, or its settings check found that it adds tax or a buyer fee, so nothing changes.
        - 400 `invalid_checkout_request`. The body isn't valid.
        - 400 `order_terms_unavailable`. The store won't price this basket for this address.
        - 409 `sold_out`. An item in the basket is sold out.
        - 400 `email_refused`. The store refused the shopper's saved email when it priced the order.
        - 409 `free_order_in_wallet`. The store prices the order at zero for this address, so there is nothing for a wallet to pay; the shopper places it from the form.
        - 429 `rate_limited`. This session or this client priced too many addresses; the shopper uses the form.
        - 503 `unavailable`. The store didn't answer.
      security: []
      x-luckylanding-org: public
      x-luckylanding-txn: true
      parameters: [{ $ref: "#/components/parameters/CheckoutSessionID" }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutExpressPriceParams" } } } }
      responses:
        "200": { description: The price for this address, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutExpressPrice" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/sessions/{session_id}/place_order:
    post:
      operationId: placeCheckoutOrder
      x-ogen-operation-group: Shopper
      tags: [checkout]
      summary: Place a free order, one the store priced at zero, with no payment (CHK-R3)
      description: |
        Places the order of a prepared generation whose `free` is true. The store prices it again first, and it is placed only if the price is unchanged and still zero, with the shopper's saved email; the store order carries the discount code that made it free and no payment. Placing it again answers the same order's state; it never places a second one. Answers like recover once placed: `paid_pending_fulfilment` while the store order is written, then `order_confirmed`, or `code_refused` when the store stopped applying the code before the order was written, as when another shopper's order used its last use.
        Errors:
        - 409 `store_unavailable`. The store has no active binding in the session's currency, or the processor connection the session was routed to is no longer an active connection of the org, or its settings check found that it adds tax or a buyer fee, so nothing changes.
        - 409 `email_required`. The checkout has no saved email for this shopper, so nothing was placed.
        - 400 `email_refused`. The store refused the shopper's saved email when it priced the order again, so nothing was placed.
        - 409 `generation_conflict`. The generation is not a free one, or already moved on another way.
        - 410 `quote_expired`. The store's price changed or the quote expired; prepare again.
      security: []
      x-luckylanding-org: public
      x-luckylanding-txn: true
      parameters: [{ $ref: "#/components/parameters/CheckoutSessionID" }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutRecoveryParams" } } } }
      responses:
        "200": { description: The free order's state, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutPaymentState" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/sessions/{session_id}/recover:
    post:
      operationId: recoverCheckoutPayment
      x-ogen-operation-group: Shopper
      tags: [checkout]
      summary: Reconcile an existing payment without a new charge or raw confirmation token
      description: |
        Errors:
        - 409 `store_unavailable`. The store has no active binding in the session's currency, or the org no longer holds the session's processor account for this store.
      security: []
      x-luckylanding-org: public
      x-luckylanding-txn: true
      parameters: [{ $ref: "#/components/parameters/CheckoutSessionID" }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutRecoveryParams" } } } }
      responses:
        "200": { description: Verified payment state, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutPaymentState" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/sessions/{session_id}/status:
    post:
      operationId: readCheckoutPaymentStatus
      x-ogen-operation-group: Shopper
      tags: [checkout]
      summary: Read an existing payment's status from LL's own record rather than from the processor
      description: |
        The status comes from LL's record, which the read a payment webhook starts also updates, so the page can poll it while a payment settles. A paid outcome found there moves the payment to paid and starts writing its order.
        Errors:
        - 409 `store_unavailable`. The store has no active binding in the session's currency, or the org no longer holds the session's processor account for this store.
      security: []
      x-luckylanding-org: public
      x-luckylanding-txn: true
      parameters: [{ $ref: "#/components/parameters/CheckoutSessionID" }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutStatusParams" } } } }
      responses:
        "200": { description: The payment state LL holds, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutPaymentState" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/sessions/{session_id}/offer:
    post:
      operationId: acceptCheckoutOffer
      x-ogen-operation-group: Shopper
      tags: [checkout]
      summary: Explicitly accept the published next offer for this shopper's verified purchase
      description: |
        Errors:
        - 409 `store_unavailable`. The store has no active binding in the session's currency, the processor connection the session was routed to is no longer an active connection of the org, or its settings check found that it adds tax or a buyer fee, or the org's checkout isn't live, so nothing changes and nothing is charged.
      security: []
      x-luckylanding-org: public
      x-luckylanding-txn: true
      x-luckylanding-live: checkout
      parameters: [{ $ref: "#/components/parameters/CheckoutSessionID" }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutOfferAcceptParams" } } } }
      responses:
        "200": { description: Verified payment state or ordinary-checkout fallback, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutPaymentState" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/sessions/{session_id}/decline:
    post:
      operationId: declineCheckoutOffer
      x-ogen-operation-group: Shopper
      tags: [checkout]
      summary: "Decline the open post-purchase offer. When that offer names an offer for No thanks and the session has shown fewer than 3, the held order keeps waiting and the state carries that offer as next_offer; otherwise the held order is written now instead of at its deadline"
      description: |
        Errors:
        - 409 `store_unavailable`. The store has no active binding in the session's currency, or the org no longer holds the session's processor account for this store.
      security: []
      x-luckylanding-org: public
      x-luckylanding-txn: true
      parameters: [{ $ref: "#/components/parameters/CheckoutSessionID" }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutOfferDeclineParams" } } } }
      responses:
        "200": { description: Verified payment state of the original purchase, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutPaymentState" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/sessions/{session_id}/snapshot:
    get:
      operationId: getCheckoutSessionSnapshot
      x-ogen-operation-group: Shopper
      x-luckylanding-txn: true
      tags: [checkout]
      summary: Authenticated, no-store shopper snapshot with the current accepted payment generation and server prices.
      description: |
        Errors:
        - 409 `store_unavailable`. The store has no active binding in the session's currency, or the org no longer holds the session's processor account for this store. For an unpaid session, the account must also be active and eligible to take a new charge. A settings check that found tax or a buyer fee makes it ineligible.
      security: []
      x-luckylanding-org: public
      parameters: [{ $ref: "#/components/parameters/CheckoutSessionID" }]
      responses:
        "200": { description: OK, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutSessionSnapshot" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/sessions/{session_id}/purchase_tags:
    get:
      operationId: getCheckoutPurchaseTags
      x-ogen-operation-group: Shopper
      x-luckylanding-txn: true
      tags: [checkout]
      summary: "The org's Meta pixels and Google tag and this shopper's verified purchases, for the thank-you document's tag frames"
      description: |
        Authenticated by the shopper cookie and answered no-store. Each purchase carries the event ID of the Purchase the server sends to Meta, so Meta deduplicates the pair, and is listed only once its payment is verified; each upsell charge is its own purchase. `tracking`'s consent rule decided `load` and Limited Data Use when the session started, from the consent, GPC and country it started with, and the read applies today's rule to them again, so a rule made stricter since then loads no tag: when it loads no tag, or the org has no Meta pixel and no Google tag, `load` is false, the lists are empty and `google` is null. The shopper's IP address, user agent and delivery details are never returned.
        Errors:
        - 409 `store_unavailable`. The store has no active binding in the session's currency, or the org no longer holds the session's processor account for this store.
        - 404 `not_found`. The session has no verified purchase yet.
      security: []
      x-luckylanding-org: public
      parameters: [{ $ref: "#/components/parameters/CheckoutSessionID" }]
      responses:
        "200": { description: OK, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutPurchaseTags" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/checkout/sessions/{session_id}/confirm:
    post:
      operationId: confirmCheckoutSession
      x-ogen-operation-group: Shopper
      tags: [checkout]
      summary: "Explicitly accepts a server-priced generation using a fresh confirmation token from the processor's card fields or wallet. Returns the verified payment state, including decline, pending, bank authentication or paid-pending-fulfilment. Retry and reload use token-free recovery; uncertain submissions cannot be replaced. Too many recent failed payments on the session, or from the same client in the org, return 429 too_many_declines before any processor call (CHK-AC12)."
      description: |
        Errors:
        - 409 `store_unavailable`. The store has no active binding in the session's currency, or the processor connection the session was routed to is no longer an active connection of the org, or its settings check found that it adds tax or a buyer fee, so nothing changes.
        - 410 `quote_expired`. The quote expired, or the shopper's saved email changed after it was priced; nothing was charged, and the shopper prepares again.
      security: []
      x-luckylanding-org: public
      x-luckylanding-txn: true
      parameters: [{ $ref: "#/components/parameters/CheckoutSessionID" }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutConfirmParams" } } } }
      responses:
        "200": { description: Confirmation, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/CheckoutPaymentState" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/payments:
    get:
      operationId: listPayments
      x-ogen-operation-group: Payments
      tags: [checkout]
      summary: Lists the org's checkout payments, newest first, in the stores the caller can read.
      description: |
        Returns a page of payments. Each is one charge the org's checkout started for a purchase, in whatever `status` it reached, with its `refunds` and `disputes`; `refunded` totals the refunds that succeeded. A payment holds no card data and no shopper contact details. Owners and admins see all payments in the selected project. Other roles see payments only for stores they can read there. A caller with no store grant gets an empty page.

        Use it to find the payment the person means, or the ones that wait for a person: `order_review` is set on a paid payment that waits for a person, and says why; `order_id` is the store's order once one is placed. Pass `state` as `waiting_for_person` to list only the payments that wait, however many payments came after them, or as `dispute_needs_response` to list only the payments with a dispute the processor still takes evidence for and the merchant hasn't answered; each such dispute's `evidence_due_at` says by when, where the processor gives a date. It changes nothing.

        A person reads what the merchant needs to contest a dispute in the dashboard, under Payments.
      security: [{ oauth: ["payments:read"] }, { api_key: [] }, { session: [] }]
      x-luckylanding-mcp: { tool: payments_list, title: Payments }
      parameters: [{ $ref: "#/components/parameters/Limit" }, { $ref: "#/components/parameters/AfterID" }, { $ref: "#/components/parameters/BeforeID" }, { $ref: "#/components/parameters/PaymentState" }]
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/PaymentList" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/payments/counts:
    get:
      operationId: getPaymentCounts
      x-ogen-operation-group: Payments
      tags: [checkout]
      summary: Count the payments in each state, in the stores the caller can read
      description: |
        Counts, for each value `listPayments` takes as `state`, the payments that list would return, in the same stores. Each number is read when it is asked for, so it can differ from a list read before or after it, and from one page to the next. It changes nothing.
      security: [{ oauth: ["payments:read"] }, { api_key: [] }, { session: [] }]
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/PaymentCounts" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/payments/summary:
    get:
      operationId: getPaymentSummary
      x-ogen-operation-group: Payments
      tags: [checkout]
      summary: Sum up the payments created in a period, in the stores the caller can read
      description: |
        Counts the payments `listPayments` shows whose `created_at` is in the period, so the totals match that list for the same stores and period, except a free order (`free` true), which nothing paid and no processor answered, so it counts nowhere here. A payment counts as paid while its status is `succeeded` or `disputed`; a refund doesn't take it out.

        Errors:
        - 400 `invalid_parameter`. `to` is not after `from`.
      security: [{ oauth: ["payments:read"] }, { api_key: [] }, { session: [] }]
      parameters: [{ $ref: "#/components/parameters/PeriodFrom" }, { $ref: "#/components/parameters/PeriodTo" }]
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/PaymentSummary" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/payments/routing_policy:
    get:
      operationId: getPaymentRoutingPolicy
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Reads a store's routing policy, the weights by which each new checkout picks a processor connection per payment method.
      description: |
        Send `store_id` from `checkout_list_stores`. Returns `version`, 0 while no policy is saved, when card and Google Pay go to the store's primary connection, the one it is bound to; `etag`, which `payments_set_routing_policy` needs as If-Match; `methods`, the saved weights; and `connections`, the org's processor connections a policy can name, with `selectable` false and a `reason` for one no shopper may reach yet. To see which connection each method picks now and why, and whether the store is taking orders, call `payments_dry_run_routing_policy`. It changes nothing.
        Errors:
        - 404 `not_found`. The store has no active checkout binding.
        - 403 `store_access_denied`. The store is not one this credential may use.
      security: [{ api_key: ["checkout:read"] }, { session: ["checkout:read"] }]
      x-luckylanding-mcp: { tool: payments_get_routing_policy, title: Payment routing policy }
      x-luckylanding-txn: true
      x-luckylanding-store-resource: query
      parameters: [{ $ref: "#/components/parameters/CheckoutStoreQuery" }]
      responses:
        "200": { description: Routing policy, headers: { request-id: { $ref: "#/components/headers/RequestId" }, ETag: { $ref: "#/components/headers/ETag" } }, content: { application/json: { schema: { $ref: "#/components/schemas/PaymentRoutingPolicy" } } } }
        default: { $ref: "#/components/responses/Error" }
    post:
      operationId: setPaymentRoutingPolicy
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Sets a store's routing policy as a new version, which checkouts started from then on use.
      description: |
        Send `store_id`, the whole `methods` and the current `etag` from `payments_get_routing_policy` as If-Match. Positive weights divide new eligible sessions proportionally. Use 0 to exclude a connection from that method, including primary fallback. First run `payments_dry_run_routing_policy` on the same `methods` and tell the person each warning it gives: a policy whose method has one point of failure saves with a warning. Returns the saved `policy` with its new `etag`, and the `dry_run` of it. A checkout already started keeps its connection.
        Errors:
        - 428 `precondition_required`. If-Match is missing.
        - 412 `precondition_failed`. Another save came first. Read the policy again and send your change on it.
        - 400 `invalid_field`, `errors[].pointer` naming the method: none of its connections can take it at all (none is a connection of the org, or its processor takes no shopper yet), a list without positive weights, a weight outside 0 to 100, a connection named twice, an empty list, a method both weighted and `off`, or any `apple_pay` weight, since Apple Pay stays on the processor that holds the checkout hostname's registration.
        - 404 `not_found`. The store has no active checkout binding.
        - 403 `store_access_denied`. The store is not one this credential may use.
      security: [{ api_key: ["checkout:write"] }, { session: ["checkout:write"] }]
      x-luckylanding-mcp: { tool: payments_set_routing_policy, title: Set the payment routing policy, destructive: true, idempotent: true }
      x-luckylanding-txn: true
      x-luckylanding-store-resource: body
      parameters: [{ $ref: "#/components/parameters/IfMatch" }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/PaymentRoutingPolicyParams" } } } }
      responses:
        "200": { description: Saved routing policy, headers: { request-id: { $ref: "#/components/headers/RequestId" }, ETag: { $ref: "#/components/headers/ETag" } }, content: { application/json: { schema: { $ref: "#/components/schemas/PaymentRoutingPolicySet" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/payments/routing_policy/dry_run:
    post:
      operationId: dryRunPaymentRoutingPolicy
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Shows which connection each payment method of a checkout started now would get and why, under the saved policy or the methods you send, saving nothing.
      description: |
        Send `store_id`, and `methods` to try a policy before saving it, or leave `methods` out for the saved one. Returns, per method, its `status` and `reason`, the `pick` with the `turn` that chose it, the `candidates` and each `skipped` connection with its reason; `taking_orders`, false with a `reason` when card has no connection, its primary included, so checkout sends shoppers to the store's own checkout; and `warnings` for a method with one point of failure or none usable now. It starts no checkout, takes no turn and changes nothing.
        Errors:
        - 400 `invalid_field`, as `payments_set_routing_policy` refuses the same `methods`, on each method it refuses.
        - 404 `not_found`. The store has no active checkout binding.
        - 403 `store_access_denied`. The store is not one this credential may use.
      security: [{ api_key: ["checkout:read"] }, { session: ["checkout:read"] }]
      x-luckylanding-mcp: { tool: payments_dry_run_routing_policy, title: Dry-run the payment routing policy, read_only: true }
      x-luckylanding-txn: true
      x-luckylanding-store-resource: body
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/PaymentRoutingDryRunParams" } } } }
      responses:
        "200": { description: Dry run, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/PaymentRoutingDryRun" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/payments/{payment_id}:
    get:
      operationId: getPayment
      x-ogen-operation-group: Payments
      tags: [checkout]
      summary: Reads one payment with its refunds, its disputes and its order in the store.
      description: |
        Returns the payment as `payments_list` shows it. Read it after something was done to a payment, to see its `status`, `refunded`, `order_id` and `order_review` as Lucky Landing holds them now. It changes nothing.

        A person reads the evidence to contest its disputes in the dashboard, under Payments.

        Errors:
        - 404 `not_found`. The org has no payment with this ID, or the payment is in a store this credential cannot read. Find the payment with `payments_list`.
      security: [{ oauth: ["payments:read"] }, { api_key: [] }, { session: [] }]
      x-luckylanding-mcp: { tool: payments_get, title: Get a payment }
      parameters: [{ $ref: "#/components/parameters/PaymentID" }]
      responses:
        "200": { headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/Payment" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/payments/{payment_id}/dispute_evidence:
    get:
      operationId: getPaymentDisputeEvidence
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Get the evidence to contest a disputed payment
      description: |
        Returns what the merchant submits to the processor to contest the payment's disputes (CHK-R15): the shopper's IP address when the checkout session started, the shipping address, and the store order's fulfilment and tracking. Evidence is submitted at the processor, not through LL. Only an owner or an admin signed in to the dashboard reads it: it needs `payments:money`, which only those roles hold, and an API key or a connected app is refused whatever its scopes. It is answered no-store. The IP and address stay readable for as long as LL keeps dispute evidence (NFR-R2).
        Errors:
        - 403 `insufficient_scope`. The credential lacks `payments:money`, or the person’s current role lacks that permission.
        - 403 `person_required`. A delegated credential holds `payments:money`. Reading dispute evidence requires a dashboard session.
        - 404 `not_found`. The org has no payment with this ID, or the payment has no dispute.
      security: [{ session: ["payments:money"] }]
      x-luckylanding-txn: true
      parameters: [{ $ref: "#/components/parameters/PaymentID" }]
      responses:
        "200": { description: OK, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/PaymentDisputeEvidence" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/payments/{payment_id}/order:
    post:
      operationId: placePaymentOrder
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Check or retry a payment’s store order
      description: |
        Find the payment with `payments_list`. For `placement_unconfirmed`, only look up the original store reference. An empty search keeps the hold. A mismatched order with an unrefunded balance can be rechecked by its recorded ID. Retry `draft_unconfirmed`, `order_not_found` or `store_refused` after fixing a refusal or when requested. For `paid_twice`, retry only if `order_paid_twice.order` is `none`. LL searches before placing from the frozen quote. A hand-made order lacks that reference; record it instead. Send no body. Outcomes:
        - `order_confirmed`: the store has the order, found or placed just now; `order_id` names it.
        - `order_placing`: LL is placing the order. Read the payment with `payments_get`: `order_id` is set once the store has the order, and `order_review` stays as it was until then, also when the store refuses again. If `order_id` is still unset after a minute, call this again, which is safe: it answers `order_placing` while LL is still placing, and otherwise tries once more and says what happened.
        - `order_refused`: LL sent the order and the store refused it again, so the payment is back in review; when the store said why, `order_review` is `store_refused` and `order_refusal` says what it refused this time.
        - `code_refused`: a free order's discount code no longer applies, for example because other orders used its last use, so LL placed nothing and withdrew the purchase. No order exists; the shopper can check out again without the code.
        - `order_mismatch`: the store has an order for this purchase, found or placed just now, that doesn't match what was paid; `order_id` names it and the payment stays in review. LL checks the recorded ID again. An unedited, fulfilled order can be verified if its original purchase details still match. If it was edited or still differs, contact Lucky Landing support with the order reference and Shopify order ID.
        - `unchanged`: the payment isn't waiting for a person, for example because its order is already placed, when `order_id` names it.
        For an upsell that joined another payment's order, the retry acts on that order, and `purchase_id` names its purchase. Calling it twice is safe: a second call while the first is placing changes nothing.
        Errors:
        - 404 `not_found`. The org has no paid payment with this ID, or the payment is in a store the caller cannot write to.
        - 409 `order_search_continues`. A `placement_unconfirmed` lookup found no order, or automatic search continues for `lost_reply`. No new order was sent.
        - 409 `no_order_to_place`. `order_review` is `payment_disputed` or `payment_refunded`; or `buyer_fee`, also when `order_paid_twice.order` is `none`, since LL never places the order of a payment with a buyer fee; or `paid_twice` while the other payment holds this checkout's order or may still get one (`order_paid_twice.order` isn't `none`); or the processor shows the payment refunded or disputed since, so there is no order to place. Once the person has dealt with it, `payments_end_order_review` ends the review.
        - 409 `parent_order_unplaced`. The payment is an upsell that adds to another payment's order, and that order is itself in review; call this for that payment first.
        - 409 `payment_changed`. The payment changed between LL's search and its retry, so nothing was done; read the payment again with `payments_get`.
        - 409 `order_not_sent`. LL could not prepare the order again, so the store was not asked, and the payment is back in review.
        - 409 `store_unavailable`. The binding no longer serves the store and currency the shopper paid under, or the org no longer holds the payment's processor account for this store.
        - 503 `unavailable`. The store did not answer the search, so nothing changed; call again.
        - 503 `outcome_unknown`. The retry ran but LL could not record it, so the order may have been placed; read the payment with `payments_get` before calling again.
      security: [{ api_key: ["payments:write"] }, { session: ["payments:write"] }]
      x-luckylanding-txn: true
      x-luckylanding-mcp: { tool: payments_retry_order, title: Try a payment's store order again, destructive: true, idempotent: true, open_world: true }
      parameters: [{ $ref: "#/components/parameters/PaymentID" }]
      responses:
        "200": { description: OK, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/PaymentOrderRetry" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/payments/{payment_id}/refunds:
    post:
      operationId: refundPayment
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Refund a paid payment to its shopper, in full or up to a stated total
      description: |
        Call it only when a person asks to refund this payment, with the total they name: a refund can't be undone. It refunds a payment whose `refundable` is true: its store order is confirmed, or it is in an eligible open or ended review. A possible store order (`placement_unconfirmed` or `lost_reply`), a retry or recovery in progress, and a store order that does not match the purchase all block refunds. A refund asked of a payment in review stops LL placing its order: a later `payments_retry_order` places nothing.
        Refunds through the processor that took the payment. The body states the total the payment should have refunded after the call, `refunded`, not an amount to add: LL refunds the difference, and with no body it refunds everything that is left. So calling it twice is safe: a second call with the same total finds nothing left to do. `outcome` says what happened:
        - `refunded`: the processor shows the refund, and `refunded` is the payment's new refunded total. It is what the processor refunded, which is less than asked if the processor had less left to refund.
        - `requested`: LL holds this refund and has not finished it, usually because it was sent and the processor has not confirmed it yet. LL keeps reading and never sends it a second time; read the payment until its `refunded` changes.
        - `unchanged`: the payment already has that total refunded.
        - `nothing_paid`: the order was free, so the shopper paid nothing and nothing is refunded. `refunded` is zero.
        Errors:
        - 400 `refund_total_invalid`. `refunded` is below what is already refunded, above the payment's amount, in another currency, or its `currency_exponent` is not the currency's.
        - 404 `not_found`. The org has no paid payment with this ID, or the payment is in a store the caller cannot write to.
        - 409 `payment_not_refundable`. The payment is not paid, or is disputed.
        - 409 `payment_in_whop_case`. The payment's Whop Resolution Center case was decided with the shopper winning or Whop paying them, closed without saying who paid, or shows as decided before LL read it, so a refund could pay the shopper twice; the merchant reads the case in Whop.
        - 409 `partial_refund_in_whop_case`. A Whop Resolution Center case on the payment is open, and Whop closes it on any refund, so LL refunds only everything that is left: call with no body, or with `refunded` at the payment's amount. That refund sets the payment's `case_check`.
        - 409 `order_unconfirmed`. Placement, recovery or a possible existing order blocks this refund. After a `placement_unconfirmed` order is confirmed, submit a new refund request if the person still wants it.
        - 409 `refund_not_made`. The processor refused the refund or could not be asked, and nothing was refunded.
        - 409 `refund_in_progress`. An earlier refund of this payment is still running, or was sent and the processor has neither confirmed nor failed it. LL did nothing for this call and holds nothing for it: call again once the payment shows the earlier refund. LL staff are alerted when one stays unconfirmed.
        - 409 `payment_changed`. The payment was refunded elsewhere, for example in Whop, between LL's read and its send, so LL sent nothing; read the payment again.
        - 409 `refund_in_review`. The processor made this refund, or an earlier one LL asked for, but not as LL asked (another currency or more), so LL refunds nothing more on the payment until a person has checked.
        - 409 `whop_reapproval_required`. The Whop company has not approved LL's app to refund. An admin re-approves the app in Whop (Dashboard, Settings, Authorized apps, Re-approve), then call again. Charges are not affected.
        - 503 `unavailable`. LL could not record the ask, so it started nothing; call again.
        - 503 `outcome_unknown`. LL may have started the refund but can't say so; read the payment before calling again. Calling again with the same total is safe.
      security: [{ api_key: ["payments:money"] }, { session: ["payments:money"] }]
      x-luckylanding-txn: true
      x-luckylanding-mcp: { tool: payments_refund, title: Refund a payment, destructive: true, idempotent: true, open_world: true }
      parameters: [{ $ref: "#/components/parameters/PaymentID" }]
      requestBody: { required: false, content: { application/json: { schema: { $ref: "#/components/schemas/PaymentRefundTotal" } } } }
      responses:
        "200": { description: OK, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/PaymentRefundResult" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/payments/{payment_id}/order/placed_by_hand:
    post:
      operationId: placePaymentOrderByHand
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Record that a person placed a paid payment's store order themselves
      description: |
        For a payment whose `order_review` is `draft_unconfirmed`, `order_not_found` or `store_refused`, when a person has made the order in the store by hand. Send that order's ID, or the address of its page in the store's admin. Lucky Landing reads the order from the store, keeps its ID on the purchase and ends the review: `payments_retry_order` then answers `unchanged` and never places a second order. The payment shows `order_id` as this order and `order_source` as `merchant`.

        Lucky Landing checks that the store has the order, that it isn't cancelled, that Lucky Landing didn't write it, that no other payment holds it, and that it is in the payment's currency. It doesn't compare the total, since a person's own order may differ from what was paid: compare `order_total` with `paid`, which is what was paid for this order, by this payment and any upsell joined to it, all named in `payment_ids`. Recording the order records it for each of them. Lucky Landing writes nothing to this order: a refund from Lucky Landing is not recorded on it, so record it in the store by hand. `payments_undo_hand_order` undoes a mistake.

        For an upsell that joined another payment's order, this acts on that order. Calling it again with the same order is safe and changes nothing.

        Errors:
        - 400 `store_order_unrecognised`. `order` is neither a store order ID nor the address of an order's page.
        - 404 `not_found`. The org has no paid payment with this ID, or the payment is in a store the caller cannot write to.
        - 409 `store_order_unreadable`. The store returns no order with this ID: it may not exist, may have been deleted, or may be older than the 60 days a store's app can read. Check the ID in the store.
        - 409 `store_order_cancelled`. The order is cancelled in the store.
        - 409 `store_order_from_lucky_landing`. Lucky Landing wrote this order, for a purchase; if it is this payment's, `payments_retry_order` finds it.
        - 409 `store_order_taken`. Another payment already holds this order.
        - 409 `store_order_currency`. The order is in another currency than the payment.
        - 409 `order_not_in_review`. The payment isn't waiting for a person, already has a store order, or Lucky Landing is placing its order now; read the payment with `payments_get`.
        - 409 `order_search_continues`. The original store order may exist (`placement_unconfirmed` or `lost_reply`), or its recorded ID still fails verification. Use Check store or `payments_retry_order` for a held order. A known mismatch can be marked dealt with after the complete order is refunded and the merchant cancels it in the store.
        - 409 `no_order_to_place`. `order_review` is `payment_disputed`, `payment_refunded`, `buyer_fee` or `paid_twice`, or the payment or an upsell joined to its order has been refunded or disputed, so there is no order to place. Once the person has dealt with it, `payments_end_order_review` ends the review.
        - 409 `store_unavailable`. The binding no longer serves the store and currency the shopper paid under, or the org no longer holds the payment's processor account for this store.
        - 503 `unavailable`. The store did not answer; nothing changed, so call again.
      security: [{ api_key: ["payments:write"] }, { session: ["payments:write"] }]
      x-luckylanding-txn: true
      x-luckylanding-mcp: { tool: payments_record_hand_order, title: Record an order placed by hand, idempotent: true, open_world: true }
      parameters: [{ $ref: "#/components/parameters/PaymentID" }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/PaymentHandOrderParams" } } } }
      responses:
        "200": { description: OK, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/PaymentHandOrder" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/payments/{payment_id}/order/placed_by_hand/undo:
    post:
      operationId: undoPaymentOrderByHand
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: Undo recording that a person placed a payment's store order themselves
      description: |
        For a payment whose `order_source` is `merchant`, when the order recorded for it was the wrong one. The payment goes back to review with the `order_review` it had, so `payments_retry_order` or `payments_record_hand_order` can act on it again. The store order itself is left as it is.

        Errors:
        - 404 `not_found`. The org has no paid payment with this ID, or the payment is in a store the caller cannot write to.
        - 409 `not_placed_by_hand`. No order placed by hand is recorded for this payment.
        - 409 `refunded_since_placed_by_hand`. The payment, or an upsell joined to its order, was refunded or disputed after the order was recorded, so it doesn't go back to review.
      security: [{ api_key: ["payments:write"] }, { session: ["payments:write"] }]
      x-luckylanding-txn: true
      x-luckylanding-mcp: { tool: payments_undo_hand_order, title: Undo an order recorded as placed by hand, destructive: true, idempotent: true, open_world: true }
      parameters: [{ $ref: "#/components/parameters/PaymentID" }]
      responses:
        "200": { description: OK, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/PaymentHandOrder" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/payments/{payment_id}/order/review/end:
    post:
      operationId: endPaymentOrderReview
      x-ogen-operation-group: Checkout
      tags: [checkout]
      summary: End the review of a paid payment whose order Lucky Landing places no order for, once a person has dealt with it
      description: |
        Read the payment with `payments_get`. Call this only when `order_review_endable` is true and the person confirms they have dealt with the order. For a known mismatched order, the entire order must be refunded and the merchant must cancel the order in the store before acknowledging it here. Send the reason the person gives:
        - `order_made_by_hand`: they made the order in the store themselves. Lucky Landing doesn't link that order to the payment.
        - `no_order_needed`: the shopper is owed no order, for example because the person settled it with them.

        The payment then stops waiting: `order_review` is null, `order_review_end` says why, and `payments_list` with `state=waiting_for_person` no longer lists it. Nothing is refunded and nothing is written to the store, and it can't be undone. A refund that brings every payment of the order to its full amount ends the review by itself, with `order_review_end.reason` `refunded`, unless the original placement is unconfirmed or `order_id` names an order that does not match the purchase. An unconfirmed placement stays open even after a full refund. A partial refund or a dispute ends nothing.

        For an upsell that joined another payment's order, this acts on that order and ends it for each payment in `payment_ids`. Calling it again is safe: it answers with the end as it stands, whichever way the review ended.

        Errors:
        - 400 `invalid_body`. `reason` is missing or isn't one of the two.
        - 404 `not_found`. The org has no paid payment with this ID, or the payment is in a store the caller cannot write to.
        - 409 `order_not_in_review`. The payment isn't waiting for a person, already has a store order, or Lucky Landing is placing its order now; read the payment with `payments_get`.
        - 409 `order_search_continues`. The original store order may exist (`placement_unconfirmed` or `lost_reply`), or its recorded ID still fails verification. Use Check store or `payments_retry_order` for a held order. A known mismatch can be marked dealt with after the complete order is refunded and the merchant cancels it in the store.
        - 409 `order_still_placeable`. Lucky Landing can still place this payment's order: use `payments_retry_order`, or `payments_record_hand_order` for an order the person made in the store.
        - 409 `store_order_taken`. `order_made_by_hand` on a `payment_refunded` review while another payment of this checkout holds its order; nothing changed.
        - 503 `unavailable`. Lucky Landing could not record the end; nothing changed, so call again.
      security: [{ api_key: ["payments:write"] }, { session: ["payments:write"] }]
      x-luckylanding-txn: true
      x-luckylanding-mcp: { tool: payments_end_order_review, title: End a payment's order review, destructive: true, idempotent: true }
      parameters: [{ $ref: "#/components/parameters/PaymentID" }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/PaymentReviewEndParams" } } } }
      responses:
        "200": { description: OK, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/PaymentReviewEnd" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/outreach/stores:
    get:
      operationId: listOutreachStores
      x-ogen-operation-group: Outreach
      tags: [outreach]
      summary: Lists the org's connected Shopify stores that Customer Connect can use.
      description: |
        Returns a page of stores, each with `id` and `name`, its myshopify.com domain, among those the caller can read. A store's `id` is what `listOutreachProducts` and `createOutreachFlow` take. It sends nothing and changes nothing.
        Errors:
        - 403 `outreach_not_enabled`. The org is not on the Customer Connect allowlist.
        - 503 `unavailable`. The store connections could not be read; retry shortly.
      security: [{ oauth: ["outreach:read"] }, { api_key: [] }, { session: [] }]
      parameters: [{ $ref: "#/components/parameters/Limit" }, { $ref: "#/components/parameters/AfterID" }, { $ref: "#/components/parameters/BeforeID" }]
      responses:
        "200": { description: Stores, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/OutreachStoreList" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/outreach/personas:
    get:
      operationId: listOutreachPersonas
      x-ogen-operation-group: Outreach
      tags: [outreach]
      summary: Lists the org's Customer Connect personas, newest first.
      description: |
        Returns a page of personas with every field, each with its `etag`. A flow's `persona_weights` name personas by `id`. It changes nothing.
        Errors:
        - 403 `outreach_not_enabled`. The org is not on the Customer Connect allowlist.
      security: [{ oauth: ["outreach:read"] }, { api_key: [] }, { session: [] }]
      parameters: [{ $ref: "#/components/parameters/Limit" }, { $ref: "#/components/parameters/AfterID" }, { $ref: "#/components/parameters/BeforeID" }]
      responses:
        "200": { description: Personas, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/OutreachPersonaList" } } } }
        default: { $ref: "#/components/responses/Error" }
    post:
      operationId: createOutreachPersona
      x-ogen-operation-group: Outreach
      tags: [outreach]
      summary: Creates a persona that Customer Connect follow-up messages could use.
      description: |
        Returns the new persona with its `id` and `etag`. A persona uses a first name only, and no field may claim the persona is a person or a member of staff. Each call makes a new persona, so list personas before you retry. It sends nothing.
        Errors:
        - 403 `outreach_not_enabled`. The org is not on the Customer Connect allowlist.
        - 422 `outreach_invalid_setup`, `errors[].pointer` naming each refused field. Fix hint: use a first name only and describe the persona as an automated assistant.
      security: [{ oauth: ["outreach:write"] }, { api_key: [] }, { session: [] }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/OutreachPersonaParams" } } } }
      responses:
        "200": { description: Created, headers: { request-id: { $ref: "#/components/headers/RequestId" }, ETag: { $ref: "#/components/headers/ETag" } }, content: { application/json: { schema: { $ref: "#/components/schemas/OutreachPersona" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/outreach/personas/{persona_id}:
    get:
      operationId: getOutreachPersona
      x-ogen-operation-group: Outreach
      tags: [outreach]
      summary: Reads one persona with its current etag.
      description: |
        Returns every field of the persona and its `etag`. Read it right before `updateOutreachPersona` or `deleteOutreachPersona`, which need the current `etag` as If-Match. It changes nothing.
        Errors:
        - 403 `outreach_not_enabled`. The org is not on the Customer Connect allowlist.
        - 404 `not_found`. No persona with this ID exists in the org.
      security: [{ oauth: ["outreach:read"] }, { api_key: [] }, { session: [] }]
      parameters: [{ $ref: "#/components/parameters/OutreachPersonaID" }]
      responses:
        "200": { description: Persona, headers: { request-id: { $ref: "#/components/headers/RequestId" }, ETag: { $ref: "#/components/headers/ETag" } }, content: { application/json: { schema: { $ref: "#/components/schemas/OutreachPersona" } } } }
        default: { $ref: "#/components/responses/Error" }
    post:
      operationId: updateOutreachPersona
      x-ogen-operation-group: Outreach
      tags: [outreach]
      summary: Replaces every field of a persona.
      description: |
        Send the whole persona, and the current `etag` from `getOutreachPersona` as If-Match. Returns the saved persona with its new `etag`. The rules of `createOutreachPersona` apply. It sends nothing.
        Errors:
        - 403 `outreach_not_enabled`. The org is not on the Customer Connect allowlist.
        - 404 `not_found`. No persona with this ID exists in the org.
        - 428 `precondition_required`. If-Match is missing.
        - 412 `precondition_failed`. If-Match is not the current `etag`; reload the persona and retry.
        - 422 `outreach_invalid_setup`, `errors[].pointer` naming each refused field.
      security: [{ oauth: ["outreach:write"] }, { api_key: [] }, { session: [] }]
      parameters: [{ $ref: "#/components/parameters/OutreachPersonaID" }, { $ref: "#/components/parameters/IfMatch" }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/OutreachPersonaParams" } } } }
      responses:
        "200": { description: Saved, headers: { request-id: { $ref: "#/components/headers/RequestId" }, ETag: { $ref: "#/components/headers/ETag" } }, content: { application/json: { schema: { $ref: "#/components/schemas/OutreachPersona" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/outreach/personas/{persona_id}/delete:
    post:
      operationId: deleteOutreachPersona
      x-ogen-operation-group: Outreach
      tags: [outreach]
      summary: Deletes a persona that no flow uses.
      description: |
        Send the current `etag` from `getOutreachPersona` as If-Match. Returns the deleted persona's `id`. The persona and its ID are gone; `createOutreachPersona` with the fields `getOutreachPersona` returned makes the same persona under a new ID. It sends nothing.
        Errors:
        - 403 `outreach_not_enabled`. The org is not on the Customer Connect allowlist.
        - 404 `not_found`. No persona with this ID exists in the org.
        - 428 `precondition_required`. If-Match is missing.
        - 412 `precondition_failed`. If-Match is not the current `etag`.
        - 409 `outreach_persona_in_use`. A flow still uses this persona. Remove it from persona_weights in every flow, then delete it.
      security: [{ oauth: ["outreach:write"] }, { api_key: [] }, { session: [] }]
      parameters: [{ $ref: "#/components/parameters/OutreachPersonaID" }, { $ref: "#/components/parameters/IfMatch" }]
      responses:
        "200": { description: Deleted, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/OutreachPersonaDeleted" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/outreach/stores/{store_id}/products:
    get:
      operationId: listOutreachProducts
      x-ogen-operation-group: Outreach
      tags: [outreach]
      summary: Lists a store's products from Shopify with their Customer Connect eligibility.
      description: |
        Returns a page of products, each with `title`, `active`, `category_name` and `eligibility`, which is `included`, `excluded`, `restricted` or `inactive`. It reads the store's products from Shopify in ascending product ID order: page forward with `after_id` set to the previous page's `last_id`; `before_id` is refused, and a page holds at most 250 products. Each product is `excluded` until the merchant includes it with `setOutreachProductEligibility`. A restricted product (alcohol, tobacco and vapes, cannabis, CBD and hemp, firearms and weapons, gambling, prescription drugs, adult content, loan, debt or crypto offers), or one with no recognized Shopify category, is `restricted`, and a product that is not active in Shopify is `inactive`; neither can be included. Nothing is sent.
        Errors:
        - 403 `outreach_not_enabled`. The org is not on the Customer Connect allowlist.
        - 404 `not_found`. The store is not one of the org's connected Shopify stores.
        - 400 `invalid_parameter`. `before_id` was sent, or `after_id` is not a product ID.
        - 503 `unavailable`. Shopify did not answer; retry shortly.
      security: [{ oauth: ["outreach:read"] }, { api_key: [] }, { session: [] }]
      parameters: [{ $ref: "#/components/parameters/OutreachStoreID" }, { $ref: "#/components/parameters/Limit" }, { $ref: "#/components/parameters/AfterID" }, { $ref: "#/components/parameters/BeforeID" }]
      responses:
        "200": { description: Products, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/OutreachProductList" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/outreach/stores/{store_id}/products/{product_id}/eligibility:
    post:
      operationId: setOutreachProductEligibility
      x-ogen-operation-group: Outreach
      tags: [outreach]
      summary: Includes a product in Customer Connect, or excludes it.
      description: |
        Sets `included` for one of the store's products and returns the product with its new `eligibility`. It reads the product from Shopify first. Only an active product that is not restricted can be included; excluding always works. Nothing is sent.
        Errors:
        - 403 `outreach_not_enabled`. The org is not on the Customer Connect allowlist.
        - 404 `not_found`. The store or the product is not in the org's catalogue.
        - 422 `outreach_invalid_setup`, `errors[].pointer` `/included`. The product is restricted or not active in Shopify, so it can't be included.
        - 503 `unavailable`. Shopify did not answer; retry shortly.
      security: [{ oauth: ["outreach:write"] }, { api_key: [] }, { session: [] }]
      parameters: [{ $ref: "#/components/parameters/OutreachStoreID" }, { $ref: "#/components/parameters/OutreachProductID" }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/OutreachEligibilityParams" } } } }
      responses:
        "200": { description: Saved, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/OutreachProduct" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/outreach/flows:
    get:
      operationId: listOutreachFlows
      x-ogen-operation-group: Outreach
      tags: [outreach]
      summary: Lists the org's abandoned cart flows, newest first.
      description: |
        Returns a page of flows in the stores the caller can read, each with its settings, `persona_weights` and `etag`. Every flow is off, so nothing is sent. It changes nothing.
        Errors:
        - 403 `outreach_not_enabled`. The org is not on the Customer Connect allowlist.
      security: [{ oauth: ["outreach:read"] }, { api_key: [] }, { session: [] }]
      parameters: [{ $ref: "#/components/parameters/Limit" }, { $ref: "#/components/parameters/AfterID" }, { $ref: "#/components/parameters/BeforeID" }]
      responses:
        "200": { description: Flows, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/OutreachFlowList" } } } }
        default: { $ref: "#/components/responses/Error" }
    post:
      operationId: createOutreachFlow
      x-ogen-operation-group: Outreach
      tags: [outreach]
      summary: Creates a store's abandoned cart flow, saved off.
      description: |
        Creates the store's abandoned cart flow and returns it with its `id` and `etag`; each store has one, so change an existing flow with `updateOutreachFlow`. Persona weights are whole percentages that add up to 100, each persona once. Sending hours can only narrow 9 AM to 8 PM in the shopper's local time, Monday to Saturday. Discount tiers are whole percentages in ascending order, and `max_tier` is 0 or one of them. Nothing is sent.
        Errors:
        - 403 `outreach_not_enabled`. The org is not on the Customer Connect allowlist.
        - 404 `not_found`. The store or a persona is not in the org.
        - 409 `outreach_sends_unavailable`. `enabled` is true.
        - 409 `outreach_flow_exists`. The store already has this flow; update it instead.
        - 422 `outreach_invalid_setup`, `errors[].pointer` naming each invalid field.
      security: [{ oauth: ["outreach:write"] }, { api_key: [] }, { session: [] }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/OutreachFlowParams" } } } }
      responses:
        "200": { description: Created, headers: { request-id: { $ref: "#/components/headers/RequestId" }, ETag: { $ref: "#/components/headers/ETag" } }, content: { application/json: { schema: { $ref: "#/components/schemas/OutreachFlow" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/outreach/flows/{flow_id}:
    get:
      operationId: getOutreachFlow
      x-ogen-operation-group: Outreach
      tags: [outreach]
      summary: Reads one abandoned cart flow with its current etag.
      description: |
        Returns the flow's settings, `persona_weights` and `etag`. Read it right before `updateOutreachFlow`, which needs the current `etag` as If-Match. It changes nothing.
        Errors:
        - 403 `outreach_not_enabled`. The org is not on the Customer Connect allowlist.
        - 404 `not_found`. No flow with this ID exists in the org.
      security: [{ oauth: ["outreach:read"] }, { api_key: [] }, { session: [] }]
      parameters: [{ $ref: "#/components/parameters/OutreachFlowID" }]
      responses:
        "200": { description: Flow, headers: { request-id: { $ref: "#/components/headers/RequestId" }, ETag: { $ref: "#/components/headers/ETag" } }, content: { application/json: { schema: { $ref: "#/components/schemas/OutreachFlow" } } } }
        default: { $ref: "#/components/responses/Error" }
    post:
      operationId: updateOutreachFlow
      x-ogen-operation-group: Outreach
      tags: [outreach]
      summary: Replaces an abandoned cart flow's settings.
      description: |
        Send every setting, and the current `etag` from `getOutreachFlow` as If-Match. Returns the saved flow with its new `etag`. The rules of `createOutreachFlow` apply, and `store_id` can't change. Nothing is sent.
        Errors:
        - 403 `outreach_not_enabled`. The org is not on the Customer Connect allowlist.
        - 404 `not_found`. The flow or a persona is not in the org.
        - 428 `precondition_required`. If-Match is missing.
        - 412 `precondition_failed`. If-Match is not the current `etag`.
        - 409 `outreach_sends_unavailable`. `enabled` is true.
        - 422 `outreach_invalid_setup`, `errors[].pointer` naming each invalid field.
      security: [{ oauth: ["outreach:write"] }, { api_key: [] }, { session: [] }]
      parameters: [{ $ref: "#/components/parameters/OutreachFlowID" }, { $ref: "#/components/parameters/IfMatch" }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/OutreachFlowParams" } } } }
      responses:
        "200": { description: Saved, headers: { request-id: { $ref: "#/components/headers/RequestId" }, ETag: { $ref: "#/components/headers/ETag" } }, content: { application/json: { schema: { $ref: "#/components/schemas/OutreachFlow" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/outreach/conversations:
    get:
      operationId: listOutreachConversations
      x-ogen-operation-group: Outreach
      tags: [outreach]
      summary: Lists Customer Connect conversations, most recent activity first.
      description: |
        Returns a page of the org's conversations in the stores the caller can read, each with its `state`, `flow_id`, `item_count` and times; `state` narrows it to the conversations in that state. It does not return messages. `after_id` and `before_id` take a conversation ID from the previous page. Nothing is sent.
        Errors:
        - 403 `insufficient_scope`. The token lacks `outreach:read`.
        - 403 `outreach_not_enabled`. The org is not on the Customer Connect allowlist.
        - 400 `invalid_page`. `after_id` or `before_id` is not a conversation in this list, or that conversation was deleted; start again from the first page.
        - 503 `unavailable`. The allowlist or the caller's stores could not be read; retry shortly.
      security: [{ oauth: ["outreach:read"] }, { api_key: [] }, { session: [] }]
      parameters: [{ $ref: "#/components/parameters/Limit" }, { $ref: "#/components/parameters/AfterID" }, { $ref: "#/components/parameters/BeforeID" }, { $ref: "#/components/parameters/OutreachConversationState" }]
      responses:
        "200": { description: Conversations, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/OutreachConversationList" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/outreach/conversations/{conversation_id}:
    get:
      operationId: getOutreachConversation
      x-ogen-operation-group: Outreach
      tags: [outreach]
      summary: Reads one conversation with its current etag.
      description: |
        Returns the conversation's `state`, `flow_id`, `item_count`, times and `etag`. Read it right before `deleteOutreachConversation`, which needs the current `etag` as If-Match. It does not return messages, and it changes nothing.
        Errors:
        - 403 `outreach_not_enabled`. The org is not on the Customer Connect allowlist.
        - 404 `not_found`. No conversation with this ID exists in a store the caller can read.
      security: [{ oauth: ["outreach:read"] }, { api_key: [] }, { session: [] }]
      parameters: [{ $ref: "#/components/parameters/OutreachConversationID" }]
      responses:
        "200": { description: Conversation, headers: { request-id: { $ref: "#/components/headers/RequestId" }, ETag: { $ref: "#/components/headers/ETag" } }, content: { application/json: { schema: { $ref: "#/components/schemas/OutreachConversation" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/outreach/conversations/{conversation_id}/delete:
    post:
      operationId: deleteOutreachConversation
      x-ogen-operation-group: Outreach
      tags: [outreach]
      summary: Deletes a conversation and everything it holds.
      description: |
        Send the current `etag` from `getOutreachConversation` as If-Match. Deletes the conversation with everything it holds, its alerts included, and returns its `id`; nothing brings it back. The recipient's consent and opt-out records are kept. It sends nothing.
        Errors:
        - 403 `outreach_not_enabled`. The org is not on the Customer Connect allowlist.
        - 404 `not_found`. No conversation with this ID exists in a store the caller can change.
        - 428 `precondition_required`. If-Match is missing.
        - 412 `precondition_failed`. If-Match is not the current `etag`; the conversation changed, so read it again.
      security: [{ oauth: ["outreach:write"] }, { api_key: [] }, { session: [] }]
      parameters: [{ $ref: "#/components/parameters/OutreachConversationID" }, { $ref: "#/components/parameters/IfMatch" }]
      responses:
        "200": { description: Deleted, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/OutreachConversationDeleted" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/outreach/conversations/{conversation_id}/drafts:
    get:
      operationId: listOutreachDrafts
      x-ogen-operation-group: Outreach
      tags: [outreach]
      summary: Lists a conversation's AI drafts, newest first.
      description: |
        Returns a page of the conversation's drafts, each with its `state`, its `body` and its `staff_note`. A draft is never sent: `pending` waits for a person to approve or reject it, and `refused` names in `refused_for` each rule the model's plan broke, without its text, and holds the conversation for a person. The model writes no word of a body: it picks which of Lucky Landing's own fixed phrases, the store's product titles and a true statement that it is automated go in, and every body starts by saying it comes from an automated assistant for the store. A product title with a price, a discount or a link, or over 80 characters, refuses the draft instead of showing. `staff_note` is the model's note for the store's staff; it may mention prices, but one that names an amount or a link refuses the draft, and it is never sent to a shopper. `body` and `staff_note` are null when the draft was refused, and once they are purged 30 days after the draft was made. `after_id` and `before_id` take a draft ID from the previous page. It changes nothing.
        Errors:
        - 403 `outreach_not_enabled`. The org is not on the Customer Connect allowlist.
        - 404 `not_found`. No conversation with this ID exists in a store the caller can read.
      security: [{ oauth: ["outreach:read"] }, { api_key: [] }, { session: [] }]
      parameters: [{ $ref: "#/components/parameters/OutreachConversationID" }, { $ref: "#/components/parameters/Limit" }, { $ref: "#/components/parameters/AfterID" }, { $ref: "#/components/parameters/BeforeID" }]
      responses:
        "200": { description: Drafts, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/OutreachDraftList" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/outreach/drafts/{outreach_draft_id}/approve:
    post:
      operationId: approveOutreachDraft
      x-ogen-operation-group: Outreach
      tags: [outreach]
      summary: Approves a pending draft without sending it.
      description: |
        Marks a `pending` draft from `listOutreachDrafts` `approved` and returns it. It sends nothing: no operation sends a draft yet. Approving an approved draft returns it as it is.
        Errors:
        - 403 `outreach_not_enabled`. The org is not on the Customer Connect allowlist.
        - 403 `person_required`. Only a person signed in to the dashboard decides a draft; an API key or a connected app can't.
        - 404 `not_found`. No draft with this ID exists in a conversation in a store the caller can change.
        - 409 `outreach_draft_decided`. The draft was rejected or refused, so it can't be approved.
      security: [{ oauth: ["outreach:write"] }, { api_key: [] }, { session: [] }]
      parameters: [{ $ref: "#/components/parameters/OutreachDraftID" }]
      responses:
        "200": { description: Approved, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/OutreachDraft" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/outreach/drafts/{outreach_draft_id}/reject:
    post:
      operationId: rejectOutreachDraft
      x-ogen-operation-group: Outreach
      tags: [outreach]
      summary: Rejects a pending draft.
      description: |
        Marks a `pending` draft from `listOutreachDrafts` `rejected` and returns it; Lucky Landing never sends it. Rejecting a rejected draft returns it as it is. It sends nothing.
        Errors:
        - 403 `outreach_not_enabled`. The org is not on the Customer Connect allowlist.
        - 403 `person_required`. Only a person signed in to the dashboard decides a draft; an API key or a connected app can't.
        - 404 `not_found`. No draft with this ID exists in a conversation in a store the caller can change.
        - 409 `outreach_draft_decided`. The draft was approved or refused, so it can't be rejected.
      security: [{ oauth: ["outreach:write"] }, { api_key: [] }, { session: [] }]
      parameters: [{ $ref: "#/components/parameters/OutreachDraftID" }]
      responses:
        "200": { description: Rejected, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/OutreachDraft" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/outreach/alerts:
    get:
      operationId: listOutreachAlerts
      x-ogen-operation-group: Outreach
      tags: [outreach]
      summary: Lists the org's Customer Connect alerts that are not dismissed, newest first.
      description: |
        Returns a page of alerts, each with its `kind`, the `conversation_id` it is about, if any, and when it was raised. An alert about a conversation is listed only to a caller who can read that conversation's store. `after_id` and `before_id` take an alert ID from the previous page. It changes nothing.
        Errors:
        - 403 `outreach_not_enabled`. The org is not on the Customer Connect allowlist.
        - 503 `unavailable`. The allowlist or the caller's stores could not be read; retry shortly.
      security: [{ oauth: ["outreach:read"] }, { api_key: [] }, { session: [] }]
      parameters: [{ $ref: "#/components/parameters/Limit" }, { $ref: "#/components/parameters/AfterID" }, { $ref: "#/components/parameters/BeforeID" }]
      responses:
        "200": { description: Alerts, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/OutreachAlertList" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/outreach/alerts/{alert_id}/dismiss:
    post:
      operationId: dismissOutreachAlert
      x-ogen-operation-group: Outreach
      tags: [outreach]
      summary: Dismisses an alert for everyone in the org.
      description: |
        Takes the alert off `listOutreachAlerts` and returns it with `dismissed_at` set. Dismissing an alert that is already dismissed changes nothing and returns it as it is. It sends nothing.
        Errors:
        - 403 `outreach_not_enabled`. The org is not on the Customer Connect allowlist.
        - 404 `not_found`. No alert with this ID exists in the org, or it is about a conversation in a store the caller can't change.
      security: [{ oauth: ["outreach:write"] }, { api_key: [] }, { session: [] }]
      parameters: [{ $ref: "#/components/parameters/OutreachAlertID" }]
      responses:
        "200": { description: Dismissed, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/OutreachAlert" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/outreach/budget:
    get:
      operationId: getOutreachBudget
      x-ogen-operation-group: Outreach
      tags: [outreach]
      summary: Reads the org's draft budget and what model calls have spent so far.
      description: |
        Returns the org's `ceiling` for model calls, drafts and the persona wizard alike, the `maximum` Lucky Landing staff allow it, what calls still running have `reserved` and what finished calls have `spent`. Each call costs the model's list price for its input and output tokens together, rounded up once to the currency's minor unit. The totals run over the org's lifetime and never reset. Before each call Lucky Landing reserves its worst case, the counted input plus the most output it may write. It refuses the call when `reserved` plus `spent` plus that would pass the ceiling, or when every org's reservations and spend together would pass Lucky Landing's platform ceiling; the first refusal raises a `budget_reached` alert. It changes nothing.
        Errors:
        - 403 `outreach_not_enabled`. The org is not on the Customer Connect allowlist.
        - 503 `unavailable`. The allowlist could not be read; retry shortly.
      security: [{ oauth: ["outreach:read"] }, { api_key: [] }, { session: [] }]
      responses:
        "200": { description: Budget, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/OutreachBudget" } } } }
        default: { $ref: "#/components/responses/Error" }
    post:
      operationId: setOutreachBudget
      x-ogen-operation-group: Outreach
      tags: [outreach]
      summary: Sets the org's draft budget, up to the maximum Lucky Landing staff allow it.
      description: |
        Sets `ceiling`, the most the org's model calls may cost over its lifetime, and returns the budget. Only Lucky Landing staff change `maximum`. A ceiling below what is already reserved and spent refuses every model call until it is raised. It sends nothing and charges nothing.
        Errors:
        - 403 `outreach_not_enabled`. The org is not on the Customer Connect allowlist.
        - 422 `outreach_invalid_setup`, `errors[].pointer` `/ceiling/amount_minor` or `/ceiling/currency`. The ceiling is above `maximum` or below zero, or is not in the budget's currency.
        - 503 `unavailable`. The allowlist could not be read; retry shortly.
      security: [{ oauth: ["outreach:write"] }, { api_key: [] }, { session: [] }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/OutreachBudgetParams" } } } }
      responses:
        "200": { description: Saved, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/OutreachBudget" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/ad_canvas/stores:
    get:
      operationId: listAdCanvasStores
      x-ogen-operation-group: AdCanvas
      tags: [ad_canvas]
      summary: Lists the stores whose ads the caller can drop into Ad Canvas, newest first.
      description: |
        Returns a page of the org's stores the caller can read, each with `id` and `domain`. A store's `id` is what `createAdBreakdown` takes as `store_id`; dropping in an ad also needs write access to that store. It reads what Lucky Landing holds and asks no store platform. It changes nothing.
        Errors:
        - 403 `ad_canvas_not_enabled`. This organization does not hold Ad Canvas, or the model is unavailable.
      security: [{ oauth: ["ad_canvas:read"] }, { api_key: [] }, { session: [] }]
      parameters: [{ $ref: "#/components/parameters/Limit" }, { $ref: "#/components/parameters/AfterID" }, { $ref: "#/components/parameters/BeforeID" }]
      responses:
        "200": { description: Stores, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/AdCanvasStoreList" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/ad_canvas/stores/{store_id}/breakdowns:
    get:
      operationId: listAdBreakdowns
      x-ogen-operation-group: AdCanvas
      tags: [ad_canvas]
      summary: Lists a store's breakdowns, newest first, each with its state and scene count but not its scenes.
      description: |
        Returns a page of the store's breakdowns, newest first, each with its `state`, its `failure` when it failed, when it was dropped in, and `scene_count`, the number of scenes it was broken into, 0 unless `state` is `broken_down`. Read one's scenes with `getAdBreakdown`. It changes nothing.
        Errors:
        - 403 `ad_canvas_not_enabled`. This organization does not hold Ad Canvas, or the model is unavailable.
        - 404 `not_found`. The store is not in the org, or the caller can't read it.
      security: [{ oauth: ["ad_canvas:read"] }, { api_key: [] }, { session: [] }]
      parameters: [{ $ref: "#/components/parameters/OutreachStoreID" }, { $ref: "#/components/parameters/Limit" }, { $ref: "#/components/parameters/AfterID" }, { $ref: "#/components/parameters/BeforeID" }]
      responses:
        "200": { description: Breakdowns, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/AdBreakdownList" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/ad_canvas/breakdowns:
    post:
      operationId: createAdBreakdown
      x-ogen-operation-group: AdCanvas
      tags: [ad_canvas]
      summary: Drops a video ad into Ad Canvas for one store, which breaks it down into its scenes.
      description: |
        Send `store_id`, the store whose brand the ad is for, and `video`, the ad's bytes base64-encoded: an MP4 or WebM file in a request of up to 12 MiB. Returns the breakdown with `state` `breaking_down` and no scenes. Lucky Landing breaks the video down on its own, so read it with `getAdBreakdown` until `state` is `broken_down`, when `scenes` holds each scene in order, or `failed`, when `failure` says why. Each call makes a new breakdown, so a retry after an answer that was lost leaves a second one; both break down the same video, and `listAdBreakdowns` lists both, newest first.
        Errors:
        - 400 `ad_canvas_video_unreadable`. The bytes are not an MP4 or WebM video, such as a QuickTime MOV file or an image. Nothing was stored.
        - 404 `not_found`. The store is not in the org, or the caller can't change it.
        - 413 `request_too_large`. The request is larger than 12 MiB.
        - 501 `not_implemented`. Lucky Landing has not turned a breakdown model on in this environment, so nothing was stored.
        - 503 `unavailable`. The write of the video failed, so Lucky Landing recorded this breakdown failed before it answered and never breaks it down, even if the video was in fact stored; drop the ad in again.
      security: [{ oauth: ["ad_canvas:write"] }, { api_key: [] }, { session: [] }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/AdBreakdownParams" } } } }
      responses:
        "200": { description: Breaking down, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/AdBreakdown" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/ad_canvas/breakdowns/{breakdown_id}:
    get:
      operationId: getAdBreakdown
      x-ogen-operation-group: AdCanvas
      tags: [ad_canvas]
      summary: Reads a breakdown of a video ad, with its scenes in order once it is broken down.
      description: |
        Returns the breakdown's `state`. While it is `breaking_down`, `scenes` is empty; read it again in a few seconds. Once it is `broken_down`, `scenes` holds every scene in the order it plays: when it starts and ends, in milliseconds from the start of the video; its `role` in the ad; the `words` spoken or shown, empty when there are none; and the `shot`, what the scene shows. When it is `failed`, `failure` is `video_unreadable` when the video could not be read as an ad, and `breakdown_failed` when Lucky Landing could not break it down; drop the ad in again to try once more. It changes nothing.
        Errors:
        - 404 `not_found`. No breakdown with this ID is in the org, or the caller can't read its store.
      security: [{ oauth: ["ad_canvas:read"] }, { api_key: [] }, { session: [] }]
      parameters: [{ $ref: "#/components/parameters/AdBreakdownID" }]
      responses:
        "200": { description: Breakdown, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/AdBreakdown" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/ad_canvas/breakdowns/{breakdown_id}/rebuilds:
    post:
      operationId: createAdRebuild
      x-ogen-operation-group: AdCanvas
      tags: [ad_canvas]
      summary: Rebuilds a broken-down ad for the store's brand, keeping its scenes' order, times and roles.
      description: |
        Send a brief: `product`, what the brand sells in this ad; `angle`, the angle to sell it on; and `audience`, who buys it. Each is 1 to 500 characters with at least one that isn't a space. Returns the rebuild with `state` `rebuilding` and no scenes. Lucky Landing rewrites each scene's words and shot for the brief on its own, so read it with `getAdRebuild` until `state` is `rebuilt`, when `scenes` holds one rewritten scene for each scene of the breakdown, in the same order and with the same times and roles, or `failed`. Once it is rebuilt, Lucky Landing renders a video of it on its own, which its `render` names. Each call makes a new rebuild, so a retry after an answer that was lost leaves a second one for the same brief.
        Errors:
        - 400 `invalid_field`, `errors[].pointer` naming the field. A brief field is missing, blank or longer than 500 characters.
        - 404 `not_found`. No breakdown with this ID is in the org, or the caller can't change its store.
        - 409 `ad_canvas_breakdown_not_ready`. The breakdown is still breaking down, or it failed, so it has no scenes to rebuild.
        - 501 `not_implemented`. Lucky Landing has not turned a model on in this environment, so nothing was stored.
      security: [{ oauth: ["ad_canvas:write"] }, { api_key: [] }, { session: [] }]
      parameters: [{ $ref: "#/components/parameters/AdBreakdownID" }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/AdRebuildParams" } } } }
      responses:
        "200": { description: Rebuilding, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/AdRebuild" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/ad_canvas/rebuilds/{rebuild_id}:
    get:
      operationId: getAdRebuild
      x-ogen-operation-group: AdCanvas
      tags: [ad_canvas]
      summary: Reads a rebuild of a broken-down ad, with its rewritten scenes once it is rebuilt.
      description: |
        Returns the rebuild's brief and `state`. While it is `rebuilding`, `scenes` is empty; read it again in a few seconds. Once it is `rebuilt`, `scenes` holds one scene for each scene of the breakdown, in the order it plays, with the breakdown's `start_ms`, `end_ms` and `role` and the rewritten `words` and `shot`. Once it is `rebuilt`, `render` names the video Lucky Landing renders of it: read it with `getAdRenderVideo` once the render's `state` is `rendered`; a render whose `state` is `failed` has `failure` `render_failed` and no video. When it is `failed`, `failure` is `rebuild_failed`: Lucky Landing could not rewrite the scenes for the brief; ask for a new rebuild to try again. It changes nothing.
        Errors:
        - 404 `not_found`. No rebuild with this ID is in the org, or the caller can't read its store.
      security: [{ oauth: ["ad_canvas:read"] }, { api_key: [] }, { session: [] }]
      parameters: [{ $ref: "#/components/parameters/AdRebuildID" }]
      responses:
        "200": { description: Rebuild, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/AdRebuild" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/ad_canvas/rebuilds/{rebuild_id}/variants:
    post:
      operationId: createAdVariant
      x-ogen-operation-group: AdCanvas
      tags: [ad_canvas]
      summary: Makes a variant of a rebuilt ad that changes one thing, the hook, one scene's words or shot, or the style.
      description: |
        Send one change. `kind` `hook` rewrites the first scene's words, its shot or both; `words` rewrites the words of the scene at `scene`; `shot` rewrites the shot of the scene at `scene`; and `style` applies `style`, one of `claymation`, `singing` and `ai_ugc`, across the scenes, so it may rewrite any scene's words and shot. `scene` counts the scenes from 0 in the order they play; only `words` and `shot` take it, and only `style` takes `style`. `instruction`, up to 500 characters, says what the merchant wants from the change; leave it out to let Lucky Landing choose. Returns the variant with `state` `varying` and no scenes. Lucky Landing makes the change on its own, so read it with `getAdVariant` until `state` is `varied`, when `scenes` holds the rebuild's scenes with only that change made: as many scenes, in the same order, with the same times and roles, and only the part the change names rewritten. When the change comes back touching any other part, or touching nothing, the variant is `failed` instead. Once it is varied, Lucky Landing renders a video of it on its own, which its `render` names. Each call makes a new variant, so a retry after an answer that was lost leaves a second one for the same change.
        Errors:
        - 400 `invalid_field`, `errors[].pointer` naming the field. `scene` is missing for `words` or `shot`, sent for another kind, or past the last scene; `style` is missing for `style` or sent for another kind; or `instruction` is longer than 500 characters.
        - 404 `not_found`. No rebuild with this ID is in the org, or the caller can't change its store.
        - 409 `ad_canvas_parent_not_ready`. The rebuild is still rebuilding, or it failed, so it has no scenes to change.
        - 501 `not_implemented`. Lucky Landing has not turned a model on in this environment, so nothing was stored.
      security: [{ oauth: ["ad_canvas:write"] }, { api_key: [] }, { session: [] }]
      parameters: [{ $ref: "#/components/parameters/AdRebuildID" }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/AdVariantParams" } } } }
      responses:
        "200": { description: Varying, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/AdVariant" } } } }
        default: { $ref: "#/components/responses/Error" }
    get:
      operationId: listAdVariants
      x-ogen-operation-group: AdCanvas
      tags: [ad_canvas]
      summary: Lists a rebuild's tree of variants, newest first, without their scenes.
      description: |
        Returns a page of every variant made from this rebuild or from one of its variants, at any depth, newest first. Each has its `change`, its `state` and `parent_variant_id`: null for a variant made from the rebuild itself, and otherwise the variant it was made from, which is in the same tree. Read a variant's scenes with `getAdVariant`. It changes nothing.
        Errors:
        - 404 `not_found`. No rebuild with this ID is in the org, or the caller can't read its store.
      security: [{ oauth: ["ad_canvas:read"] }, { api_key: [] }, { session: [] }]
      parameters: [{ $ref: "#/components/parameters/AdRebuildID" }, { $ref: "#/components/parameters/Limit" }, { $ref: "#/components/parameters/AfterID" }, { $ref: "#/components/parameters/BeforeID" }]
      responses:
        "200": { description: Variants, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/AdVariantList" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/ad_canvas/variants/{variant_id}:
    get:
      operationId: getAdVariant
      x-ogen-operation-group: AdCanvas
      tags: [ad_canvas]
      summary: Reads a variant of a rebuilt ad, with its scenes once its one change is made.
      description: |
        Returns the variant's `change`, its parent and its `state`. While it is `varying`, `scenes` is empty; read it again in a few seconds. Once it is `varied`, `scenes` holds one scene for each scene of the breakdown, in the order it plays, with the breakdown's `start_ms`, `end_ms` and `role`, and the parent's `words` and `shot` except for the part the change rewrote. The parent is the variant `parent_variant_id` names, or the rebuild `rebuild_id` names when `parent_variant_id` is null. Once it is `varied`, `render` names the video Lucky Landing renders of it: read it with `getAdRenderVideo` once the render's `state` is `rendered`; a render whose `state` is `failed` has `failure` `render_failed` and no video. When it is `failed`, `failure` is `variant_failed`: Lucky Landing could not make the change, or its answer changed more than the change names or nothing at all; ask for the change again to try once more. It changes nothing.
        Errors:
        - 404 `not_found`. No variant with this ID is in the org, or the caller can't read its store.
      security: [{ oauth: ["ad_canvas:read"] }, { api_key: [] }, { session: [] }]
      parameters: [{ $ref: "#/components/parameters/AdVariantID" }]
      responses:
        "200": { description: Variant, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/AdVariant" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/ad_canvas/variants/{variant_id}/variants:
    post:
      operationId: createAdVariantOfVariant
      x-ogen-operation-group: AdCanvas
      tags: [ad_canvas]
      summary: Makes a variant of a variant that changes one more thing, a level deeper in the rebuild's tree.
      description: |
        Send one change. `kind` `hook` rewrites the first scene's words, its shot or both; `words` rewrites the words of the scene at `scene`; `shot` rewrites the shot of the scene at `scene`; and `style` applies `style`, one of `claymation`, `singing` and `ai_ugc`, across the scenes, so it may rewrite any scene's words and shot. `scene` counts the scenes from 0 in the order they play; only `words` and `shot` take it, and only `style` takes `style`. `instruction`, up to 500 characters, says what the merchant wants from the change; leave it out to let Lucky Landing choose. The new variant's parent is this variant: it starts from this variant's scenes, and it joins the same rebuild's tree. Returns the variant with `state` `varying` and no scenes. Lucky Landing makes the change on its own, so read it with `getAdVariant` until `state` is `varied`, when `scenes` holds this variant's scenes with only that change made: as many scenes, in the same order, with the same times and roles, and only the part the change names rewritten. When the change comes back touching any other part, or touching nothing, the variant is `failed` instead. Once it is varied, Lucky Landing renders a video of it on its own, which its `render` names. Each call makes a new variant, so a retry after an answer that was lost leaves a second one for the same change.
        Errors:
        - 400 `invalid_field`, `errors[].pointer` naming the field. `scene` is missing for `words` or `shot`, sent for another kind, or past the last scene; `style` is missing for `style` or sent for another kind; or `instruction` is longer than 500 characters.
        - 404 `not_found`. No variant with this ID is in the org, or the caller can't change its store.
        - 409 `ad_canvas_parent_not_ready`. The variant is still varying, or it failed, so it has no scenes to change.
        - 501 `not_implemented`. Lucky Landing has not turned a model on in this environment, so nothing was stored.
      security: [{ oauth: ["ad_canvas:write"] }, { api_key: [] }, { session: [] }]
      parameters: [{ $ref: "#/components/parameters/AdVariantID" }]
      requestBody: { required: true, content: { application/json: { schema: { $ref: "#/components/schemas/AdVariantParams" } } } }
      responses:
        "200": { description: Varying, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/AdVariant" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/ad_canvas/renders/{render_id}/video:
    get:
      operationId: getAdRenderVideo
      x-ogen-operation-group: AdCanvas
      tags: [ad_canvas]
      summary: Reads the video Lucky Landing rendered of a rebuild or a variant.
      description: |
        Returns the rendered video, base64-encoded in `video`, with `video_type`, `video/mp4` or `video/webm`. A rebuild's or variant's `render` names the render and its `state`; read the video once that `state` is `rendered`. Lucky Landing renders each rebuild and each variant on its own once it is rebuilt or varied, from its brief and its scenes: the rendered video is never the dropped-in ad. A render's video never changes. It changes nothing.
        Errors:
        - 404 `not_found`. No render with this ID is in the org, or the caller can't read its store.
        - 409 `ad_canvas_render_not_ready`. The render is still rendering, or it failed, so it has no video.
        - 501 `not_implemented`. Lucky Landing keeps no videos in this environment.
      security: [{ oauth: ["ad_canvas:read"] }, { api_key: [] }, { session: [] }]
      parameters: [{ $ref: "#/components/parameters/AdRenderID" }]
      responses:
        "200": { description: Video, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/AdRenderVideo" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/ad_canvas/rebuilds/{rebuild_id}/launches:
    post:
      operationId: createAdLaunch
      x-ogen-operation-group: AdCanvas
      tags: [ad_canvas]
      summary: Launches a rebuilt ad to the org's Meta ad account, every object paused and every Meta enhancement off.
      description: |
        Launches the rebuilt ad to the org's Meta ad account as a campaign, an ad set, a creative and an ad, each created `PAUSED`, so nothing spends until the merchant turns it on in Meta Ads Manager. Lucky Landing turns off what would change the ad it launches: the ad set takes no Advantage+ audience and only Facebook feed and Instagram stream placements, and the creative opts out of every Advantage+ creative enhancement, of multi-advertiser ads and of Meta's shop as a destination. Takes no body. The ad account is the org's Meta ad account connected first. Returns the launch with `state` `launching` and no Meta IDs. Lucky Landing makes each object on its own, finding one it already made by its name before it makes another, so read the launch with `getAdLaunch` until `state` is `launched`, when `campaign_id`, `ad_set_id`, `creative_id` and `ad_id` name the four objects, or `failed`, when `failure` says why. Lucky Landing records each object's ID as soon as Meta answers it, and checks each against what it sent before it makes the next; a failed launch has looked up each object it reached by its name, recorded its ID and paused it, and `unconfirmed` lists any it could not confirm paused. Each call makes a new launch with its own four objects.
        Errors:
        - 404 `not_found`. No rebuild with this ID is in the org, or the caller can't change its store.
        - 409 `ad_canvas_parent_not_ready`. The rebuild is still being made, or it failed, so it has nothing to launch.
        - 409 `ad_canvas_meta_not_connected`. The org has no connected Meta ad account, so there is nowhere to launch.
        - 501 `not_implemented`. Lucky Landing can't reach Meta in this environment, so nothing was stored.
      security: [{ oauth: ["ad_canvas:write"] }, { api_key: [] }, { session: [] }]
      parameters: [{ $ref: "#/components/parameters/AdRebuildID" }]
      responses:
        "200": { description: Launching, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/AdLaunch" } } } }
        default: { $ref: "#/components/responses/Error" }
    get:
      operationId: listAdLaunches
      x-ogen-operation-group: AdCanvas
      tags: [ad_canvas]
      summary: Lists the launches of a rebuild and of every variant in its tree, newest first.
      description: |
        Returns a page of every launch made from this rebuild or from one of its variants, newest first, each with its `state` and the Meta IDs made so far; `variant_id` is null for a launch of the rebuild itself. It asks Meta nothing and changes nothing.
        Errors:
        - 404 `not_found`. No rebuild with this ID is in the org, or the caller can't read its store.
      security: [{ oauth: ["ad_canvas:read"] }, { api_key: [] }, { session: [] }]
      parameters: [{ $ref: "#/components/parameters/AdRebuildID" }, { $ref: "#/components/parameters/Limit" }, { $ref: "#/components/parameters/AfterID" }, { $ref: "#/components/parameters/BeforeID" }]
      responses:
        "200": { description: Launches, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/AdLaunchList" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/ad_canvas/variants/{variant_id}/launches:
    post:
      operationId: createAdLaunchOfVariant
      x-ogen-operation-group: AdCanvas
      tags: [ad_canvas]
      summary: Launches a variant to the org's Meta ad account, every object paused and every Meta enhancement off, so its one change is what the ad tests.
      description: |
        Launches the variant to the org's Meta ad account as a campaign, an ad set, a creative and an ad, each created `PAUSED`, so nothing spends until the merchant turns it on in Meta Ads Manager. Lucky Landing turns off what would change the ad it launches: the ad set takes no Advantage+ audience and only Facebook feed and Instagram stream placements, and the creative opts out of every Advantage+ creative enhancement, of multi-advertiser ads and of Meta's shop as a destination. Takes no body. The ad account is the org's Meta ad account connected first. Returns the launch with `state` `launching` and no Meta IDs. Lucky Landing makes each object on its own, finding one it already made by its name before it makes another, so read the launch with `getAdLaunch` until `state` is `launched`, when `campaign_id`, `ad_set_id`, `creative_id` and `ad_id` name the four objects, or `failed`, when `failure` says why. Lucky Landing records each object's ID as soon as Meta answers it, and checks each against what it sent before it makes the next; a failed launch has looked up each object it reached by its name, recorded its ID and paused it, and `unconfirmed` lists any it could not confirm paused. Each call makes a new launch with its own four objects.
        Errors:
        - 404 `not_found`. No variant with this ID is in the org, or the caller can't change its store.
        - 409 `ad_canvas_parent_not_ready`. The variant is still being made, or it failed, so it has nothing to launch.
        - 409 `ad_canvas_meta_not_connected`. The org has no connected Meta ad account, so there is nowhere to launch.
        - 501 `not_implemented`. Lucky Landing can't reach Meta in this environment, so nothing was stored.
      security: [{ oauth: ["ad_canvas:write"] }, { api_key: [] }, { session: [] }]
      parameters: [{ $ref: "#/components/parameters/AdVariantID" }]
      responses:
        "200": { description: Launching, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/AdLaunch" } } } }
        default: { $ref: "#/components/responses/Error" }
  /v1/ad_canvas/launches/{launch_id}:
    get:
      operationId: getAdLaunch
      x-ogen-operation-group: AdCanvas
      tags: [ad_canvas]
      summary: Reads a launch to Meta, with the ID of each Meta object made so far.
      description: |
        Returns the launch's ad account and `state`. While it is `launching`, read it again in a few seconds; each Meta ID is null until Lucky Landing has made that object. Once it is `launched`, `campaign_id`, `ad_set_id`, `creative_id` and `ad_id` name the four objects, all paused in the ad account. When it is `failed`, `failure` is `launch_failed` when Meta refused part of the launch or its tries ran out, and `meta_not_connected` when the ad account was disconnected before the launch finished. Each object Meta made has its ID here and is paused, except the levels in `unconfirmed`: Lucky Landing could not confirm those paused, and one with a null ID may exist in the ad account under the launch's name. It asks Meta nothing and changes nothing.
        Errors:
        - 404 `not_found`. No launch with this ID is in the org, or the caller can't read its store.
      security: [{ oauth: ["ad_canvas:read"] }, { api_key: [] }, { session: [] }]
      parameters: [{ $ref: "#/components/parameters/AdLaunchID" }]
      responses:
        "200": { description: Launch, headers: { request-id: { $ref: "#/components/headers/RequestId" } }, content: { application/json: { schema: { $ref: "#/components/schemas/AdLaunch" } } } }
        default: { $ref: "#/components/responses/Error" }
components:
  x-luckylanding-problems:
    ad_canvas_not_enabled: { status: 403, title: "Ad Canvas is not turned on here", about: "Ad Canvas requires an organization grant and a model available in this environment.", retryable: false }
    ad_canvas_breakdown_not_ready: { status: 409, title: "Only a broken-down ad can be rebuilt", about: "The breakdown is still breaking down, or it failed, so it has no scenes to rebuild. Read the breakdown until its state is broken_down, or drop the ad in again if it failed; nothing was stored." }
    ad_canvas_meta_not_connected: { status: 409, title: "No Meta ad account is connected", about: "The org has no connected Meta ad account with a token, so there is nowhere to launch the ad. Connect the ad account, then launch again; nothing was stored." }
    ad_canvas_parent_not_ready: { status: 409, title: "The rebuild or variant isn't finished", about: "The rebuild or variant is still being made, or it failed, so it has no scenes to change or launch. Read it until its state is rebuilt or varied, or use another one if it failed; nothing was stored." }
    ad_canvas_render_not_ready: { status: 409, title: "The video isn't rendered", about: "The render is still rendering, or it failed, so it has no video to read. Read the rebuild or variant until its render's state is rendered; a failed render has no video." }
    ad_canvas_video_unreadable: { status: 400, title: "The file is not an MP4 or WebM video", about: "Ad Canvas reads an ad from an MP4 or WebM video file, and this file is neither, such as a QuickTime MOV file or an image. Export the ad as MP4 or WebM and drop it in again; nothing was stored." }
    product_change_pending: { status: 409, title: "The last change to this product is not on the bills yet", about: "Lucky Landing has not finished applying the last change to this product on its bills, so it can't be added again yet. Nothing was changed." }
    product_purchased: { status: 409, title: "The org pays for this product", about: "The org already pays for this product, added with the saved card or bought through a checkout link before products moved to the saved card, so a grant cannot replace it and it cannot be added again. Nothing was changed." }
    agent_authorization_failed: { status: 502, title: "The app could not be connected", about: "Sign-in worked, but the identity provider did not complete the agent's authorization. Start the connection again from the app.", retryable: false }
    already_member: { status: 409, title: "You already belong to this org", about: "The signed-in person is already a member of the org this invite names, so the invite changed nothing. An owner or admin changes a member's role on the Team screen." }
    api_key_not_allowed: { status: 403, title: "You can't make or revoke this API key", about: "Owners and admins make and revoke API keys, signed in to the dashboard. Sign in as one of them." }
    bad_arguments: { status: 400, title: "The tool arguments are invalid", about: "An MCP tool was called with arguments that are not a JSON object or do not match its input schema. Fix the arguments and call the tool again." }
    below_minimum_charge: { status: 409, title: "The total is under the smallest amount this checkout can charge", about: "The payment processor charges no less than a minimum amount, which detail names, so nothing was charged and no order was placed. The shopper adds to the order or contacts the store.", retryable: false }
    billing_rail_refused: { status: 502, title: "The billing rail refused the request", about: "The billing rail answered that it won't do this, so sending the same request again fails the same way. Nothing was changed. Contact support with the request_id.", retryable: false }
    body_required: { status: 400, title: "A JSON request body is required", about: "Send the operation's JSON body with Content-Type application/json." }
    cart_refused: { status: 422, title: "This cart can't be checked out here", about: "Lucky Landing won't take this store cart, so it stored nothing. Send the shopper to the store's own checkout, where the cart is intact." }
    catalog_import_conflict: { status: 409, title: "This catalog import cannot continue", about: "The import's store, source or cursor changed under it. Refresh the catalog setup and start a new import." }
    catalog_import_rejected: { status: 409, title: "The catalog import could not complete", about: "The checkout service refused the import. Review the store connection and the import status, then start a new import." }
    checkout_design_inaccessible: { status: 422, title: "Part of this design is hard to read or see", about: "Lucky Landing drew the design on its preview pages and its accessibility scan found text shoppers can't read or images they can't see. Nothing was published. Fix what errors names, then publish." }
    checkout_domain_exists: { status: 409, title: "This project already has a checkout hostname", about: "A project has one checkout hostname at a time. Release the current one, then claim the new one." }
    checkout_domain_invalid: { status: 400, title: "This hostname can't be a checkout hostname", about: "Use one label in front of a domain you own, such as checkout.yourstore.com or pay.yourstore.com. A bare domain, a public suffix, an IP address or a hostname under Lucky Landing's own checkout domain can't be used." }
    checkout_domain_not_ready: { status: 421, title: "This hostname does not serve checkout yet", about: "Lucky Landing has not verified this hostname's DNS records and certificate yet, or it was released. The merchant can see what is missing on the checkout domain screen." }
    checkout_domain_taken: { status: 409, title: "Another project holds this hostname", about: "Another Lucky Landing project has claimed this hostname. Ask its owner to release it, or use another hostname." }
    bill_unpaid: { status: 409, title: "A Lucky Landing bill or another product you added isn't paid yet", about: "This org owes a bill, or a product it added is waiting for its bill to be paid. Add another once the bill is paid, or the product's bill is paid or carried, or the product is taken off; nothing was changed." }
    billing_managed: { status: 409, title: "Lucky Landing's staff look after this org's bills", about: "Staff settle this org's bills and add its products, so nothing is charged or added with its saved card. Ask Lucky Landing's staff; nothing was changed." }
    billing_retire_refused: { status: 409, title: "This org still has billing to finish", about: "A product is still on or ends later, a change to one is not on the billing engine yet, a bill is open or carried, or the org was never on the billing engine, so its billing can't be retired yet. Cancel the products and settle the bills first; nothing was changed." }
    billing_retired: { status: 409, title: "This org is retired from Lucky Landing's bills", about: "Lucky Landing's staff retired this org from its billing engine, which can't be undone, so nothing is added or billed with its saved card. Ask Lucky Landing's staff; nothing was changed." }
    managed_bills_owed: { status: 409, title: "This org still owes bills its staff settle", about: "Staff settle a managed org's bills outside Lucky Landing, and Lucky Landing does not record which ones they settled, so handing the org back to its saved card would charge them again. Hand it back once none of its bills is open or carried; nothing was changed." }
    location_required: { status: 409, title: "Lucky Landing needs the billing address for sales tax", about: "The org has not given the country and postal code its card is billed in, so today's sales tax can't be worked out and the product can't be added. Save them in Billing, then add it; nothing was changed or charged." }
    card_terms_changed: { status: 409, title: "The card terms changed", about: "Lucky Landing changed the wording a person accepts before a product is charged to the saved card, so the version sent is not the one in force. Show the person the current terms and add again once they accept them; nothing was changed or charged." }
    card_billing_off: { status: 409, title: "Adding a product with the saved card isn't open yet", about: "Lucky Landing has not switched on adding products with a saved card here, so no product can be bought here yet. Ask Lucky Landing's staff to grant it; nothing was changed." }
    card_not_saved: { status: 409, title: "The billing rail has saved no card through this setup yet", about: "The person has not finished saving a card on the billing rail's page, or the rail has not recorded it yet. Ask again after a few seconds; nothing was changed." }
    card_required: { status: 409, title: "Save a card for Lucky Landing's bills first", about: "This org has no saved card to charge. Save one in Billing, then add the product; nothing was changed." }
    checkout_hero_image_unreadable: { status: 400, title: "The offer page can't use this image as its hero image", about: "Upload a PNG, JPEG, WebP or HEIC in a request of up to 12 MiB. An SVG, a GIF or an AVIF can't be used." }
    checkout_logo_unreadable: { status: 400, title: "The checkout can't use this image as its logo", about: "Upload a PNG, JPEG, WebP or HEIC of up to 1 MiB. An SVG, a GIF or an AVIF can't be used." }
    nothing_to_pay: { status: 409, title: "There is nothing to pay now", about: "This org owes no open bill: nothing is owed, or only bills under the billing rail's minimum charge, which join the next bill. Nothing was charged." }
    checkout_unavailable: { status: 502, title: "Checkout service unavailable", about: "The checkout page could not reach Lucky Landing. Check the payment status before trying again; never start a second payment.", retryable: false }
    code_rejected: { status: 401, title: "That code is wrong or has expired", about: "Check the emailed code and try again, or request a new one." }
    coming_soon: { status: 403, title: "Not available to this organization yet", about: "Lucky Landing is still testing this capability and hasn't turned it on for this organization. `connections_providers` lists it with `availability` `coming_soon`; nothing is wrong with the account.", retryable: false }
    connect_link_closed: { status: 409, title: "This connect link can no longer be opened", about: "It was already used or has expired. Start a new connection in Connections." }
    connect_link_found_nothing: { status: 409, title: "This connect link has no account to confirm", about: "Open the link and sign in at the provider, then confirm the account it finds." }
    connect_link_not_yours: { status: 403, title: "Only the person who requested this connect link can open it", about: "Ask them to open it, or start your own connection in Connections." }
    connection_owned_elsewhere: { status: 409, title: "This account is connected to another workspace", about: "Disconnect it in that Lucky Landing workspace first, then connect it here. Nothing was changed." }
    cross_origin_refused: { status: 403, title: "Cross-origin request refused", about: "Call the checkout API from the checkout page on its own hostname." }
    entitlement_not_purchased: { status: 409, title: "Staff granted this product", about: "A staff grant ends on its own date, so there is nothing to cancel. Nothing was changed." }
    closed_by_owner: { status: 409, title: "An owner closed this organization", about: "An owner of the organization closed it, so an owner undoes the closing in the dashboard. Nothing was changed." }
    erasure_requested: { status: 409, title: "This org's erasure is already requested", about: "An erasure of this org was requested earlier and is running or done. Read its progress instead of requesting it again. Nothing was changed." }
    fee_rate_exists: { status: 409, title: "A later fee rate exists", about: "A fee rate for this meter already starts after the effective start this rate would take. Send an effective_from that starts at the meter's latest rate's start, which replaces that rate before it begins, or after it. Nothing was changed." }
    no_order_to_place: { status: 409, title: "This payment has no order to place", about: "The payment was refunded or disputed, carried a buyer fee, or was the second of two payments for one checkout, so Lucky Landing places no order for it.", retryable: false }
    order_unconfirmed: { status: 409, title: "The store has not confirmed this payment's order", about: "Check the payment’s order_review and refundable fields. An unresolved store placement blocks the refund.", retryable: false }
    partial_refund_in_whop_case: { status: 409, title: "A partial refund would close this payment's Whop case", about: "Whop closes the shopper's Resolution Center case on any refund, so a partial refund here would end their case after part of their money. Refund everything that is left of the payment, or, to settle for less, settle it with the shopper in Whop.", retryable: false }
    payment_in_whop_case: { status: 409, title: "This payment has a Whop case", about: "A Whop Resolution Center case on this payment closed with the shopper winning or Whop paying them, closed without saying who paid, or shows as decided before Lucky Landing read it. A refund through Lucky Landing could pay the shopper twice, once by the refund and again by Whop's decision, so the merchant reads the case in Whop.", retryable: false }
    payment_not_refundable: { status: 409, title: "This payment can't be refunded", about: "The payment is not paid, or the shopper's bank has disputed it. A disputed payment is answered through the dispute, not a refund.", retryable: false }
    refund_in_progress: { status: 409, title: "An earlier refund of this payment is not confirmed yet", about: "Lucky Landing sent a refund of this payment and the processor has neither confirmed nor failed it. Lucky Landing sends no other refund of the payment until it has, and its staff are alerted when one stays unconfirmed.", retryable: false }
    refund_in_review: { status: 409, title: "A refund of this payment needs a person", about: "The processor shows a refund, this one or an earlier one Lucky Landing asked for, that doesn't match what Lucky Landing asked, so Lucky Landing refunds nothing more on this payment until a person has checked it. The payment shows what was refunded.", retryable: false }
    refund_not_made: { status: 409, title: "The refund was not made", about: "The processor refused the refund, or Lucky Landing could not ask it, and nothing was refunded. Try again; if it keeps failing, look at the payment in Whop.", retryable: false }
    refund_total_invalid: { status: 400, title: "The refunded total doesn't fit the payment", about: "The total asked for is below what the payment already has refunded, above its amount, or in another currency. Send the total the payment should have refunded after the call.", retryable: false }
    whop_reapproval_required: { status: 409, title: "Whop needs your approval before Lucky Landing can refund", about: "Refunds need a permission your Whop company has not approved for Lucky Landing's app. In Whop, open Dashboard, Settings, Authorized apps and press Re-approve beside Lucky Landing. Charges keep working meanwhile.", retryable: false }
    order_not_sent: { status: 409, title: "Lucky Landing did not send the order to the store", about: "Lucky Landing could not prepare the order again, so the store was not asked. The payment is back in review for a person.", retryable: false }
    parent_order_unplaced: { status: 409, title: "This payment's order waits on another payment's order", about: "The payment is an upsell that adds to an earlier payment's order, and the store has not taken that order. Try that payment's order again first.", retryable: false }
    payment_changed: { status: 409, title: "The payment changed while Lucky Landing was working on it", about: "Something else changed the payment after Lucky Landing read it, so nothing was done. Read the payment again before deciding what to do.", retryable: false }
    offer_below_minimum_charge: { status: 422, title: "This offer is priced under the smallest charge the processor takes", about: "A post-purchase offer is charged by itself, and the payment processor refuses a charge under its minimum, so no shopper could buy this offer. Raise its price to the minimum or more, before tax, and publish it again.", retryable: false }
    store_order_unrecognised: { status: 400, title: "That isn't a store order", about: "Send the order's ID, or the address of its page in the store's admin.", retryable: false }
    store_order_unreadable: { status: 409, title: "The store returns no order with this ID", about: "The order may not exist, may have been deleted, or may be older than the 60 days a store's app can read. Check the order in the store. Nothing was changed.", retryable: false }
    store_order_cancelled: { status: 409, title: "That order is cancelled in the store", about: "Record an order that is in effect. Nothing was changed.", retryable: false }
    store_order_from_lucky_landing: { status: 409, title: "Lucky Landing wrote that order", about: "An order Lucky Landing wrote belongs to the purchase it was written for. If it is this payment's, try the order again, which finds it. Nothing was changed.", retryable: false }
    store_order_taken: { status: 409, title: "Another payment already holds that order", about: "One store order is recorded for one payment. Check which payment the order belongs to. Nothing was changed.", retryable: false }
    store_order_currency: { status: 409, title: "That order is in another currency than the payment", about: "Record the order made for this payment. Nothing was changed.", retryable: false }
    order_not_in_review: { status: 409, title: "This payment isn't waiting for a person", about: "Its order is already in the store, or Lucky Landing is placing it now. Read the payment again. Nothing was changed.", retryable: false }
    order_still_placeable: { status: 409, title: "Lucky Landing can still place this payment's order", about: "The payment's order can still be placed, so its review ends when the store has the order. Try the order again, or record the order you made in the store. Nothing was changed.", retryable: false }
    not_placed_by_hand: { status: 409, title: "No order placed by hand is recorded for this payment", about: "There is nothing to undo. Nothing was changed.", retryable: false }
    refunded_since_placed_by_hand: { status: 409, title: "This payment was refunded or disputed after its order was recorded", about: "A payment refunded or disputed, or with a refunded upsell joined to its order, doesn't go back to review, because no order could be placed for it again. Nothing was changed.", retryable: false }
    order_search_continues: { status: 409, title: "The store order may already exist", about: "Check the payment’s order_review. Lucky Landing keeps searching for a lost_reply. For placement_unconfirmed, check the store again using payments_retry_order. An empty search leaves the order in review.", retryable: false }
    free_order_in_wallet: { status: 409, title: "A free order is placed from the form, not a wallet", about: "The store prices this order at zero, so there is nothing for a wallet to pay and nothing was asked of the payment processor. The shopper closes the wallet and places the order with the form.", retryable: false }
    email_refused: { status: 400, title: "The store can't use this email address", about: "The store refused the shopper's email when it priced the order, typically because the email's domain doesn't exist, as with a mistyped ending such as .con. Nothing was charged and nothing was placed. The shopper corrects the email in the contact step and continues.", retryable: false }
    email_required: { status: 409, title: "The shopper's email is needed first", about: "An order is priced and placed only once the checkout has the shopper's email, which the store sends the receipt to. Save it with the contact step, then try again; nothing was priced, placed or charged.", retryable: false }
    name_refused: { status: 400, title: "Names can't include emoji", about: "The store refused the shopper's name when it priced the order, because its given or family name has an emoji. Nothing was charged and nothing was placed. The shopper changes the name and continues.", retryable: false }
    generation_conflict: { status: 409, title: "This payment generation cannot be changed", about: "The payment generation already moved on. Recover its existing status before trying again; never begin another payment." }
    id_reused: { status: 409, title: "This ID was already used with different values", about: "IDs make writes idempotent: the same ID with different values is refused. Use a new ID for a different request." }
    identity_unavailable: { status: 503, title: "Sign-in is temporarily unavailable", about: "The identity provider did not answer. Retry in a few seconds.", retry_after: 5 }
    impersonation_not_allowed: { status: 403, title: "Impersonated sessions cannot use Lucky Landing", about: "Sign in as yourself." }
    insufficient_scope: { status: 403, title: "The token lacks the required scope", about: "The token is valid but its scopes include none of those this operation takes, named in required_scope, any one of which lets it in. Ask an owner for a token with one of them." }
    internal: { status: 500, title: "Internal error", about: "Lucky Landing failed while handling the request. Retry; if it persists, contact support with the request_id." }
    invalid_body: { status: 400, title: "The request body is invalid", about: "The body is not valid JSON for this operation, has unknown or mistyped fields, or has text that cannot be stored: invalid UTF-8, a NUL character or an unpaired surrogate escape. Check it against the API reference." }
    invalid_checkout_request: { status: 400, title: "The checkout request is invalid", about: "The checkout request does not match the session or quote it names. Start from the offer again." }
    invalid_code: { status: 400, title: "A code is six digits", about: "Enter the six digits without spaces." }
    invalid_design: { status: 422, title: "Some design fields are invalid", about: "Read the file or host setting identified by the error, correct its source, then retry against the current draft revision." }
    invalid_email: { status: 400, title: "That is not an email address", about: "Check the email address and try again." }
    invalid_field: { status: 400, title: "A field is invalid", about: "A field of the request, or of the saved draft it publishes, failed validation; errors names it with a JSON Pointer. Fix the field and retry." }
    invalid_offer_draft: { status: 400, title: "The offer draft is invalid", about: "Review the offer details, products, hostname and deadline." }
    invalid_page: { status: 400, title: "Invalid page request", about: "Use limit between 1 and 1000 and one cursor (after_id or before_id) from a previous page." }
    invalid_parameter: { status: 400, title: "A parameter is invalid", about: "A path, query or header parameter failed validation; errors names it. Fix the parameter and retry." }
    invalid_request: { status: 400, title: "The request could not be read", about: "Check the request against the API reference." }
    invalid_store: { status: 400, title: "A valid store is required", about: "Send the store_id of a store this org has connected." }
    invite_not_found: { status: 404, title: "This invite cannot be used", about: "No invite matches this link, or no pending one does for the address you are signed in with: it expired, was revoked or already used, or it was sent to another address. Ask an owner or admin of the org for a new invite." }
    invite_required: { status: 403, title: "Lucky Landing is invite-only for now", about: "Ask us for an invite, or join the waitlist on luckylanding.io." }
    event_destination_required: { status: 409, title: "This connection sends no checkout events", about: "Use a connected Meta pixel, TikTok pixel or GA4 stream in this project with its token or secret saved." }
    google_tag_connected: { status: 409, title: "Another Google tag of this kind is connected", about: "A project reports to one Google Ads conversion and one GA4 stream. Disconnect the connected one in Checkout, under Tracking, then connect the new one." }
    meta_ad_account_refused: { status: 422, title: "This token can't use that ad account", about: "Meta doesn't let the system-user token read the ad account, or the account isn't active. Check the ad account's ID, that it is active, and that the system user is assigned to it; nothing was stored." }
    meta_terms_not_accepted: { status: 409, title: "The organization hasn't accepted the terms Meta requires", about: "Meta requires a provider using a merchant's system-user token to have the merchant accept its terms first. The organization hasn't accepted them, so nothing was stored." }
    meta_token_refused: { status: 422, title: "Meta refused this system-user token", about: "Meta didn't accept the token, for example because it is mistyped, expired or revoked. Check it in Meta Business Settings and paste it again; nothing was stored." }
    last_staff_admin: { status: 409, title: "Staff always keep one person who manages staff", about: "This change would leave no Lucky Landing staff person able to manage staff. Give another staff person that scope first. Nothing was changed." }
    last_owner: { status: 409, title: "An org always keeps one owner", about: "This change would leave the org without an owner. Make another member an owner first." }
    login_expired: { status: 400, title: "This sign-in attempt has expired", about: "The sign-in attempt expired or was started in another browser. Start again from /sign-in." }
    merchant_read_rejected: { status: 403, title: "This data is not available to these credentials", about: "The checkout service refused to read this store's data for these credentials. Check the store connection and the token's org." }
    method_not_allowed: { status: 405, title: "Method not allowed", about: "GET reads and POST writes. Updates are POST /v1/<resource>/{id}; actions are POST /v1/<resource>/{id}/<action>. The Allow header lists the methods." }
    method_required: { status: 403, title: "Your organization requires another sign-in method", about: "Use the sign-in method your organization chose." }
    not_found: { status: 404, title: "Resource not found", about: "Nothing with this ID exists in the org you are acting for. Check the ID and the org." }
    not_implemented: { status: 501, title: "Not available yet", about: "This operation or option is not built yet.", retryable: false }
    not_on_sale: { status: 409, title: "This is not on sale yet", about: "The product has no price in effect for this org that it can be sold at, neither a price of its own nor a list price, so there is nothing to buy. Nothing was changed." }
    offer_not_republishable: { status: 409, title: "This offer can't be republished as it is", about: "Republishing reuses a live offer whose store changed currency. This one isn't live in another currency, or its draft has edits that aren't live: review it and publish it from the editor." }
    offer_publication_rejected: { status: 409, title: "The offer could not be published", about: "The checkout service refused the offer for these store bindings. Check the catalog and the provisioned store access." }
    order_terms_unavailable: { status: 400, title: "The basket cannot be bought with these terms", about: "No payment was requested. Review the delivery details or contact the store." }
    org_closed: { status: 403, title: "This organization is closed", about: "An owner or Lucky Landing closed the organization. Until it is deleted, at the time `detail` names, only its owners can sign in to it, to undo an owner's closing in the dashboard; its API keys, connected apps and other members can't use it, and its checkout takes no payments. Nothing was changed.", retryable: false }
    org_required: { status: 403, title: "This operation acts for an org", about: "Create or select an org first." }
    outcome_unknown: { status: 503, title: "The write may have finished", about: "Lucky Landing could not confirm the write. Read the resource before you retry: a retried create can make a second one.", retryable: false }
    outreach_draft_decided: { status: 409, title: "The draft was already decided", about: "The draft was approved, rejected or refused, so it can't be decided another way. List the conversation's drafts to see its state." }
    outreach_flow_exists: { status: 409, title: "This store already has this flow", about: "Each store has one flow per trigger. Update the existing flow; listOutreachFlows returns it." }
    outreach_invalid_setup: { status: 422, title: "Some setup fields are invalid", about: "errors points at each invalid field. Fix them and save again." }
    outreach_not_enabled: { status: 403, title: "Customer Connect is not turned on for this org", about: "This org is not on the Customer Connect allowlist. Only Lucky Landing staff can add it, so retrying will not help.", retryable: false }
    outreach_persona_in_use: { status: 409, title: "The persona is in use", about: "A flow still uses this persona. Remove it from persona_weights in every flow, then delete it." }
    outreach_sends_unavailable: { status: 409, title: "Sending is not available", about: "A flow cannot be turned on until sending is enabled for this org. Save it with enabled false." }
    payment_status_unknown: { status: 503, title: "The payment state is not yet confirmed", about: "Recover this payment generation; do not begin another payment. A Retry-After on this answer is the wait the processor's rate limit asked for before the recovery can read the payment.", retryable: false }
    person_required: { status: 403, title: "Only a person can do this", about: "Sign in as a person; an agent or API token cannot do this." }
    project_changed: { status: 409, title: "The dashboard project changed", about: "The session and the displayed project differ. Sign out and sign in again to return to the default project." }
    precondition_failed: { status: 412, title: "The resource changed after you read it", about: "Another write changed it after you read its etag, so this write changed nothing. Reload it, reapply your change and retry with its new etag in If-Match." }
    precondition_required: { status: 428, title: "If-Match is required", about: "This write changes a resource other clients can also change. Read it, then send its etag in If-Match." }
    prerender_refused: { status: 403, title: "Not allowed while prerendering", about: "Wait for the prerenderingchange event before calling the checkout API." }
    price_exists: { status: 409, title: "This price already exists", about: "The product already has a price for this currency and interval from the same moment. Send a different effective_from. Nothing was changed." }
    processor_busy: { status: 429, title: "The payment processor is busy", about: "The processor's rate limit refused Lucky Landing's call before acting on it, so nothing was charged. Wait the Retry-After interval, then try again.", retry_after: 60 }
    processor_unreachable: { status: 503, title: "The payment processor couldn't be reached", about: "Lucky Landing couldn't reach the payment processor before it sent the charge, so the charge was never sent and nothing was charged. Try again in a moment.", retry_after: 5 }
    quote_expired: { status: 410, title: "This price quote expired", about: "Prepare a new quote before accepting." }
    rate_limited: { status: 429, title: "Too many attempts", about: "Wait the Retry-After interval, then try again.", retry_after: 60 }
    request_too_large: { status: 413, title: "Request body too large", about: "The body is larger than this endpoint accepts; detail gives the limit." }
    role_not_allowed: { status: 403, title: "Your role in the org does not allow this", about: "The caller's role in the org does not allow this action, and `detail` says why. Ask an owner or an admin of the org to do it or to change your role." }
    sign_in_failed: { status: 401, title: "Sign-in failed", about: "Sign in with an emailed code or with Google." }
    sold_out: { status: 409, title: "An item in this basket is sold out", about: "The store has too few left of an item and does not sell it out of stock, so nothing was charged. Contact the store or choose another item." }
    staff_address_ambiguous: { status: 409, title: "More than one person signed in with this address", about: "Several people have signed in with this verified address, so it names no one staff person. Nothing was changed." }
    staff_address_not_lucky_landing: { status: 403, title: "Staff scopes go only to a Lucky Landing address", about: "The staff console gives staff scopes only to an address on Lucky Landing's own domain. Revoking works for any address. Nothing was changed." }
    staff_not_signed_in: { status: 409, title: "No one has signed in with this address yet", about: "Staff scopes go to a person who has signed in with a verified address. Ask them to sign in to the staff console once, then try again. Nothing was changed." }
    staff_required: { status: 403, title: "Only Lucky Landing staff can do this", about: "The staff API is for Lucky Landing staff." }
    staff_scope_not_held: { status: 403, title: "You can only give or take away staff scopes you hold", about: "A staff person changes another staff person's scopes only within their own. Ask a staff person who holds the scope. Nothing was changed." }
    store_access_denied: { status: 403, title: "This store is not available to these credentials", about: "The token or session cannot act on this store. Check the store_id and the org." }
    processor_environment_unavailable: { status: 409, title: "Payment connection needs verification", about: "Verify the selected Shopify installation and connect the processor account from the matching environment.", retryable: false }
    shopify_development_store_required: { status: 409, title: "A Shopify development store is required", about: "Choose a Shopify development store for this sandbox checkout.", retryable: false }
    store_unavailable: { status: 409, title: "This store isn't taking orders here right now", about: "No active connection of the store and its payment processor matches this checkout, for example because one needs its merchant to connect again or the store changed currency, so the checkout takes no order (CHK-R16, CONN-R9). Try again later, or contact the store.", retryable: false }
    too_many_codes: { status: 401, title: "Too many wrong codes", about: "Start again from /sign-in." }
    too_many_declines: { status: 429, title: "Too many payment attempts", about: "Too many recent payment attempts for this checkout. Wait a few minutes before trying again, or contact the store.", retry_after: 600 }
    totp_required: { status: 401, title: "Two-step verification is required", about: "Set up an authenticator app (TOTP) when you sign in to Lucky Landing, then sign in again." }
    transaction_denied: { status: 403, title: "These credentials may not run this transaction", about: "Ask an owner for a token with the required scope for this org." }
    txn_token_required: { status: 401, title: "A Txn-Token is required", about: "Internal routes accept only a Txn-Token for the operation they serve." }
    unauthorized: { status: 401, title: "Authentication required", about: "Send a valid bearer token, or sign in again." }
    unavailable: { status: 503, title: "Temporarily unavailable", about: "A service Lucky Landing depends on did not answer. Retry in a few seconds.", retry_after: 5 }
    unknown_org: { status: 400, title: "That organization is not one of your choices", about: "Pick one of the organizations listed." }
    unknown_provider: { status: 400, title: "Unknown sign-in provider", about: "Use google." }
    unsupported_media_type: { status: 415, title: "Unsupported media type", about: "Send the body with a Content-Type this endpoint accepts; detail names them." }
    unsupported_next_offer: { status: 400, title: "A landing page has no offer after No thanks", about: "Remove the offer shown after No thanks, or change the placement to After purchase before publishing." }
    google_places_connection_required: { status: 409, title: "This isn't the org's Google key", about: "Only the org's Google key for address suggestions, a google_places connection that isn't being disconnected, can be tested. List the connections to find it." }
    processor_connection_required: { status: 409, title: "This isn't an active processor connection", about: "Only an active processor connection, such as Whop, has a tax setting and buyer fee to check. Get the connection to see its provider and status." }
    waitlist_request_not_found: { status: 404, title: "This link can't confirm a request", about: "No early-access request matches this link, or a newer email replaced it. Use the link in the newest email from Lucky Landing, or ask for early access again on luckylanding.io." }
    workload_not_allowed: { status: 403, title: "This workload may not call this service", about: "Only the workloads this service trusts may call it." }
    wrong_step: { status: 409, title: "This sign-in is waiting for another step", about: "Reload the page to see the current step." }
  securitySchemes:
    session:
      type: apiKey
      in: cookie
      name: __Host-Http-luckylanding_session
      description: Opaque, short-lived HttpOnly dashboard access cookie, set after Lucky Landing sign-in and TOTP and renewed by POST /auth/refresh. Mutation requests require an allowed browser origin.
    oauth:
      type: oauth2
      description: OAuth 2.1 with PKCE from WorkOS AuthKit, the authorization server that this API's protected resource metadata (RFC 9728) names; clients register with Client ID Metadata Documents. Tokens are bound to one resource (RFC 8707).
      oauth2MetadataUrl: https://auth.luckylanding.io/.well-known/oauth-authorization-server
      flows:
        authorizationCode:
          authorizationUrl: https://auth.luckylanding.io/oauth2/authorize
          tokenUrl: https://auth.luckylanding.io/oauth2/token
          refreshUrl: https://auth.luckylanding.io/oauth2/token
          scopes:
            org:read: Read the org
            org:write: Rename the org
            billing:read: Read prices, entitlements, the saved card, what is owed, bills and account credit
            billing:money: Add a product charged to the saved card, cancel bought products, pay what is owed, and create card setup links and record the card saved through one
            connections:read: Read connections
            connections:write: Create connect links, connect a Meta pixel and paste, replace or remove its token, read processor settings again, disconnect
            pixel:read: Read pixels and event health
            payments:read: Read payments
            payments:write: Try again to place the store order of a paid payment that has none
            payments:money: Refund a payment
            checkout:read: Read checkout settings, authorized stores and configured catalog data
            checkout:write: Save and publish checkout designs and authorized offers
            ad_canvas:read: Read Ad Canvas breakdowns of video ads
            ad_canvas:write: Drop a video ad into Ad Canvas, rebuild and vary it, and launch it paused to Meta
            outreach:read: Read Customer Connect setup, conversations, their drafts, alerts and the lifetime draft budget (the org must be on the Customer Connect allowlist)
            outreach:write: Change Customer Connect personas, product choices, flows and the lifetime draft budget, delete conversations and dismiss alerts, and, for a person signed in to the dashboard only, approve or reject drafts; nothing is sent
    api_key:
      type: http
      scheme: bearer
      description: A Lucky Landing API key, made in the dashboard or with `createKey`, in the same Authorization Bearer header as oauth. It belongs to one org and acts there within its scopes, whoever made it.
  headers:
    ETag:
      description: Strong validator for this representation (RFC 9110).
      schema: { type: string }
    RequestId:
      description: Unique ID for this request; include it when contacting support.
      schema: { type: string }
    RetryAfter:
      description: Seconds to wait before retrying (RFC 9110). Every retryable 429 and 503 sets it; the catalogue's retry_after is the default.
      schema: { type: integer, minimum: 0 }
  parameters:
    CheckoutVersionState: { name: state, in: query, schema: { type: string, enum: [live] }, description: Return only the version shoppers enter now. }
    SupportViewID: { name: view_id, in: path, required: true, schema: { type: string, pattern: "^support_view_[0-7][0-9a-hjkmnp-tv-z]{25}$" } }
    IfMatch:
      name: If-Match
      in: header
      description: "Send the current etag. Missing returns 428. A stale etag returns 412. Reread before retrying."
      schema: { type: string, maxLength: 64 }
    CheckoutCatalogImportID: { name: import_id, in: path, required: true, schema: { type: string, pattern: "^catalog_import_[0-7][0-9a-hjkmnp-tv-z]{25}$" } }
    CheckoutDesignDraftName: { name: name, in: query, required: true, schema: { type: string, minLength: 1, maxLength: 100, pattern: "^[^\\x00]+$" } }
    CheckoutDesignDraftID: { name: draft_id, in: path, required: true, schema: { type: string, pattern: "^design_draft_[0-7][0-9a-hjkmnp-tv-z]{25}$" } }
    CheckoutDraftID: { name: draft_id, in: path, required: true, schema: { type: string, pattern: "^offer_draft_[0-7][0-9a-hjkmnp-tv-z]{25}$" } }
    PaymentID: { name: payment_id, in: path, required: true, schema: { type: string, pattern: "^payment_[0-7][0-9a-hjkmnp-tv-z]{25}$" } }
    ProcessorStoreQuery: { name: store_id, in: query, required: false, schema: { type: string, pattern: "^store_[0-7][0-9a-hjkmnp-tv-z]{25}$" }, description: "Store for this Whop connection." }
    CheckoutStoreQuery: { name: store_id, in: query, required: true, schema: { type: string, pattern: "^store_[0-7][0-9a-hjkmnp-tv-z]{25}$" } }
    CheckoutOfferID:
      name: offer_id
      in: path
      required: true
      schema: { type: string, pattern: "^offer_[0-7][0-9a-hjkmnp-tv-z]{25}$" }
    CheckoutSessionID: { name: session_id, in: path, required: true, schema: { type: string, pattern: "^checkout_session_[0-7][0-9a-hjkmnp-tv-z]{25}$" } }
    Limit: { name: limit, in: query, description: "Page size. A list answers one page, and `has_more` is true while more follow.", schema: { type: integer, minimum: 1, maximum: 1000, default: 20 } }
    AfterID: { name: after_id, in: query, description: "A page's `last_id`, for the next page.", schema: { type: string, maxLength: 64 } }
    BeforeID: { name: before_id, in: query, description: "A page's `first_id`, for the previous page; not with `after_id`.", schema: { type: string, maxLength: 64 } }
    PaymentState: { name: state, in: query, description: "`waiting_for_person` returns only the payments whose `order_review` is set; `dispute_needs_response` only the payments with a dispute whose `status` is `needs_response` or `warning_needs_response`", schema: { type: string, enum: [waiting_for_person, dispute_needs_response] } }
    PeriodFrom: { name: from, in: query, required: true, description: "Start of the period, included", example: "2026-01-01T00:00:00Z", schema: { type: string, format: date-time } }
    PeriodTo: { name: to, in: query, required: true, description: "End of the period, left out", example: "2026-01-02T00:00:00Z", schema: { type: string, format: date-time } }
    OrgID: { name: org_id, in: path, required: true, schema: { type: string, pattern: "^org_[0-7][0-9a-hjkmnp-tv-z]{25}$" } }
    PersonID: { name: person_id, in: path, required: true, schema: { type: string, pattern: "^person_[0-7][0-9a-hjkmnp-tv-z]{25}$" } }
    InviteID: { name: invite_id, in: path, required: true, schema: { type: string, pattern: "^invite_[0-7][0-9a-hjkmnp-tv-z]{25}$" } }
    InviteToken: { name: Invite-Token, in: header, required: true, description: "The token from the invite link. A header carries it, so no URL, and no access log of one, holds it.", schema: { type: string } }
    AgentGrantID: { name: agent_grant_id, in: path, required: true, schema: { type: string, pattern: "^agent_grant_[0-7][0-9a-hjkmnp-tv-z]{25}$" } }
    ApiKeyID: { name: api_key_id, in: path, required: true, schema: { type: string, pattern: "^api_key_[0-7][0-9a-hjkmnp-tv-z]{25}$" } }
    ConnectionID: { name: connection_id, in: path, required: true, schema: { type: string, pattern: "^connection_[0-7][0-9a-hjkmnp-tv-z]{25}$" } }
    GoogleAdsDestination: { name: send_to, in: query, schema: { type: string, pattern: "^AW-[1-9][0-9]{4,18}/[A-Za-z0-9_-]{1,64}$" }, description: "For Google Ads, the purchase destination selected from google_ads_actions." }
    GoogleMeasurementID: { name: measurement_id, in: query, schema: { type: string, pattern: "^G-[A-Z0-9]{4,20}$" }, description: "For Google, the GA4 web stream the person selected from google_streams." }
    ConnectLinkID: { name: connect_link_id, in: path, required: true, schema: { type: string, pattern: "^connect_link_[0-7][0-9a-hjkmnp-tv-z]{25}$" } }
    CardSetupID: { name: card_setup_id, in: path, required: true, schema: { type: string, pattern: "^card_setup_[0-7][0-9a-hjkmnp-tv-z]{25}$" } }
    EntitlementID: { name: entitlement_id, in: path, required: true, schema: { type: string, pattern: "^entitlement_[0-7][0-9a-hjkmnp-tv-z]{25}$" } }
    BillingProduct: { name: product, in: query, required: true, schema: { type: string, enum: [pixel, checkout, ad_canvas, customer_connect] }, description: "The product an add would put on" }
    OutreachPersonaID: { name: persona_id, in: path, required: true, schema: { type: string, pattern: "^persona_[0-7][0-9a-hjkmnp-tv-z]{25}$" } }
    AdRebuildID: { name: rebuild_id, in: path, required: true, schema: { type: string, pattern: "^ad_rebuild_[0-7][0-9a-hjkmnp-tv-z]{25}$" } }
    AdLaunchID: { name: launch_id, in: path, required: true, schema: { type: string, pattern: "^ad_launch_[0-7][0-9a-hjkmnp-tv-z]{25}$" } }
    AdRenderID: { name: render_id, in: path, required: true, schema: { type: string, pattern: "^ad_render_[0-7][0-9a-hjkmnp-tv-z]{25}$" } }
    AdVariantID: { name: variant_id, in: path, required: true, schema: { type: string, pattern: "^ad_variant_[0-7][0-9a-hjkmnp-tv-z]{25}$" } }
    AdBreakdownID: { name: breakdown_id, in: path, required: true, schema: { type: string, pattern: "^ad_breakdown_[0-7][0-9a-hjkmnp-tv-z]{25}$" } }
    OutreachFlowID: { name: flow_id, in: path, required: true, schema: { type: string, pattern: "^flow_[0-7][0-9a-hjkmnp-tv-z]{25}$" } }
    OutreachStoreID: { name: store_id, in: path, required: true, schema: { type: string, pattern: "^store_[0-7][0-9a-hjkmnp-tv-z]{25}$" } }
    OutreachProductID: { name: product_id, in: path, required: true, description: "The Shopify product ID", schema: { type: string, pattern: "^[1-9][0-9]{0,18}$" } }
    OutreachConversationID: { name: conversation_id, in: path, required: true, schema: { type: string, pattern: "^conversation_[0-7][0-9a-hjkmnp-tv-z]{25}$" } }
    OutreachDraftID: { name: outreach_draft_id, in: path, required: true, schema: { type: string, pattern: "^draft_[0-7][0-9a-hjkmnp-tv-z]{25}$" } }
    OutreachAlertID: { name: alert_id, in: path, required: true, schema: { type: string, pattern: "^alert_[0-7][0-9a-hjkmnp-tv-z]{25}$" } }
    OutreachConversationState: { name: state, in: query, description: "Only conversations in this state", schema: { type: string, enum: [automated, waiting_for_person, taken_over, closed] } }
  responses:
    Error:
      description: An RFC 9457 problem
      headers:
        request-id: { $ref: "#/components/headers/RequestId" }
        retry-after: { $ref: "#/components/headers/RetryAfter" }
      content: { application/problem+json: { schema: { $ref: "#/components/schemas/Problem" } } }
    SetupStatus:
      description: OK
      headers: { request-id: { $ref: "#/components/headers/RequestId" } }
      content: { application/json: { schema: { $ref: "#/components/schemas/SetupStatus" } } }
  schemas:
    SupportActionResult:
      type: object
      required: [type, ok]
      properties:
        type: { type: string, const: support_action_result }
        ok: { type: boolean }
    SupportView:
      type: object
      required: [type, id, org_id, project_id, member_id, staff_id, reason, state, expires_at]
      properties:
        type: { type: string, const: support_view }
        id: { type: string }
        org_id: { type: string }
        project_id: { type: string }
        member_id: { type: string }
        staff_id: { type: string }
        org_name: { type: string }
        project_name: { type: string }
        member_name: { type: string }
        staff_name: { type: string }
        reason: { type: string }
        state: { type: string, x-luckylanding-known-values: [read_only, edit_requested, edit_approved] }
        expires_at: { type: string, format: date-time }
    MerchantSupportAccess:
      type: object
      required: [type, allow, views]
      properties:
        type: { type: string, const: merchant_support_access }
        allow: { type: boolean }
        views: { type: array, items: { $ref: "#/components/schemas/SupportView" } }
    SupportPreference:
      type: object
      additionalProperties: false
      required: [allow]
      properties:
        allow: { type: boolean }
    CheckoutOfferContent:
      type: object
      additionalProperties: false
      required: [brand_name, description, terms, button_label, accent_color, logo_url, hero_image_url]
      properties:
        brand_name: { type: string, maxLength: 80 }
        description: { type: string, maxLength: 2000 }
        terms: { type: string, maxLength: 2000 }
        button_label: { type: string, minLength: 1, maxLength: 40 }
        accent_color: { type: string, pattern: "^#[0-9a-fA-F]{6}$" }
        logo_url: { type: string, maxLength: 2000, pattern: "^(https://[^\\s\"'<>]+)?$", description: "The offer's logo: the `url` that `checkout_upload_logo` returned for an image this org uploaded, or empty for none. A draft with a link outside this org's uploads is refused." }
        hero_image_url: { type: string, maxLength: 2000, pattern: "^(https://[^\\s\"'<>]+)?$", description: "The offer's hero image, drawn 4:3 above its description: the `url` that `checkout_upload_hero_image`, or `checkout_upload_logo`, returned for an image this org uploaded, or empty for none. A draft with a link outside this org's uploads is refused." }
        show_countdown: { type: boolean, description: "For a landing offer: whether its pages count down to `expires_at`, the end after which LL refuses to start, price or charge it, the same end for every shopper. Off when absent. An after-purchase offer is refused with it on, since its window is the hold on the order it follows, which the payment page always counts down." }
    CheckoutOfferDraftInput:
      type: object
      additionalProperties: false
      required: [hostname, title, placement, upsell_offer_id, lines, expires_at, content]
      properties:
        hostname: { type: string, maxLength: 253 }
        title: { type: string, minLength: 1, maxLength: 200 }
        placement: { type: string, x-luckylanding-known-values: [landing, post_purchase] }
        upsell_offer_id: { type: string, pattern: "^(offer_[0-7][0-9a-hjkmnp-tv-z]{25})?$", description: "The after-purchase offer shown next: after a landing page's purchase, or after an after-purchase offer is accepted; empty for none" }
        decline_offer_id: { type: string, pattern: "^(offer_[0-7][0-9a-hjkmnp-tv-z]{25})?$", description: "For an after-purchase offer: the after-purchase offer shown next when the shopper answers No thanks; empty for none. A landing page takes none. A session shows at most 3 after-purchase offers" }
        lines: { type: array, maxItems: 50, items: { $ref: "#/components/schemas/CheckoutOfferSelection" } }
        expires_at: { type: string, format: date-time }
        content: { $ref: "#/components/schemas/CheckoutOfferContent" }
        shipping_fee_minor: { type: integer, format: int64, minimum: 0, maximum: 100000000, description: "For an after-purchase offer: the flat shipping fee, in the store currency's minor units, charged when the offer ships with the order it follows; 0 or absent ships it free. A landing offer takes 0 or none" }
    CheckoutOfferDraftCreateParams:
      type: object
      additionalProperties: false
      required: [store_id, draft]
      properties:
        store_id: { type: string, pattern: "^store_[0-7][0-9a-hjkmnp-tv-z]{25}$" }
        draft: { $ref: "#/components/schemas/CheckoutOfferDraftInput" }
    CheckoutOfferDraftSaveParams:
      type: object
      additionalProperties: false
      required: [store_id, draft]
      properties:
        store_id: { type: string, pattern: "^store_[0-7][0-9a-hjkmnp-tv-z]{25}$" }
        draft: { $ref: "#/components/schemas/CheckoutOfferDraftInput" }
    CheckoutOfferStoreParams:
      type: object
      additionalProperties: false
      required: [store_id]
      properties:
        store_id: { type: string, pattern: "^store_[0-7][0-9a-hjkmnp-tv-z]{25}$" }
    CheckoutOfferRollbackParams:
      type: object
      additionalProperties: false
      required: [store_id, publication_id]
      properties:
        store_id: { type: string, pattern: "^store_[0-7][0-9a-hjkmnp-tv-z]{25}$" }
        publication_id: { type: string, pattern: "^offer_[0-7][0-9a-hjkmnp-tv-z]{25}$" }
    CheckoutOfferDraft:
      type: object
      required: [type, id, store_id, etag, revision, draft, active_publication_id, active_hostname, active_placement, republish_currency, live_is_draft, paused, updated_at]
      properties:
        type: { type: string, const: checkout_offer_draft }
        id: { type: string }
        etag: { type: string, description: "Strong entity tag of this version (RFC 9110); send it back in If-Match to change the resource." }
        store_id: { type: string }
        revision: { type: integer, format: int64 }
        draft: { $ref: "#/components/schemas/CheckoutOfferDraftInput" }
        active_publication_id: { type: string }
        active_hostname: { type: string }
        active_placement: { type: string }
        republish_currency: { type: string, description: "The store's currency when the offer is live, unexpired and unpaused but its live version charges in another one, so checkout refuses it until it is republished (republishCheckoutOfferDraft); empty otherwise" }
        live_is_draft: { type: boolean, description: "Whether the draft's content is exactly what its live version publishes; false while no version is live" }
        paused: { type: boolean }
        updated_at: { type: string, format: date-time }
    CheckoutOfferVersion:
      type: object
      required: [type, id, draft_revision, published_at, offer, active, paused]
      properties:
        type: { type: string, const: checkout_offer_version }
        id: { type: string }
        draft_revision: { type: integer, format: int64 }
        published_at: { type: string, format: date-time }
        offer: { $ref: "#/components/schemas/CheckoutPublishedOffer" }
        active: { type: boolean }
        paused: { type: boolean }
    CheckoutOfferPreview:
      type: object
      required: [type, draft_id, revision, title, content, currency, currency_exponent, lines, subtotal_minor, expires_at]
      properties:
        type: { type: string, const: checkout_offer_preview }
        draft_id: { type: string }
        revision: { type: integer, format: int64 }
        title: { type: string }
        content: { $ref: "#/components/schemas/CheckoutOfferContent" }
        currency: { type: string }
        currency_exponent: { type: integer, minimum: 0, description: "Decimal places of the currency's minor unit (ISO 4217): show the minor-unit amounts with exactly this many fraction digits" }
        lines: { type: array, items: { $ref: "#/components/schemas/CheckoutPublishedLine" } }
        subtotal_minor: { type: integer, format: int64 }
        expires_at: { type: string, format: date-time }
    CheckoutOfferDraftList:
      type: object
      required: [data, has_more, first_id, last_id]
      properties:
        data: { type: array, items: { $ref: "#/components/schemas/CheckoutOfferDraft" } }
        has_more: { type: boolean }
        first_id: { type: [string, "null"] }
        last_id: { type: [string, "null"] }
    CheckoutOfferVersionList:
      type: object
      required: [data, has_more, first_id, last_id]
      properties:
        data: { type: array, items: { $ref: "#/components/schemas/CheckoutOfferVersion" } }
        has_more: { type: boolean }
        first_id: { type: [string, "null"] }
        last_id: { type: [string, "null"] }
    CheckoutOfferChoice:
      type: object
      required: [type, id, title, currency, currency_exponent, subtotal_minor, expires_at]
      properties:
        type: { type: string, const: checkout_offer_choice }
        id: { type: string }
        title: { type: string }
        currency: { type: string }
        currency_exponent: { type: integer, minimum: 0, description: "Decimal places of the currency's minor unit (ISO 4217): show the minor-unit amounts with exactly this many fraction digits" }
        subtotal_minor: { type: integer, format: int64 }
        expires_at: { type: string, format: date-time }
    CheckoutOfferChoiceList:
      type: object
      required: [data, has_more, first_id, last_id]
      properties:
        data: { type: array, items: { $ref: "#/components/schemas/CheckoutOfferChoice" } }
        has_more: { type: boolean }
        first_id: { type: [string, "null"] }
        last_id: { type: [string, "null"] }
    CheckoutMerchantStore:
      type: object
      additionalProperties: false
      required: [type, id, domain, currency, platform]
      properties:
        type: { type: string, const: checkout_store }
        id: { type: string }
        domain: { type: string }
        currency: { type: string }
        platform: { type: string }
    PaymentRoutingAccount:
      type: object
      additionalProperties: false
      required: [processor, merchant_account]
      properties:
        processor: { type: string, minLength: 1, maxLength: 32, description: "The processor, such as `whop` or `stripe`" }
        merchant_account: { type: string, minLength: 1, maxLength: 255, description: "The connection's account at that processor, as `connections` lists it" }
    PaymentRouteWeight:
      type: object
      additionalProperties: false
      required: [processor, merchant_account, weight]
      properties:
        processor: { type: string, minLength: 1, maxLength: 32, description: "The processor, such as `whop` or `stripe`" }
        merchant_account: { type: string, minLength: 1, maxLength: 255, description: "The connection's account at that processor, as `connections` lists it" }
        weight: { type: integer, format: int64, minimum: 0, maximum: 100, description: "Relative share among usable positive weights. Zero excludes this connection from the method, including primary fallback. A weighted list needs at least one positive weight." }
    PaymentRoutingMethods:
      type: object
      additionalProperties: false
      properties:
        card: { type: array, minItems: 1, maxItems: 20, items: { $ref: "#/components/schemas/PaymentRouteWeight" }, description: "Card's connections and weights. Left out, card goes to the store's bound connection." }
        google_pay: { type: array, minItems: 1, maxItems: 20, items: { $ref: "#/components/schemas/PaymentRouteWeight" }, description: "Google Pay's. Left out, Google Pay goes to the card's pick. Until the page draws two processors, a Google Pay pick that isn't the card's is skipped." }
        apple_pay: { type: array, maxItems: 20, items: { $ref: "#/components/schemas/PaymentRouteWeight" }, description: "Never set: a policy that sets it is refused, since Apple Pay stays on the processor that holds the checkout hostname's registration." }
        no_fallback: { type: array, maxItems: 2, uniqueItems: true, items: { type: string, x-luckylanding-known-values: [card, google_pay] }, description: "Methods whose fallback is off. When none of a method's connections can take it, the method goes through the store's primary connection if that one can, and is hidden otherwise; a method listed here is hidden at once." }
        "off": { type: array, maxItems: 1, uniqueItems: true, items: { type: string, x-luckylanding-known-values: [google_pay] }, description: "Methods checkout doesn't offer: Google Pay only, with no `google_pay` weights." }
    PaymentRoutingConnection:
      type: object
      additionalProperties: false
      required: [processor, merchant_account, active, primary, selectable, reason]
      properties:
        processor: { type: string }
        merchant_account: { type: string }
        active: { type: boolean, description: "Whether the connection is active now; an inactive one is skipped until it is again" }
        primary: { type: boolean, description: "The store's primary connection, the one it is bound to: card and Google Pay use it while no policy is saved, and fall back to it when none of their connections can take them" }
        selectable: { type: boolean, description: "False if this processor cannot take shoppers or the active account's settings check found tax or a buyer fee. A policy may name the account. Routing skips it with `reason`." }
        reason: { type: string, description: "Why it isn't selectable; empty when it is" }
    PaymentRoutingPolicy:
      type: object
      additionalProperties: false
      required: [type, store_id, version, etag, methods, connections]
      properties:
        type: { type: string, const: payment_routing_policy }
        store_id: { type: string }
        version: { type: integer, format: int64, minimum: 0, description: "The saved version; 0 while none is saved" }
        etag: { type: string }
        methods: { $ref: "#/components/schemas/PaymentRoutingMethods" }
        connections: { type: array, items: { $ref: "#/components/schemas/PaymentRoutingConnection" } }
    PaymentRoutingPolicyParams:
      type: object
      additionalProperties: false
      required: [store_id, methods]
      properties:
        store_id: { type: string, pattern: "^store_[0-7][0-9a-hjkmnp-tv-z]{25}$" }
        methods: { $ref: "#/components/schemas/PaymentRoutingMethods" }
    PaymentRoutingDryRunParams:
      type: object
      additionalProperties: false
      required: [store_id]
      properties:
        store_id: { type: string, pattern: "^store_[0-7][0-9a-hjkmnp-tv-z]{25}$" }
        methods: { $ref: "#/components/schemas/PaymentRoutingMethods" }
    PaymentSkippedRoute:
      type: object
      additionalProperties: false
      required: [processor, merchant_account, reason]
      properties:
        processor: { type: string }
        merchant_account: { type: string }
        reason: { type: string }
    PaymentRoute:
      type: object
      additionalProperties: false
      required: [method, status, reason, pick, turn, candidates, skipped]
      properties:
        method: { type: string, x-luckylanding-known-values: [card, google_pay, apple_pay] }
        status: { type: string, x-luckylanding-known-values: [taking, fallback, not_offered, "off"], description: "`taking` on one of its own connections; `fallback` on the store's primary connection because none of its own can take it; `not_offered` when no connection can; `off` when the policy turns it off" }
        reason: { type: string, description: "Why it is on its fallback, not offered or off; empty while `taking`" }
        pick: { oneOf: [{ $ref: "#/components/schemas/PaymentRoutingAccount" }, { type: "null" }], description: "The connection the method gets; `null` when none is usable, so the method isn't offered" }
        turn: { type: [integer, "null"], format: int64, description: "The method's turn in the weighted order that chose `pick`; `null` when only one connection was usable" }
        candidates: { type: array, items: { $ref: "#/components/schemas/PaymentRouteWeight" } }
        skipped: { type: array, items: { $ref: "#/components/schemas/PaymentSkippedRoute" } }
    PaymentRoutingWarning:
      type: object
      additionalProperties: false
      required: [method, code, message]
      properties:
        method: { type: string, x-luckylanding-known-values: [card, google_pay] }
        code: { type: string, x-luckylanding-known-values: [one_point_of_failure, no_usable_connection] }
        message: { type: string }
    PaymentRoutingDryRun:
      type: object
      additionalProperties: false
      required: [type, store_id, policy_version, taking_orders, reason, routes, warnings]
      properties:
        type: { type: string, const: payment_routing_dry_run }
        store_id: { type: string }
        policy_version: { type: integer, format: int64, minimum: 0, description: "The saved version it ran, or for sent `methods` the version a save would make" }
        taking_orders: { type: boolean, description: "Whether a checkout started now gets a card connection, its fallback included. When false, checkout sends shoppers to the store's own checkout." }
        reason: { type: string, description: "Why the store isn't taking orders; empty while it is" }
        routes: { type: array, items: { $ref: "#/components/schemas/PaymentRoute" } }
        warnings: { type: array, items: { $ref: "#/components/schemas/PaymentRoutingWarning" } }
    PaymentRoutingPolicySet:
      type: object
      additionalProperties: false
      required: [type, policy, dry_run]
      properties:
        type: { type: string, const: payment_routing_policy_set }
        policy: { $ref: "#/components/schemas/PaymentRoutingPolicy" }
        dry_run: { $ref: "#/components/schemas/PaymentRoutingDryRun" }
    CheckoutMerchantVariant:
      type: object
      additionalProperties: false
      required: [type, id, title, image_url, unit_minor, currency, currency_exponent, requires_shipping, taxable, tracked]
      properties:
        type: { type: string, const: checkout_variant }
        id: { type: string }
        title: { type: string }
        image_url: { type: string }
        unit_minor: { type: integer, format: int64 }
        currency: { type: string }
        currency_exponent: { type: integer, minimum: 0, description: "Decimal places of the currency's minor unit (ISO 4217): show the minor-unit amounts with exactly this many fraction digits" }
        requires_shipping: { type: boolean }
        taxable: { type: boolean }
        tracked: { type: boolean }
    CheckoutMerchantStoreList:
      type: object
      required: [data, has_more, first_id, last_id]
      properties:
        data: { type: array, items: { $ref: "#/components/schemas/CheckoutMerchantStore" } }
        has_more: { type: boolean }
        first_id: { type: [string, "null"] }
        last_id: { type: [string, "null"] }
    CheckoutMerchantCatalogList:
      type: object
      required: [data, has_more, first_id, last_id]
      properties:
        data: { type: array, items: { $ref: "#/components/schemas/CheckoutMerchantVariant" } }
        has_more: { type: boolean }
        first_id: { type: [string, "null"] }
        last_id: { type: [string, "null"] }
    CheckoutCatalogImportCreateParams:
      type: object
      additionalProperties: false
      required: [store_id]
      properties:
        store_id: { type: string, pattern: "^store_[0-7][0-9a-hjkmnp-tv-z]{25}$" }
    CheckoutCatalogImportRun:
      type: object
      required: [type, id, store_id, created_at]
      properties:
        type: { type: string, const: checkout_catalog_import_run }
        id: { type: string }
        store_id: { type: string }
        created_at: { type: string, format: date-time }
    CheckoutCatalogImportParams:
      type: object
      additionalProperties: false
      required: [store_id]
      properties:
        store_id: { type: string, pattern: "^store_[0-7][0-9a-hjkmnp-tv-z]{25}$" }
        after_page_id: { type: string, pattern: "^catalog_import_page_[0-7][0-9a-hjkmnp-tv-z]{25}$" }
    CheckoutCatalogImport:
      type: object
      required: [type, id, import_id, store_id, imported_count, can_continue, observed_at]
      properties:
        type: { type: string, const: checkout_catalog_import }
        id: { type: string }
        import_id: { type: string }
        store_id: { type: string }
        imported_count: { type: integer, format: int64 }
        can_continue: { type: boolean }
        observed_at: { type: string, format: date-time }
    CheckoutCartEvidence:
      type: object
      required: [type, environment, stage]
      properties:
        type: { type: string, const: checkout_cart_evidence }
        environment: { type: string, x-luckylanding-known-values: [sandbox, production] }
        stage: { type: string, x-luckylanding-known-values: [connected, quoted, free, paid, ordered, recorded], description: "Progress of the most recent Shopify cart quote in this store and project’s verified environment. Paid and ordered require a verified Whop payment for that quote." }
        cart_routed: { type: boolean, description: "At the connection step, whether the ready checkout hostname currently routes carts to this store." }
        historical: { type: boolean, description: "This historical quote predates recording when Shopify pricing finished, so it may not be the last quote." }
        payment_id: { type: string, description: "The verified Whop payment for this cart, when available." }
    CheckoutCatalogReadiness:
      type: object
      required: [type, store_id, status, import_id, last_page_id, can_continue]
      properties:
        type: { type: string, const: checkout_catalog_readiness }
        store_id: { type: string }
        status: { type: string, x-luckylanding-known-values: [not_connected, missing_checkout_scopes, ready_to_import, imported, ready], description: "`ready`: at least one imported variant is a catalog entry offers can use (`listCheckoutCatalog`). `imported`: a page was imported, but no variant is offerable yet. Earlier values describe the store connection" }
        import_id: { type: [string, "null"] }
        last_page_id: { type: [string, "null"] }
        can_continue: { type: boolean }
    CheckoutCatalogOption:
      type: object
      required: [name, value]
      properties:
        name: { type: string }
        value: { type: string }
    CheckoutCatalogSource:
      type: object
      required: [type, id, title, image_url, options, unit_minor, currency, currency_exponent, taxable, tracked, requires_shipping, reason, updated_at, observed_at]
      properties:
        type: { type: string, const: checkout_catalog_source }
        id: { type: string }
        title: { type: string }
        image_url: { type: string }
        options: { type: array, items: { $ref: "#/components/schemas/CheckoutCatalogOption" } }
        unit_minor: { type: integer, format: int64 }
        currency: { type: string }
        currency_exponent: { type: integer, minimum: 0, description: "Decimal places of the currency's minor unit (ISO 4217): show the minor-unit amounts with exactly this many fraction digits" }
        taxable: { type: boolean }
        tracked: { type: boolean }
        requires_shipping: { type: boolean }
        reason: { type: string, x-luckylanding-known-values: ["", inactive_product, gift_card, subscription_only, bundle_components, free_variant], description: "Why this variant is not offerable; empty when the import made it a catalog entry offers can use" }
        updated_at: { type: string, format: date-time }
        observed_at: { type: string, format: date-time }
    CheckoutCatalogSourceList:
      type: object
      required: [data, has_more, first_id, last_id]
      properties:
        data: { type: array, items: { $ref: "#/components/schemas/CheckoutCatalogSource" } }
        has_more: { type: boolean }
        first_id: { type: [string, "null"] }
        last_id: { type: [string, "null"] }
    CheckoutOfferPublishParams:
      type: object
      additionalProperties: false
      required: [store_id, hostname, title, placement, lines, expires_at]
      properties:
        store_id: { type: string, pattern: "^store_[0-7][0-9a-hjkmnp-tv-z]{25}$" }
        hostname: { type: string, minLength: 1, maxLength: 253 }
        title: { type: string, minLength: 1, maxLength: 200 }
        placement: { type: string, enum: [landing, post_purchase] }
        upsell_offer_id: { type: string, pattern: "^(offer_[0-7][0-9a-hjkmnp-tv-z]{25})?$", description: "The after-purchase offer shown next: after a landing page's purchase, or after an after-purchase offer is accepted" }
        decline_offer_id: { type: string, pattern: "^(offer_[0-7][0-9a-hjkmnp-tv-z]{25})?$", description: "For an after-purchase offer: the after-purchase offer shown next when the shopper answers No thanks; empty for none. A landing page takes none. A session shows at most 3 after-purchase offers" }
        lines: { type: array, minItems: 1, maxItems: 50, items: { $ref: "#/components/schemas/CheckoutOfferSelection" } }
        expires_at: { type: string, format: date-time }
        shipping_fee_minor: { type: integer, format: int64, minimum: 0, maximum: 100000000, description: "For an after-purchase offer: the flat shipping fee, in the store currency's minor units, charged when the offer ships with the order it follows; 0 or absent ships it free. A landing offer takes 0 or none" }
    CheckoutOfferSelection:
      type: object
      additionalProperties: false
      required: [variant_id, quantity, order_bump]
      properties:
        variant_id: { type: string, pattern: "^catalog_variant_[0-7][0-9a-hjkmnp-tv-z]{25}$" }
        quantity: { type: integer, minimum: 1, maximum: 999999 }
        order_bump: { type: boolean }
    CheckoutPublishedOffer:
      type: object
      required: [type, id, title, placement, currency, currency_exponent, subtotal_minor, lines, expires_at]
      properties:
        type: { type: string, const: checkout_offer }
        content: { $ref: "#/components/schemas/CheckoutOfferContent" }
        shipping_fee_minor: { type: integer, format: int64, minimum: 0, description: "For an after-purchase offer: the flat shipping fee charged when it ships with the order it follows; 0 or absent ships it free. In a payment state's next_offer it is the fee this shopper would pay, so 0 when the offer would not ship with the held order or the first purchase ships free on a code" }
        id: { type: string, pattern: "^[A-Za-z0-9_-]+$" }
        title: { type: string }
        placement: { type: string }
        currency: { type: string, pattern: "^[A-Z]{3}$" }
        currency_exponent: { type: integer, minimum: 0, description: "Decimal places of the currency's minor unit (ISO 4217): show the minor-unit amounts with exactly this many fraction digits" }
        subtotal_minor: { type: integer, format: int64, minimum: 0 }
        lines: { type: array, minItems: 1, maxItems: 50, items: { $ref: "#/components/schemas/CheckoutPublishedLine" } }
        expires_at: { type: string, format: date-time }
        ends_in_ms: { type: integer, format: int64, minimum: 0, description: "On a shopper's read of a landing offer whose countdown is on (`content.show_countdown`): milliseconds until `expires_at`, measured on the server as it answered, so the page counts down from when it got the answer rather than by the device's clock. Absent otherwise" }
    CheckoutPublishedLine:
      type: object
      required: [variant_id, title, image_url, quantity, unit_minor, order_bump]
      properties:
        requires_shipping: { type: boolean }
        variant_id: { type: string }
        title: { type: string }
        image_url: { type: string }
        quantity: { type: integer, minimum: 1 }
        unit_minor: { type: integer, format: int64, minimum: 0 }
        order_bump: { type: boolean }
    CheckoutPaymentLine:
      type: object
      required: [title, image_url, quantity, unit_minor, order_bump]
      properties:
        requires_shipping: { type: boolean }
        variant_id: { type: string, description: "The offer's catalog variant; absent on a line of a store cart, which has none" }
        title: { type: string }
        image_url: { type: string }
        quantity: { type: integer, minimum: 1 }
        unit_minor: { type: integer, format: int64, minimum: 0 }
        order_bump: { type: boolean }
    CheckoutStartParams:
      type: object
      additionalProperties: false
      required: [quantity, include_bump]
      properties:
        quantity: { type: integer, minimum: 1, maximum: 12 }
        include_bump: { type: boolean }
        attribution: { $ref: "#/components/schemas/CheckoutStartAttributionParams" }
    CheckoutStartAttributionParams:
      type: object
      additionalProperties: false
      description: "The click IDs, UTMs and consent the handoff carries (CHK-R2), stored on the session (CHK-AC7); a direct offer link carries them in its own URL. The API adds the merchant-domain ad cookies, Sec-GPC and the country from the request itself; a missing consent is unknown. Under `consent: denied` the session keeps only the UTMs and the denial, with Sec-GPC and the country: no click ID and no ad cookie, carried or from the request."
      properties:
        fbclid: { type: string, minLength: 1, maxLength: 512, pattern: "^[^\\x00-\\x1f\\x7f-\\x9f]+$" }
        gclid: { type: string, minLength: 1, maxLength: 512, pattern: "^[^\\x00-\\x1f\\x7f-\\x9f]+$" }
        gbraid: { type: string, minLength: 1, maxLength: 512, pattern: "^[^\\x00-\\x1f\\x7f-\\x9f]+$" }
        wbraid: { type: string, minLength: 1, maxLength: 512, pattern: "^[^\\x00-\\x1f\\x7f-\\x9f]+$" }
        ttclid: { type: string, minLength: 1, maxLength: 512, pattern: "^[^\\x00-\\x1f\\x7f-\\x9f]+$" }
        utm_source: { type: string, minLength: 1, maxLength: 256, pattern: "^[^\\x00-\\x1f\\x7f-\\x9f]+$" }
        utm_medium: { type: string, minLength: 1, maxLength: 256, pattern: "^[^\\x00-\\x1f\\x7f-\\x9f]+$" }
        utm_campaign: { type: string, minLength: 1, maxLength: 256, pattern: "^[^\\x00-\\x1f\\x7f-\\x9f]+$" }
        utm_term: { type: string, minLength: 1, maxLength: 256, pattern: "^[^\\x00-\\x1f\\x7f-\\x9f]+$" }
        utm_content: { type: string, minLength: 1, maxLength: 256, pattern: "^[^\\x00-\\x1f\\x7f-\\x9f]+$" }
        utm_id: { type: string, minLength: 1, maxLength: 256, pattern: "^[^\\x00-\\x1f\\x7f-\\x9f]+$" }
        consent: { type: string, enum: [denied], description: "Only a denial: a URL can only deny consent, never grant it" }
    CheckoutCartStartParams:
      type: object
      additionalProperties: false
      required: [lines, currency, store_origin]
      properties:
        lines: { type: array, minItems: 1, maxItems: 10, items: { $ref: "#/components/schemas/CheckoutCartLineParams" } }
        currency: { type: string, pattern: "^[A-Z]{3}$", description: "The cart's currency, which must be the store's" }
        cart_path: { type: string, maxLength: 260, pattern: "^(/[A-Za-z0-9_-]+)?/cart$", description: "The localized cart path under the verified storefront origin. Defaults to /cart." }
        store_origin: { type: string, maxLength: 261, pattern: "^https://[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$", description: "The origin of the store page the theme script ran on, on the checkout hostname's own site" }
        discount_code: { type: string, minLength: 1, maxLength: 255, pattern: "^[^\\x00-\\x1f\\x7f-\\x9f]+$", description: "The code the shopper applied to the store cart; the store decides when the shopper prepares the payment whether it applies" }
        note: { type: string, minLength: 1, maxLength: 5000 }
        attributes: { type: array, maxItems: 100, items: { $ref: "#/components/schemas/CheckoutCartAttribute" } }
        cart_token: { type: string, maxLength: 255, pattern: "^[\\x21-\\x7e]+$", description: "The store cart's own token, as the store gave it to the theme script (on Shopify, its Ajax cart's `token`, `?key=` suffix included). The order carries it as the attribute attribution apps match an outside checkout's order to the shopper's store visit by (on Shopify, `shopify-cart-token`), which LL passes on without reading it." }
        attribution: { $ref: "#/components/schemas/CheckoutCartAttributionParams" }
    StoreKey:
      type: string
      pattern: "^[\\x21-\\x7e]{1,64}$"
      description: "A key the store platform owns, which LL passes on without reading it."
    CheckoutCartLineParams:
      type: object
      additionalProperties: false
      required: [variant_key, quantity]
      properties:
        variant_key: { $ref: "#/components/schemas/StoreKey", description: "The store's own key for the variant, which only the store reads and checks" }
        quantity: { type: integer, minimum: 1, maximum: 100 }
        line_properties: { type: array, maxItems: 100, items: { $ref: "#/components/schemas/CheckoutCartAttribute" } }
    CheckoutCartAttribute:
      type: object
      additionalProperties: false
      required: [key, value]
      properties:
        key: { type: string, minLength: 1, maxLength: 255 }
        value: { type: string, minLength: 1, maxLength: 5000 }
    CheckoutCartAttributionParams:
      type: object
      additionalProperties: false
      description: "The click IDs, UTMs, store ad cookies and consent the theme script carries (CHK-R2), stored on the session. An ad cookie the checkout sees on the start request wins over the carried one; the API adds Sec-GPC and the country from the request itself; a missing consent is unknown. Under `consent: denied` the session keeps only the UTMs and the denial, with Sec-GPC and the country: no click ID, ad cookie or GA4 session, carried or from the request, and no `cart_token`."
      properties:
        fbclid: { type: string, minLength: 1, maxLength: 512, pattern: "^[^\\x00-\\x1f\\x7f-\\x9f]+$" }
        gclid: { type: string, minLength: 1, maxLength: 512, pattern: "^[^\\x00-\\x1f\\x7f-\\x9f]+$" }
        gbraid: { type: string, minLength: 1, maxLength: 512, pattern: "^[^\\x00-\\x1f\\x7f-\\x9f]+$" }
        wbraid: { type: string, minLength: 1, maxLength: 512, pattern: "^[^\\x00-\\x1f\\x7f-\\x9f]+$" }
        ttclid: { type: string, minLength: 1, maxLength: 512, pattern: "^[^\\x00-\\x1f\\x7f-\\x9f]+$" }
        utm_source: { type: string, minLength: 1, maxLength: 256, pattern: "^[^\\x00-\\x1f\\x7f-\\x9f]+$" }
        utm_medium: { type: string, minLength: 1, maxLength: 256, pattern: "^[^\\x00-\\x1f\\x7f-\\x9f]+$" }
        utm_campaign: { type: string, minLength: 1, maxLength: 256, pattern: "^[^\\x00-\\x1f\\x7f-\\x9f]+$" }
        utm_term: { type: string, minLength: 1, maxLength: 256, pattern: "^[^\\x00-\\x1f\\x7f-\\x9f]+$" }
        utm_content: { type: string, minLength: 1, maxLength: 256, pattern: "^[^\\x00-\\x1f\\x7f-\\x9f]+$" }
        utm_id: { type: string, minLength: 1, maxLength: 256, pattern: "^[^\\x00-\\x1f\\x7f-\\x9f]+$" }
        _fbp: { type: string, minLength: 1, maxLength: 512, pattern: "^[^\\x00-\\x1f\\x7f-\\x9f]+$" }
        _fbc: { type: string, minLength: 1, maxLength: 512, pattern: "^[^\\x00-\\x1f\\x7f-\\x9f]+$" }
        _ttp: { type: string, minLength: 1, maxLength: 512, pattern: "^[^\\x00-\\x1f\\x7f-\\x9f]+$" }
        _gcl_aw: { type: string, minLength: 1, maxLength: 512, pattern: "^[^\\x00-\\x1f\\x7f-\\x9f]+$" }
        _gcl_gb: { type: string, minLength: 1, maxLength: 512, pattern: "^[^\\x00-\\x1f\\x7f-\\x9f]+$" }
        _gcl_ag: { type: string, minLength: 1, maxLength: 512, pattern: "^[^\\x00-\\x1f\\x7f-\\x9f]+$" }
        _ga: { type: string, minLength: 1, maxLength: 512, pattern: "^[^\\x00-\\x1f\\x7f-\\x9f]+$" }
        _ga_sessions:
          type: object
          maxProperties: 32
          additionalProperties: { type: string, minLength: 1, maxLength: 512, pattern: "^[^\\x00-\\x1f\\x7f-\\x9f]+$" }
          description: "The store's GA4 session cookies, `_ga_<container>`, by container: the first value of each. A checkout host on another site from the store never sees them, so without them GA4 can't join the checkout to the shopper's session. LL keeps only the containers of the project's GA4 streams, and one the checkout sees on the start request wins for its container. Under `consent: denied` none is kept."
        denied_purposes: { type: array, maxItems: 3, uniqueItems: true, items: { type: string, enum: [analytics, marketing, sale_of_data] }, description: "Each consent purpose the store's banner reports denied. Under a denied purpose the session keeps no identifier only that purpose's destinations read; `consent: denied` denies every purpose." }
        consent: { type: string, enum: [denied], description: "Only a denial: a URL can only deny consent, never grant it" }
    CheckoutAttribution:
      type: object
      description: "The attribution captured when the session started; a field it didn't capture is absent. The shopper's IP address and user agent are stored sealed and never returned."
      properties:
        fbclid: { type: string }
        gclid: { type: string }
        gbraid: { type: string }
        wbraid: { type: string }
        ttclid: { type: string }
        _fbp: { type: string }
        _fbc: { type: string }
        _ttp: { type: string }
        _gcl_aw: { type: string }
        _gcl_gb: { type: string }
        _ga: { type: string }
        utm_source: { type: string }
        utm_medium: { type: string }
        utm_campaign: { type: string }
        utm_term: { type: string }
        utm_content: { type: string }
        utm_id: { type: string }
        denied_purposes: { type: array, maxItems: 3, uniqueItems: true, items: { type: string, x-luckylanding-known-values: [analytics, marketing, sale_of_data] }, description: "The consent purposes the shopper denied, sorted: from the store's banner, a landing URL's `consent=denied` (every purpose) or Sec-GPC (sale of data). Empty when none was denied." }
        country: { type: string, pattern: "^[A-Z]{2}$", description: "The shopper's country as Cloudflare saw it; absent when unknown" }
    CheckoutStarted:
      type: object
      required: [type, session_id, checkout_path]
      properties:
        type: { type: string, const: checkout_started }
        session_id: { type: string }
        checkout_path: { type: string }
    CheckoutContactParams:
      type: object
      additionalProperties: false
      required: [email]
      properties:
        email: { type: string, format: email, minLength: 3, maxLength: 254 }
    CheckoutContact:
      type: object
      required: [type, email]
      properties:
        type: { type: string, const: checkout_contact }
        email: { type: string, description: "The email as saved, which the payment step offers to the processor." }
    CheckoutAddressSuggestParams:
      type: object
      additionalProperties: false
      required: [input, country, session_token]
      properties:
        input: { type: string, minLength: 3, maxLength: 200, pattern: "^[^\\x00-\\x1f\\x7f-\\x9f]+$" }
        country: { type: string, pattern: "^[A-Z]{2}$", description: "The delivery form's country, which starts as the session's country; suggestions come from this country only." }
        session_token: { type: string, format: uuid }
    CheckoutAddressSuggestions:
      type: object
      required: [type, suggestions]
      properties:
        type: { type: string, const: checkout_address_suggestions }
        suggestions: { type: array, maxItems: 5, items: { $ref: "#/components/schemas/CheckoutAddressSuggestion" } }
    CheckoutAddressSuggestion:
      type: object
      required: [place_id, main_text, secondary_text]
      properties:
        place_id: { type: string }
        main_text: { type: string }
        secondary_text: { type: string, description: "Empty when Google gives none." }
    CheckoutAddressDetailsParams:
      type: object
      additionalProperties: false
      required: [place_id, session_token]
      properties:
        place_id: { type: string, minLength: 1, maxLength: 512, pattern: "^[A-Za-z0-9_-]+$" }
        session_token: { type: string, format: uuid }
    CheckoutAddressDetails:
      type: object
      required: [type, line1, line2, city, state, postal_code, country]
      properties:
        type: { type: string, const: checkout_address_details }
        line1: { type: string }
        line2: { type: string }
        city: { type: string }
        state: { type: string, description: "The state or province code, as the delivery step sends it to the store." }
        postal_code: { type: string }
        country: { type: string, description: "The ISO 3166-1 alpha-2 country code; empty when Google gives none." }
    CheckoutProtectionTerms:
      type: object
      additionalProperties: false
      required: [variant_id, unit_minor, currency]
      properties:
        variant_id: { type: string, pattern: "^catalog_variant_[0-7][0-9a-hjkmnp-tv-z]{25}$" }
        unit_minor: { type: integer, format: int64, minimum: 1 }
        currency: { type: string, pattern: "^[A-Z]{3}$" }
    CheckoutPrepareParams:
      type: object
      additionalProperties: false
      required: [saving, country, state, postal_code, name]
      properties:
        order_protection: { type: boolean, description: Explicit opt-in for the cart's protection variant. }
        protection_terms: { $ref: "#/components/schemas/CheckoutProtectionTerms" }
        offer_id: { type: string, pattern: "^(offer_[0-7][0-9a-hjkmnp-tv-z]{25})?$" }
        saving: { type: string, enum: ["", on_session, off_session] }
        name: { type: string, maxLength: 200, description: "The shopper's full name as they gave it, for every order: the name the store's order and the payment carry. The server trims it and makes each run of whitespace one space. It splits a name with a space for the store, except a Japanese-script name on a Japanese address from a wallet; one it can't split needs `given_name` and `family_name`, and without them prepare answers `name_required`, before any charge" }
        name_source: { type: string, enum: [typed, apple_pay, google_pay, paypal], description: "Where `name` came from: typed by the shopper, or handed over by that wallet. Absent means typed" }
        given_name: { type: string, maxLength: 200, description: "The given name as the shopper typed it, for a `name` the server can't split; when sent, the store gets it instead of a split" }
        family_name: { type: string, maxLength: 200, description: "The family name as the shopper typed it, as `given_name` is" }
        country: { type: string, pattern: "^[A-Z]{2}$" }
        state: { type: string, maxLength: 100 }
        postal_code: { type: string, maxLength: 20 }
        delivery_address: { $ref: "#/components/schemas/CheckoutDeliveryAddress" }
        shipping_rate_handle: { type: string, maxLength: 2000, description: "Handle of the delivery option the shopper picked from `shipping_options`; any rate the store offers, paid or free" }
        discount_code: { type: string, maxLength: 255, description: "One discount code as the shopper typed it, for the original purchase only. Omit to use the cart code or send an empty string to remove it. The store decides whether it applies; `discount_code_status` reports the result" }
    CheckoutDeliveryAddress:
      type: object
      additionalProperties: false
      required: [line1, city, country, state, postal_code]
      properties:
        line1: { type: string, maxLength: 200 }
        line2: { type: string, maxLength: 200 }
        city: { type: string, maxLength: 200 }
        country: { type: string, pattern: "^[A-Z]{2}$" }
        state: { type: string, maxLength: 100 }
        postal_code: { type: string, maxLength: 20 }
    CheckoutLocation:
      type: object
      required: [country, state, postal_code]
      properties:
        country: { type: string, pattern: "^[A-Z]{2}$" }
        state: { type: string }
        postal_code: { type: string }
    CheckoutExpressPriceParams:
      type: object
      additionalProperties: false
      required: [country, state, postal_code, city]
      properties:
        order_protection: { type: boolean, description: Explicit opt-in for the cart's protection variant. }
        protection_terms: { $ref: "#/components/schemas/CheckoutProtectionTerms" }
        country: { type: string, pattern: "^[A-Z]{2}$" }
        state: { type: string, maxLength: 100 }
        postal_code: { type: string, maxLength: 20 }
        city: { type: string, maxLength: 200 }
        shipping_rate_handle: { type: string, maxLength: 2000, description: "Handle of the rate the shopper picked in the sheet from `shipping_options`" }
        discount_code: { type: string, maxLength: 255, description: "One discount code as the shopper typed it in the checkout form, as prepare takes it; omit to use the cart code or send an empty string to remove it" }
    CheckoutExpressPrice:
      type: object
      required: [type, state, currency, currency_exponent, amount, subtotal_minor, discount_minor, shipping_minor, tax_minor, tax_inclusive, discount_code, discount_code_status, shipping_options, shipping_rate_handle]
      properties:
        type: { type: string, const: checkout_express_price }
        state: { type: string, x-luckylanding-known-values: [priced, shipping_unsupported, address_invalid], description: "`priced`: the amounts are the store's total for this address and rate; `shipping_unsupported`: the store delivers nothing to this address, and the amounts are 0; `address_invalid`: the sheet's address has a state the country doesn't list, misses one the country requires, or has a postal code that fits neither the country's pattern nor, as a wallet redacts it, its partial one, and the amounts are 0" }
        currency: { type: string }
        currency_exponent: { type: integer, minimum: 0, description: "Decimal places of the currency's minor unit (ISO 4217): show the minor-unit amounts with exactly this many fraction digits" }
        amount: { type: integer, format: int64 }
        subtotal_minor: { type: integer, format: int64 }
        discount_minor: { type: integer, format: int64 }
        shipping_minor: { type: integer, format: int64 }
        tax_minor: { type: integer, format: int64 }
        tax_inclusive: { type: boolean }
        discount_code: { type: string, description: "The code as the store applied it to this price; empty when none applied" }
        discount_code_status: { type: string, x-luckylanding-known-values: ["", applied, not_applied, unsupported], description: "What happened to the code, as `CheckoutPaymentState` reports it" }
        shipping_options: { type: array, items: { $ref: "#/components/schemas/CheckoutDeliveryOption" }, description: "The store's rates for this address, in the store's order; empty when nothing ships" }
        shipping_rate_handle: { type: string, description: "The rate this price includes; empty when nothing ships or the store offers no rate" }
    CheckoutDeliveryOption:
      type: object
      required: [handle, code, source, title, amount]
      properties:
        handle: { type: string }
        code: { type: string }
        source: { type: string }
        title: { type: string }
        amount:
          type: object
          required: [minor, currency, currency_exponent]
          properties:
            minor: { type: integer, format: int64 }
            currency: { type: string }
            currency_exponent: { type: integer, minimum: 0, description: "Decimal places of the currency's minor unit (ISO 4217): show the minor-unit amounts with exactly this many fraction digits" }
    CheckoutRecoveryParams:
      type: object
      additionalProperties: false
      required: [generation_id]
      properties:
        generation_id: { type: string, pattern: "^payment_generation_[0-7][0-9a-hjkmnp-tv-z]{25}$" }
    CheckoutStatusParams:
      type: object
      additionalProperties: false
      required: [generation_id]
      properties:
        generation_id: { type: string, pattern: "^payment_generation_[0-7][0-9a-hjkmnp-tv-z]{25}$" }
        verify_wallet: { type: boolean, description: "For wallet authorization, a ready generation needs an active processor binding and the same saved contact it was priced for. A missing or changed contact makes the quote expired." }
    CheckoutOfferDeclineParams:
      type: object
      additionalProperties: false
      required: [generation_id]
      properties:
        generation_id: { type: string, pattern: "^payment_generation_[0-7][0-9a-hjkmnp-tv-z]{25}$" }
        declined_offer_id: { type: string, pattern: "^offer_[0-7][0-9a-hjkmnp-tv-z]{25}$", description: "The offer the shopper answered No thanks to. When another offer is open by now, the call records nothing and answers with the open one, so a retry or a second tab never declines an offer the shopper didn't see" }
    CheckoutOfferAcceptParams:
      type: object
      additionalProperties: false
      required: [offer_id, generation_id]
      properties:
        offer_id: { type: string, pattern: "^offer_[0-7][0-9a-hjkmnp-tv-z]{25}$" }
        generation_id: { type: string, pattern: "^payment_generation_[0-7][0-9a-hjkmnp-tv-z]{25}$" }
    CheckoutPaymentState:
      type: object
      required: [type, state, decline_class, kind, lines, generation_id, account_id, environment, currency, currency_exponent, amount, subtotal_minor, tax_minor, discount_minor, shipping_minor, tax_inclusive, saving, client_secret, action_url, expires_at, next_offer, hold_remaining_ms, check_ends_in_ms, paid_late, requires_shipping, ships_with_order, shipping_options, shipping_rate_handle, discount_code, discount_code_status, order_id, reference, free]
      properties:
        order_protection: { $ref: "#/components/schemas/CheckoutProtectionTerms" }
        type: { type: string, const: checkout_payment }
        decline_class: { type: [string, "null"], x-luckylanding-known-values: [never, new_details, later, generic, not_taken], description: "While `state` is `declined`: the shopper's next step. `never`: this card won't be approved, so pay another way. `new_details`: check the card details or use another card. `later`: try again later or pay another way. `generic`: every other decline, including one the processor gave no advice for, one whose reason the processor says to present as a generic decline (such as a lost or stolen card), and a failure after the processor made a payment without declining it, or a rejection before submission. `not_taken`: the processor explicitly refused to take the charge for the store before creating a payment. A rejected token or payment method keeps its existing response. The store can't take this payment right now. A processor throttle uses the processor_busy response. It is never the decline's code or reason, and it refuses no further payment. Null in every other state" }
        requires_shipping: { type: boolean }
        hold_remaining_ms: { type: [integer, "null"], format: int64, minimum: 0, description: "While the store holds the paid order for the answer to its post-purchase offer: milliseconds, measured on the server as it answered, until it writes the order without one. Present on the original payment and on an upsell quote for it. Null otherwise" }
        check_ends_in_ms: { type: [integer, "null"], format: int64, minimum: 0, description: "While `state` is `processing` and the processor has given LL no answer for the charge it sent: milliseconds, measured on the server as it answered, until the processor's quote has been expired for an hour. If a read then shows no payment on it, LL ends the attempt unpaid without sending it again, and the attempt reads `expired`, so the shopper can pay on a new one. 0 once that time has passed and LL has not ended it yet. Null otherwise, including once the processor has answered" }
        paid_late: { type: boolean, description: "True when this payment succeeded after Lucky Landing had ended the attempt unpaid and it read `expired`; its order is placed as for any paid payment. False otherwise" }
        ships_with_order: { type: boolean, description: "True when this post-purchase offer's items join the original order the store is still holding for the shopper's answer: they ship with it, so no delivery choice is needed and shipping_minor is the offer's flat shipping fee, 0 when it ships free" }
        shipping_options: { type: array, items: { $ref: "#/components/schemas/CheckoutDeliveryOption" } }
        shipping_rate_handle: { type: string }
        submitted_discount_code: { type: string, description: "The code submitted for this quote, including an empty string for no code." }
        discount_code: { type: string, description: "The code the store applied to this price, as the store spells it; empty when none applied" }
        discount_code_status: { type: string, x-luckylanding-known-values: ["", applied, not_applied, unsupported], description: "What happened to the code sent with prepare: empty when none was sent; `not_applied` when the store skipped it (unknown, expired, used up or not eligible); `unsupported` when it discounts only some items or is buy X get Y, which this checkout can't record, so the price excludes it" }
        order_id: { type: string }
        reference: { type: string, description: "The purchase reference the shopper quotes to the store; set in `review`, `order_review` and `paid_twice`, where it is the purchase whose order it is (for an upsell that joined an order, that order's purchase), and in `paid_pending_fulfilment` once the store's answer to the order was lost and LL is looking for it; empty otherwise" }
        lines: { type: array, items: { $ref: "#/components/schemas/CheckoutPaymentLine" } }
        offer_id: { type: string, description: "The offer this payment buys; absent for a store cart, which has no offer" }
        kind: { type: string, x-luckylanding-known-values: [original, saved_card] }
        state: { type: string, x-luckylanding-known-values: [ready, requires_action, processing, declined, paid_pending_fulfilment, expired, checkout_required, name_required, delivery_required, shipping_required, shipping_unsupported, order_confirmed, review, order_review, paid_twice, code_refused], description: "`name_required`: the shopper's name is blank, or has no space and came without its given and family name, so nothing was priced or charged. `code_refused`: a free order's discount code stopped applying before the store took the order, so nothing was placed and nothing was charged; the shopper prepares again without it. `review`: the payment was refunded before the store created an order, so none was placed. `paid_twice`: this payment was taken as well as another for the same checkout, so it has no order of its own and the store can refund it. `order_review`: the payment is kept and the store has not confirmed the order, so a person at the store resolves it; the page shows the reference and the store's contact and never offers to pay again (CHK-R16)" }
        generation_id: { type: string }
        account_id: { type: string }
        environment: { type: string, x-luckylanding-known-values: [sandbox, production] }
        currency: { type: string }
        currency_exponent: { type: integer, minimum: 0, description: "Decimal places of the currency's minor unit (ISO 4217): show the minor-unit amounts with exactly this many fraction digits" }
        amount: { type: integer, format: int64 }
        subtotal_minor: { type: integer, format: int64 }
        tax_minor: { type: integer, format: int64 }
        discount_minor: { type: integer, format: int64 }
        shipping_minor: { type: integer, format: int64 }
        tax_inclusive: { type: boolean }
        saving: { type: string, x-luckylanding-known-values: ["", on_session, off_session] }
        client_secret: { type: [string, "null"], description: "While the processor holds this payment open (`processing` or `requires_action`): the credential the page hands to Whop Elements' handleNextAction, which shows a bank step only when the bank asks for one; null otherwise; always null from the status read, which reads only LL's record" }
        action_url: { type: [string, "null"], format: uri, description: "While `state` is `requires_action` and the processor gave no `client_secret`: the bank's page where the shopper verifies this payment, opened as a full page; it returns to the checkout, which reads the payment again" }
        expires_at: { type: string, format: date-time }
        next_offer: { anyOf: [{ $ref: "#/components/schemas/CheckoutPublishedOffer" }, { type: "null" }] }
        free: { type: boolean, description: "True when the store priced this order at zero: there is nothing to pay, so the page mounts no card fields or wallets and places the order with placeCheckoutOrder instead of confirming a payment" }
    CheckoutSessionSnapshot:
      type: object
      required: [type, session_id, hostname, state, expires_at, store, currency, currency_exponent, lines, totals, discount_code, wallets, order_ref, attribution, email, name, name_source, given_name, family_name, delivery_address, location, countries, address_rules, account_id, processor, environment, offer_ends_in_ms, design]
      properties:
        payment_controls_closed: { type: boolean, description: "True when this session can show a recorded store refusal but its connection can no longer take a payment." }
        order_protection: { $ref: "#/components/schemas/CheckoutProtectionTerms" }
        design: { oneOf: [{ $ref: "#/components/schemas/CheckoutDesign" }, { type: "null" }], description: "The audited design pinned at session start. Without a published design, merchants created after the rollout started receive the built-in one-page layout. A null value draws the standard stepped checkout." }
        published_theme: { $ref: "#/components/schemas/CheckoutPublishedTheme" }
        attribution: { $ref: "#/components/schemas/CheckoutAttribution" }
        name: { type: [string, "null"], description: "The full name of the session's current payment, for this shopper only; null before one is prepared." }
        name_source: { type: [string, "null"], x-luckylanding-known-values: [typed, apple_pay, google_pay, paypal], description: "Where `name` came from, as prepare took it; null when typed or before one is prepared." }
        given_name: { type: [string, "null"], description: "The given name the shopper typed for a name the server can't split; null otherwise, including when the server split the name." }
        family_name: { type: [string, "null"], description: "The family name the shopper typed for a name with no space; null otherwise, as `given_name` is." }
        email: { type: [string, "null"], description: "The shopper's own email from the checkout's email field, for this shopper only; null until it is saved." }
        delivery_address: { anyOf: [{ $ref: "#/components/schemas/CheckoutDeliveryAddress" }, { type: "null" }], description: "The delivery address of the session's current payment, for this shopper only, so the payment step can show where the order ships after a reload; null when that payment was priced on a location alone." }
        location: { anyOf: [{ $ref: "#/components/schemas/CheckoutLocation" }, { type: "null" }], description: "The country, state and postal code the session's current payment was priced on when its order has nothing to ship, for this shopper only, so the form and the card's billing details refill them after a reload; null otherwise." }
        processor: { type: string, x-luckylanding-known-values: [whop], description: "The processor whose card fields and express buttons the payment step mounts, fixed for the session. The page mounts nothing for a processor it has no fields for." }
        environment: { type: string, x-luckylanding-known-values: [sandbox, production], description: "The processor environment of the session's store and account, including before a wallet starts a quote." }
        account_id: { type: string, description: "The merchant's account at `processor` that the payment step and its express buttons mount on" }
        countries: { type: array, items: { type: string, pattern: "^[A-Z]{2}$" }, description: "The ISO 3166-1 alpha-2 codes the shopper picks the address's country from, set when the session started: the countries the store ships to, as the store listed them, when an item ships, or every country the store's platform lists when none does." }
        address_rules: { type: array, items: { $ref: "#/components/schemas/CheckoutAddressRule" }, description: "How the address form asks for the state and postal code in each of `countries` that has a rule, from the Shopify/worldwide address data LL embeds, so the state sent is that data's province code. A country with no entry takes any state and postal code." }
        offer_id: { type: string }
        offer_ends_in_ms: { type: [integer, "null"], format: int64, minimum: 0, description: "For a session started from a landing offer whose countdown is on: milliseconds until the offer's `expires_at`, measured on the server as it answered, after which it can't be priced or paid. Null otherwise" }
        payment: { anyOf: [{ $ref: "#/components/schemas/CheckoutPaymentState" }, { type: "null" }] }
        type: { type: string, const: checkout_session }
        session_id: { type: string }
        hostname: { type: string }
        state: { type: string, x-luckylanding-known-values: [prepared, draft_intent, draft_ready, payable, payment_intent, processing, complete, review] }
        expires_at: { type: string, format: date-time }
        store: { $ref: "#/components/schemas/CheckoutStore" }
        currency: { type: string }
        currency_exponent: { type: integer, minimum: 0, description: "Decimal places of the currency's minor unit (ISO 4217): show the minor-unit amounts with exactly this many fraction digits" }
        lines: { type: array, items: { $ref: "#/components/schemas/CheckoutLine" } }
        totals: { $ref: "#/components/schemas/CheckoutTotals" }
        discount_code: { type: [string, "null"], description: "The discount code the store's cart handed over, which the store prices when the payment is prepared and `totals` doesn't include yet; null when the cart carried none." }
        wallets: { $ref: "#/components/schemas/CheckoutWallets" }
        order_ref: { type: [string, "null"] }
    CheckoutPublishedTheme:
      type: object
      required: [source, renderer]
      properties:
        source: { $ref: "#/components/schemas/CheckoutThemeSource" }
        renderer: { type: string, description: The renderer that passed the audit for the authored source. }
    CheckoutPurchaseTags:
      type: object
      required: [type, session_id, load, meta_limited_data_use, meta_pixel_ids, meta_match_keys, google, purchases]
      properties:
        type: { type: string, const: checkout_purchase_tags }
        session_id: { type: string }
        load: { type: boolean, description: "Whether the thank-you document loads a tag frame: tracking's consent rule allows tags for this shopper, and the org connected a Meta pixel or saved a Google tag." }
        meta_limited_data_use: { type: boolean, description: "The pixel sends Meta's Limited Data Use: the shopper sent GPC or opted out in the US." }
        meta_pixel_ids: { type: array, items: { type: string, pattern: "^[1-9][0-9]{0,19}$" }, description: "Each Meta pixel (dataset) the org connected." }
        meta_match_keys: { $ref: "#/components/schemas/CheckoutMetaMatchKeys" }
        google: { anyOf: [{ $ref: "#/components/schemas/CheckoutGoogleTag" }, { type: "null" }], description: "The Google tag the frame on LL's tags host runs; null when the consent rule loads no tag or the org saved no Google tag." }
        purchases: { type: array, items: { $ref: "#/components/schemas/CheckoutTaggedPurchase" } }
    CheckoutMetaMatchKeys:
      type: object
      description: "The SHA-256 match keys the Conversions API sends for this session's confirmed payment attempt and verified payment, normalised as Meta asks, for the pixel's advanced matching, so the browser and server Purchase carry the same keys. Never plain values; each is null when the shopper gave no such detail or the consent rule loads no tag."
      required: [em, ph, fn, ln, ct, st, zp, country, external_id]
      properties:
        em: { type: [string, "null"], pattern: "^[0-9a-f]{64}$" }
        ph: { type: [string, "null"], pattern: "^[0-9a-f]{64}$" }
        fn: { type: [string, "null"], pattern: "^[0-9a-f]{64}$" }
        ln: { type: [string, "null"], pattern: "^[0-9a-f]{64}$" }
        ct: { type: [string, "null"], pattern: "^[0-9a-f]{64}$" }
        st: { type: [string, "null"], pattern: "^[0-9a-f]{64}$" }
        zp: { type: [string, "null"], pattern: "^[0-9a-f]{64}$" }
        country: { type: [string, "null"], pattern: "^[0-9a-f]{64}$" }
        external_id: { type: [string, "null"], pattern: "^[0-9a-f]{64}$", description: "The hash of the checkout session ID, as the Conversions API sends it." }
    CheckoutGoogleTag:
      type: object
      required: [ads_tag_id, ads_purchase_label, ga4_measurement_id, consent_default, gclid, gbraid, wbraid, ga_client_id, ga_session_id, user_data]
      properties:
        ads_tag_id: { type: [string, "null"], pattern: "^AW-[1-9][0-9]{4,18}$" }
        ads_purchase_label: { type: [string, "null"], pattern: "^[A-Za-z0-9_-]{1,64}$" }
        ga4_measurement_id: { type: [string, "null"], pattern: "^G-[A-Z0-9]{4,20}$" }
        consent_default: { $ref: "#/components/schemas/CheckoutGoogleConsent" }
        gclid: { type: [string, "null"], minLength: 1, maxLength: 512, pattern: "^[^\\x00-\\x1f\\x7f-\\x9f]+$", description: "The session's click IDs from its handoff, or else from the store's Google click cookies (`_gcl_aw`, `_gcl_ag`, `_gcl_gb`), since the frame can't read the store's Google cookies or URL." }
        gbraid: { type: [string, "null"], minLength: 1, maxLength: 512, pattern: "^[^\\x00-\\x1f\\x7f-\\x9f]+$" }
        wbraid: { type: [string, "null"], minLength: 1, maxLength: 512, pattern: "^[^\\x00-\\x1f\\x7f-\\x9f]+$" }
        ga_client_id: { type: [string, "null"], pattern: "^[0-9]{1,20}\\.[0-9]{1,20}$", description: "The GA client ID from the store's `_ga` cookie." }
        ga_session_id: { type: [string, "null"], pattern: "^[0-9]{1,20}$", description: "The store's GA4 session ID from its `_ga_<container>` cookie for this measurement ID, so the purchase joins the shopper's session." }
        user_data: { anyOf: [{ $ref: "#/components/schemas/CheckoutGoogleUserData" }, { type: "null" }], description: "The shopper's own details for enhanced conversions, in Google's `user_data` shape; null when the session has none." }
    CheckoutGoogleUserData:
      type: object
      description: "Email, phone and name are SHA-256 hashes normalised as Google asks, which differs from Meta's normalisation; the postcode and country are unhashed, as Google requires."
      required: [sha256_email_address, sha256_phone_number, address]
      properties:
        sha256_email_address: { type: [string, "null"], pattern: "^[0-9a-f]{64}$" }
        sha256_phone_number: { type: [string, "null"], pattern: "^[0-9a-f]{64}$", description: "The hash of the phone number in E.164." }
        address: { anyOf: [{ $ref: "#/components/schemas/CheckoutGoogleAddress" }, { type: "null" }], description: "Null unless the order ships and its given name, family name, postcode and country are all known, which Google needs together." }
    CheckoutGoogleAddress:
      type: object
      required: [sha256_first_name, sha256_last_name, postal_code, country]
      properties:
        sha256_first_name: { type: string, pattern: "^[0-9a-f]{64}$" }
        sha256_last_name: { type: string, pattern: "^[0-9a-f]{64}$" }
        postal_code: { type: string, minLength: 1, maxLength: 20, pattern: "^[^\\x00-\\x1f\\x7f-\\x9f]+$" }
        country: { type: string, pattern: "^[A-Z]{2}$" }
    CheckoutGoogleConsent:
      type: object
      required: [ad_storage, ad_user_data, ad_personalization, analytics_storage]
      properties:
        ad_storage: { type: string, x-luckylanding-known-values: [granted, denied] }
        ad_user_data: { type: string, x-luckylanding-known-values: [granted, denied] }
        ad_personalization: { type: string, x-luckylanding-known-values: [granted, denied] }
        analytics_storage: { type: string, x-luckylanding-known-values: [granted, denied] }
    CheckoutTaggedPurchase:
      type: object
      required: [event_id, transaction_id, value_minor, currency, currency_exponent, contents]
      properties:
        event_id: { type: string, minLength: 1, maxLength: 64, pattern: "^[A-Za-z0-9_-]+$", description: "The event ID of the Purchase the server sends to Meta's Conversions API; the pixel sends it as eventID, so Meta keeps one of the two." }
        transaction_id: { type: string, minLength: 1, maxLength: 64, pattern: "^[A-Za-z0-9_-]+$", description: "LL's purchase ID, sent to Google as transaction_id." }
        value_minor: { type: integer, format: int64, minimum: 0 }
        ga4: { $ref: "#/components/schemas/CheckoutGA4Purchase" }
        currency: { type: string, pattern: "^[A-Z]{3}$" }
        currency_exponent: { type: integer, minimum: 0, description: "Decimal places of the currency's minor unit (ISO 4217)" }
        contents: { type: array, items: { $ref: "#/components/schemas/CheckoutTaggedContent" }, description: "What the purchase bought, as the Conversions API's Purchase names it, so the pixel's copy matches the merchant's Meta catalog too." }
    CheckoutGA4Purchase:
      type: object
      required: [items]
      properties:
        value_minor: { type: integer, format: int64, minimum: 0, description: "Discounted merchandise revenue excluding shipping and tax. Omitted when historical pricing does not identify it." }
        shipping_minor: { type: integer, format: int64, minimum: 0, description: "Shipping after shipping discounts, excluding tax." }
        tax_minor: { type: integer, format: int64, minimum: 0 }
        items:
          type: array
          items:
            type: object
            required: [id, quantity]
            properties:
              id: { $ref: "#/components/schemas/StoreKey" }
              quantity: { type: integer, minimum: 1 }
              price_minor: { type: integer, format: int64, minimum: 0, description: "Unit merchandise price after discounts and excluding tax, when separately identifiable." }
    CheckoutTaggedContent:
      type: object
      required: [id, quantity, unit_minor]
      properties:
        id: { $ref: "#/components/schemas/StoreKey", description: "The variant's content ID, which the store's catalog in Meta keys its items by." }
        quantity: { type: integer, minimum: 1 }
        unit_minor: { type: integer, format: int64, minimum: 0, description: "The unit price in the purchase currency's minor unit." }
    CheckoutAddressRule:
      type: object
      required: [country, provinces, state_required, state_shown_as_code, postal_required, postal_pattern]
      properties:
        country: { type: string, pattern: "^[A-Z]{2}$" }
        provinces: { type: array, items: { $ref: "#/components/schemas/CheckoutProvince" }, description: "The states, provinces or regions the shopper picks from, in the address data's order; empty when the country's addresses carry none, and the shopper may then type any." }
        state_required: { type: boolean, description: "A province must be picked." }
        state_shown_as_code: { type: boolean, description: "An address shows its province by code, as US \"NY\" does, rather than by name." }
        postal_required: { type: boolean, description: "A postal code must be given." }
        postal_pattern: { type: string, description: "An ECMAScript pattern a given postal code matches once NFKC-normalised, trimmed and upper-cased: as typed, or stripped of the separators the address data drops and then bare, prefixed with the country's code, or with one space, hyphen or double space put back; empty when any is taken, including a territory whose one postal code the address data fills in." }
    CheckoutProvince:
      type: object
      required: [code, name]
      properties:
        code: { type: string, description: "The province's code in the address data, sent as the address's state" }
        name: { type: string }
    CheckoutStore:
      type: object
      required: [name, url, logo_url, support_email, policies]
      properties:
        name: { type: string }
        url: { type: [string, "null"], description: "For a session the store's cart started, the origin of the store page that handed the cart over, where the store's own checkout takes the same cart when this one can't; null for a session an offer started." }
        logo_url: { type: [string, "null"], description: "The logo of the project's published checkout design (`logo_url`) when the session started; null when it has none." }
        support_email: { type: [string, "null"] }
        policies: { type: array, items: { $ref: "#/components/schemas/CheckoutStorePolicy" }, description: "The store's own refund, shipping, privacy and terms pages, as the store published them when the offer was published; a policy the store hasn't written is left out." }
        cart_url: { type: string, description: "Shopify-verified storefront cart URL for this session, absent when no verified return is available." }
    CheckoutStorePolicy:
      type: object
      required: [type, title, url]
      properties:
        type: { type: string, x-luckylanding-known-values: [REFUND_POLICY, SHIPPING_POLICY, PRIVACY_POLICY, TERMS_OF_SERVICE] }
        title: { type: string }
        url: { type: string }
    CheckoutTotals:
      type: object
      required: [subtotal, discount, shipping, tax, total]
      properties:
        subtotal: { type: integer, format: int64 }
        discount: { type: integer, format: int64 }
        shipping: { type: [integer, "null"], format: int64 }
        tax: { type: integer, format: int64 }
        total: { type: integer, format: int64 }
    CheckoutWallets:
      type: object
      required: [apple_pay, google_pay, paypal]
      properties:
        apple_pay: { type: boolean }
        google_pay: { type: boolean }
        paypal: { type: boolean }
    CheckoutLine:
      type: object
      required: [title, variant_title, quantity, line_amount, image_url]
      properties:
        requires_shipping: { type: boolean }
        title: { type: string }
        variant_title: { type: [string, "null"] }
        quantity: { type: integer }
        line_amount: { type: integer, format: int64 }
        image_url: { type: [string, "null"] }
    CheckoutConfirmParams:
      type: object
      additionalProperties: false
      required: [generation_id, confirmation_token]
      properties:
        generation_id: { type: string, pattern: "^payment_generation_[0-7][0-9a-hjkmnp-tv-z]{25}$" }
        confirmation_token: { type: string, minLength: 1, maxLength: 4096 }
    Problem:
      type: object
      description: RFC 9457 problem details, with the members an agent needs to act on it.
      required: [type, title, status, code, request_id, retryable]
      properties:
        type: { type: string, format: uri, description: "The code's documentation page, https://luckylanding.io/errors/<code>" }
        title: { type: string, description: "The code's summary; the same for every occurrence" }
        status: { type: integer, description: "The HTTP status" }
        detail: { type: string, description: "What went wrong this time, for a person or an agent" }
        code: { type: string, description: "The stable machine code, one of components.x-luckylanding-problems. Branch on it, not on title or detail" }
        request_id: { type: string, description: "The request-id header; include it when contacting support" }
        retryable: { type: boolean, description: "The same request can succeed later; wait Retry-After when it is set" }
        fix_hint: { type: string, description: "The next step that fixes this occurrence" }
        required_scope: { type: string, description: "The scopes the token could take, space-separated, on insufficient_scope: any one of them lets it in" }
        errors: { type: array, description: One entry per invalid input, items: { $ref: "#/components/schemas/ProblemField" } }
    ProblemField:
      type: object
      required: [detail]
      properties:
        detail: { type: string, description: "What is wrong with this input" }
        pointer: { type: string, description: "JSON Pointer (RFC 6901) to the invalid body member, e.g. #/overrides/daily_budget" }
        parameter: { type: string, description: "The invalid path, query or header parameter" }
    PaymentDisputeEvidence:
      type: object
      required: [type, payment_id, purchase_id, disputes, shopper_ip, name, shipping_address, order]
      properties:
        type: { type: string, const: payment_dispute_evidence }
        payment_id: { type: string }
        purchase_id: { type: string, description: "The order reference the shopper sees on their order status page." }
        disputes: { type: array, items: { $ref: "#/components/schemas/PaymentDispute" } }
        shopper_ip: { type: [string, "null"], description: "The shopper's IP address when the checkout session started; null when none was recorded." }
        name: { type: [string, "null"], description: "The full name the shopper gave for the purchase; null when none was recorded." }
        shipping_address: { oneOf: [{ $ref: "#/components/schemas/CheckoutDeliveryAddress" }, { type: "null" }] }
        order: { oneOf: [{ $ref: "#/components/schemas/PaymentDisputeOrder" }, { type: "null" }], description: "The store order's fulfilment, read from the store when asked; null when LL placed no order for the payment or the store does not return it. A Shopify store returns an order older than 60 days only once it has granted `read_all_orders` (spec D65)." }
    PaymentList:
      type: object
      examples: [{ data: [], has_more: false, first_id: null, last_id: null }]
      required: [data, has_more, first_id, last_id]
      properties:
        data: { type: array, items: { $ref: "#/components/schemas/Payment" } }
        has_more: { type: boolean }
        first_id: { type: [string, "null"] }
        last_id: { type: [string, "null"] }
    PaymentCounts:
      type: object
      required: [type, waiting_for_person, dispute_needs_response]
      properties:
        type: { type: string, const: payment_counts }
        waiting_for_person: { type: integer, format: int64, description: "How many payments `listPayments` returns with `state` set to `waiting_for_person`." }
        dispute_needs_response: { type: integer, format: int64, description: "How many payments `listPayments` returns with `state` set to `dispute_needs_response`." }
    PaymentSummary:
      type: object
      required: [type, from, to, gross_sales, paid_payments, answered_checkouts, approved_checkouts]
      properties:
        type: { type: string, const: payment_summary }
        from: { type: string, format: date-time }
        to: { type: string, format: date-time }
        gross_sales: { type: array, items: { $ref: "#/components/schemas/Money" }, description: "What the paid payments charged, refunds not taken off: one amount per currency, in currency order, never added across currencies; empty when nothing was paid." }
        paid_payments: { type: integer, format: int64, description: "How many payments are paid." }
        answered_checkouts: { type: integer, format: int64, description: "Checkout sessions in which the processor approved or declined a payment created in the period. A session counts once however many times its shopper tried in the period, so declined tries before a paid one count no decline; a session whose tries fall on both sides of the period's start or end counts in each period, on the tries made in it. A payment still pending or waiting for the shopper's bank, or one the processor holds no payment for, answers nothing." }
        approved_checkouts: { type: integer, format: int64, description: "Of `answered_checkouts`, the sessions with a paid payment. The approval rate is this divided by `answered_checkouts`, and there is none while that is 0." }
    Payment:
      type: object
      required: [type, id, purchase_id, store_id, rail, free, status, amount, refunded, refundable, order_id, order_name, order_url, order_source, order_review, order_review_end, order_review_endable, order_refunded_in_full, order_refusal, order_paid_twice, discount_over_limit, refunds, refund_request, store_refund, disputes, cases, case_check, created_at, observed_at, paid_at, ended_unpaid_at]
      properties:
        type: { type: string, const: payment }
        id: { type: string }
        purchase_id: { type: string, description: "The order reference the shopper sees on their order status page." }
        store_id: { type: string }
        rail: { type: string, x-luckylanding-known-values: [whop], description: "The processor that took the payment; empty for a free order, which no processor took." }
        free: { type: boolean, description: "True for a free order: a code took the whole total off, so nothing was paid and no processor was asked. Its `amount` is zero, its `status` is `succeeded` once the shopper placed it, and it has no refunds or disputes; its order, review, retry and placed-by-hand work as for any payment." }
        status: { type: string, x-luckylanding-known-values: [reserved, pending, processing, requires_action, succeeded, failed, canceled, disputed], description: "The payment's status as LL last read it from the rail. A refund leaves it unchanged; `refunded` and `refunds` show it." }
        amount: { $ref: "#/components/schemas/Money" }
        refunded: { $ref: "#/components/schemas/Money" }
        refundable: { type: boolean, description: "True when `refundPayment` would refund this payment now: it is paid, not disputed, not fully refunded and not free, and its store order is confirmed, its review ended (`order_review_end`), or it waits for a person while LL neither places nor looks for it and the store holds no order that doesn't match. False during placement or recovery and for `placement_unconfirmed`, including a previously ended review with this unresolved placement." }
        order_id: { type: [string, "null"], description: "The store's ID for the purchase's order, whether Lucky Landing placed it or a person recorded one they placed by hand (see `order_source`); for an upsell that joined another payment's order, that order. Null until Lucky Landing knows the store order ID. While `order_review` is set, it names an order Lucky Landing wrote that doesn't match what was paid, if the store has one: it stays in the store until a person cancels or fixes it there." }
        order_name: { type: [string, "null"], description: "The store's own name for `order_id`, as its admin shows it, such as `#1001` on Shopify. Null with no order, and for an order Lucky Landing confirmed before it kept names; show `order_id` then." }
        order_url: { type: [string, "null"], format: uri, description: "The page of `order_id` in the store's admin, for a person signed in to the store. Null with no order." }
        order_source: { type: [string, "null"], x-luckylanding-known-values: [lucky_landing, merchant], description: "Who placed `order_id`: `lucky_landing`, or `merchant` when a person placed it by hand and recorded it; null with no order." }
        order_review: { anyOf: [{ $ref: "#/components/schemas/OrderReviewReason" }, { type: "null" }], description: "Why the purchase’s store order needs review, or null when it doesn't (CHK-R16). It stays set while LL tries the order again, until the store has the order. The shopper's page shows them the reference of the purchase whose order it is and the store's contact." }
        order_review_endable: { type: boolean, description: "Whether `payments_end_order_review` ends this payment's review now: true only while `order_review` is set and Lucky Landing places no order for it, by the rule that endpoint applies. Read from what Lucky Landing has recorded." }
        order_refunded_in_full: { type: boolean, description: "While `order_review` is set, whether every payment of the order holding this payment, its own and any upsell joined to it, has succeeded refunds that reach its amount. False for a free order and with no review." }
        order_review_end: { anyOf: [{ $ref: "#/components/schemas/OrderReviewEnd" }, { type: "null" }], description: "Why the paid purchase no longer waits for a person though it has no order: refunded in full, or ended by a person with `payments_end_order_review`. Null while it waits, and for a payment whose order is in the store or was never in review. A dispute ends no review." }
        order_refusal: { anyOf: [{ $ref: "#/components/schemas/OrderRefusal" }, { type: "null" }], description: "What the store refused when `order_review` is `store_refused`; null for any other review, and with none." }
        order_paid_twice: { anyOf: [{ $ref: "#/components/schemas/OrderPaidTwice" }, { type: "null" }], description: "While `order_review` is `paid_twice`, or is `buyer_fee` and another payment of the checkout was recorded before this one, that other payment, the one the checkout's one order goes to, as it stands when this payment is read: what became of its order and where the two attempts differ, so a person refunds the right one, or, for `paid_twice`, places the order from this payment once the other gives none. Null for any other review and with none, and when Lucky Landing doesn't know the other payment." }
        discount_over_limit: { type: [string, "null"], description: "The discount code the store order was placed with after the code had reached a limit at the store, such as its total uses, between the shopper's payment and the order. Lucky Landing places the order as paid, discount included, and emails the store's owners. Null for every other order." }
        refunds: { type: array, items: { $ref: "#/components/schemas/PaymentRefund" } }
        refund_request: { anyOf: [{ $ref: "#/components/schemas/PaymentRefundRequest" }, { type: "null" }], description: "The latest refund asked of Lucky Landing for this payment, while it is not made: still waiting for the processor, or not made. Null when there is none, or once the processor shows it made (it is then in `refunds`)." }
        store_refund: { anyOf: [{ $ref: "#/components/schemas/PaymentStoreRefund" }, { type: "null" }], description: "A refund a person made on `order_id` in the store's admin, and what Lucky Landing did with it at the processor. Null when the store's admin shows no refund on this payment that Lucky Landing has seen." }
        disputes: { type: array, items: { $ref: "#/components/schemas/PaymentDispute" } }
        cases: { type: array, items: { $ref: "#/components/schemas/PaymentCase" }, description: "Whop Resolution Center cases on this payment, oldest first. A case is the step before a chargeback: the shopper complains to Whop, and Whop decides when the merchant doesn't settle it. Lucky Landing shows a case and acts on none; it is answered in Whop." }
        case_check: { anyOf: [{ $ref: "#/components/schemas/PaymentCaseCheck" }, { type: "null" }], description: "Set while this payment waits for a person after Lucky Landing refunded everything left of it into an open Whop Resolution Center case. Whop closes a case on any refund; Lucky Landing reads the payment's cases and Whop's refund records until the case is closed, and clears this once a read shows it closed with the shopper winning, paid from the merchant's balance, and that refund the payment's only refund record. Lucky Landing staff are alerted once when a read shows anything else. Only such a read clears it. It stops nothing on the payment, since nothing is left to refund. Null otherwise." }
        created_at: { type: string, format: date-time }
        observed_at: { type: string, format: date-time, description: "When LL last recorded the payment's status." }
        paid_at: { type: [string, "null"], format: date-time }
        ended_unpaid_at: { type: [string, "null"], format: date-time, description: "When Lucky Landing ended the payment unpaid without sending it again, since the processor never answered its charge and a read an hour past its quote's expiry showed no payment; null otherwise. With `status` `succeeded` or `disputed` it was paid late, after that end, and its order is placed as for any paid payment" }
    PaymentReviewEndParams:
      type: object
      additionalProperties: false
      required: [reason]
      properties:
        reason: { type: string, enum: [order_made_by_hand, no_order_needed], description: "`order_made_by_hand`: the person made the order in the store themselves; `no_order_needed`: the shopper is owed no order." }
    PaymentReviewEnd:
      type: object
      required: [type, payment_id, purchase_id, payment_ids, order_review_end]
      properties:
        type: { type: string, const: payment_review_end }
        payment_id: { type: string }
        purchase_id: { type: string, description: "The purchase whose order's review ended: the payment's own, or for an upsell that joined an order, that order's." }
        payment_ids: { type: array, items: { type: string }, description: "The payments the review ended for: the payment the order belongs to, then any upsell joined to it." }
        order_review_end: { $ref: "#/components/schemas/OrderReviewEnd" }
    OrderReviewEnd:
      type: object
      required: [reason, order_review, ended_at]
      properties:
        reason:
          type: string
          x-luckylanding-known-values: [refunded, order_made_by_hand, no_order_needed]
          description: "`refunded`: every payment of the order was refunded in full, so no order is owed; `order_made_by_hand`: a person said they made the order in the store themselves, which Lucky Landing doesn't link; `no_order_needed`: a person said the shopper is owed no order."
        order_review: { $ref: "#/components/schemas/OrderReviewReason", description: "The reason the payment waited for a person until then." }
        ended_at: { type: string, format: date-time }
    PaymentHandOrderParams:
      type: object
      additionalProperties: false
      required: [order]
      properties:
        order: { type: string, minLength: 1, maxLength: 512, description: "The store order's ID, or the address of its page in the store's admin" }
    PaymentHandOrder:
      type: object
      required: [type, payment_id, purchase_id, payment_ids, order_id, order_total, paid, order_review]
      properties:
        type: { type: string, const: payment_hand_order }
        payment_id: { type: string }
        purchase_id: { type: string, description: "The purchase whose order this is: the payment's own, or for an upsell that joined an order, that order's." }
        order_id: { type: [string, "null"], description: "The store's ID for the order placed by hand; null once undone." }
        payment_ids: { type: array, items: { type: string }, description: "The payments this order is for: the payment the order belongs to, then any upsell joined to it. Empty once undone." }
        order_total: { anyOf: [{ $ref: "#/components/schemas/Money" }, { type: "null" }], description: "The order's total as the store shows it to the customer, to compare with `paid`; null once undone." }
        paid: { anyOf: [{ $ref: "#/components/schemas/Money" }, { type: "null" }], description: "What was paid for this order, by all of `payment_ids`; null once undone." }
        order_review: { anyOf: [{ $ref: "#/components/schemas/OrderReviewReason" }, { type: "null" }], description: "The reason the payment waited for a person: the one it had, after recording; the one it has again, once undone." }
    PaymentOrderRetry:
      type: object
      required: [type, payment_id, purchase_id, outcome, order_id]
      properties:
        type: { type: string, const: payment_order_retry }
        payment_id: { type: string }
        purchase_id: { type: string, description: "The purchase whose order the retry acted on: the payment's own, or for an upsell that joined an order, that order's." }
        outcome: { type: string, x-luckylanding-known-values: [order_confirmed, order_placing, order_refused, code_refused, order_mismatch, unchanged] }
        order_id: { type: [string, "null"], description: "The store's ID for the order, as the store's platform names it; set for `order_confirmed` and `order_mismatch`, and for `unchanged` when the order was already placed." }
    PaymentRefundRequest:
      type: object
      required: [state, amount, requested_at, settled_at]
      properties:
        state: { type: string, x-luckylanding-known-values: [requested, not_made], description: "`requested`: Lucky Landing holds it and the processor has not confirmed it yet. `not_made`: the processor refused it or never showed it as made, and nothing was refunded for it." }
        amount: { $ref: "#/components/schemas/Money", description: "What this refund adds to the payment's refunded total." }
        requested_at: { type: string, format: date-time }
        settled_at: { type: [string, "null"], format: date-time, description: "When it ended as not made; null while it is requested." }
    PaymentStoreRefund:
      type: object
      required: [state, reason, refunded, refunded_before, sent]
      properties:
        state:
          type: string
          x-luckylanding-known-values: [pending, sent, matched, refused]
          description: |
            Lucky Landing makes the processor's refunded total match what the store shows refunded against this payment, and never sends more.
            - `pending`. The store shows a refund that Lucky Landing hasn't sent to the processor yet.
            - `sent`. Lucky Landing sent `sent` and is waiting for the processor to confirm it.
            - `matched`. The processor's refunded total matches the store's. When `refunded_before` is above zero, the processor had already refunded that much, so Lucky Landing sent only `sent`: the shopper got `refunded` back once, not twice.
            - `refused`. The processor hasn't refunded the shopper; `reason` says why and what to do.
        reason:
          type: [string, "null"]
          x-luckylanding-known-values: [order_unreadable, order_unmatched, currency, unattributed, not_refundable, reapproval_required, refund_in_review, refund_target, refund_blocked, processor_refused, processor_unconfirmed, whop_case, whop_case_partial]
          description: |
            Why the refund made in the store didn't reach the processor; null unless `state` is `refused`.
            - `order_unreadable`. The store doesn't return the order: it was deleted, it is older than the 60 days the store's app can read, or the store couldn't be read for a day.
            - `order_unmatched`. The order no longer matches the store Lucky Landing placed it in: the shop or its currency changed.
            - `currency`. The order is in more than one currency.
            - `unattributed`. The store's refund isn't tied to one of the order's payments, so Lucky Landing didn't split it.
            - `not_refundable`. The payment is disputed or not paid.
            - `reapproval_required`. The merchant has to approve refunds for Lucky Landing at the processor again.
            - `refund_in_review`. A refund the processor made doesn't match the one Lucky Landing asked for, and staff check it.
            - `refund_target`. The store shows more refunded than the payment can take, or in another currency, so nothing was sent.
            - `refund_blocked`. An earlier refund of the payment hasn't settled at the processor for a day, so nothing was sent.
            - `processor_refused`. The processor refused the refund.
            - `processor_unconfirmed`. The processor didn't confirm the refund Lucky Landing asked for within 8 days; the merchant checks it there.
            - `whop_case`. The payment's Whop Resolution Center case was decided, and the shopper may already be paid, so a refund could pay them twice; the merchant reads the case in Whop.
            - `whop_case_partial`. The payment has an open Whop Resolution Center case, which Whop closes on any refund, so Lucky Landing refunds only everything that is left; to settle for less, the merchant settles with the shopper in Whop.
        refunded: { anyOf: [{ $ref: "#/components/schemas/Money" }, { type: "null" }], description: "What the store shows refunded in total against this payment; null while `pending`, and while `refused` for a reason found before anything was asked of the processor." }
        refunded_before: { anyOf: [{ $ref: "#/components/schemas/Money" }, { type: "null" }], description: "What the processor had already refunded when Lucky Landing asked; set while `sent` and once `matched`, null otherwise. Read from the processor's refund request, not copied." }
        sent: { anyOf: [{ $ref: "#/components/schemas/Money" }, { type: "null" }], description: "While `sent`, what Lucky Landing asked the processor to refund and it hasn't confirmed; once `matched`, what it refunded, zero when the processor had refunded it all already. Null while `pending` or `refused`: a refused refund moved no money." }
    PaymentRefundTotal:
      type: object
      additionalProperties: false
      properties:
        refunded: { $ref: "#/components/schemas/Money", description: "The total the payment should have refunded once the call is done, in the payment's currency. Leave it out to refund everything." }
    PaymentRefundResult:
      type: object
      required: [type, payment_id, outcome, refunded]
      properties:
        type: { type: string, const: payment_refund_result }
        payment_id: { type: string }
        outcome: { type: string, x-luckylanding-known-values: [refunded, requested, unchanged, nothing_paid] }
        refunded: { $ref: "#/components/schemas/Money", description: "The payment's refunded total as LL has recorded it after the call." }
    OrderReviewReason:
      type: string
      x-luckylanding-known-values: [payment_unchecked, payment_disputed, draft_unconfirmed, placement_unconfirmed, store_refused, lost_reply, order_not_found, payment_refunded, buyer_fee, paid_twice]
      description: "`payment_disputed`: the processor reported a dispute before LL placed an order; review the dispute and mark the payment as dealt with; `payment_unchecked`: the recorded purchase has no sent order and current processor eligibility could not be verified; reconnect and retry to recheck it; `placement_unconfirmed`: a claimed order timed out without a returned store ID. The order may already exist. Check the original order with `payments_retry_order`; refund, hand placement and ending review are unavailable. `draft_unconfirmed`: LL could not send the order, the store refused the order this upsell had joined, or the one LL wrote doesn't match what was paid; `store_refused`: the store answered the order LL sent with a refusal and made no order, so there is none to find, and `order_refusal` says what it refused; while LL tries that order again it reads `draft_unconfirmed`; `lost_reply`: the store never answered the order LL sent and its search hasn't shown it, so the order may exist, and LL keeps looking and confirms it if it appears; `order_not_found`: the store never answered and LL stopped looking when its search window ended, so a person checks the store; `payment_refunded`: the payment was refunded before LL wrote the order; `buyer_fee`: the processor collected a buyer fee on it, and `order_paid_twice` names the checkout's other payment when one was recorded before it; `paid_twice`: the processor took a payment LL had shown as declined, so the checkout was paid twice, and `order_paid_twice` names the other payment and what became of its order"
    OrderPaidTwice:
      type: object
      required: [payment_id, purchase_id, amount, paid_at, order_name, order, differences]
      properties:
        payment_id: { type: string, description: "The other payment, whose purchase the checkout's one order goes to; this payment has none of its own." }
        purchase_id: { type: string, description: "The other payment's order reference, which the shopper's order status page shows them." }
        amount: { $ref: "#/components/schemas/Money", description: "The total the other payment was taken for; zero for a free order." }
        paid_at: { type: string, format: date-time, description: "When the other payment was paid, or a free order placed." }
        order_name: { type: [string, "null"], description: "The store's own name for the other payment's order, such as `#1001` on Shopify; null until the store has it, and for an order a person made by hand." }
        order: { type: string, x-luckylanding-known-values: [placed, placing, in_review, by_hand, none], description: "What became of the other payment's order, read when this payment is read. `placed`: the store has it, or a person made it by hand; `placing`: Lucky Landing is placing it; `in_review`: it waits for a person in the other payment's own review, which may still place it, so resolve that one first; `by_hand`: the other payment carries a buyer fee and is in its own `buyer_fee` review, so Lucky Landing never places its order and only a person can, by making it by hand, and a `paid_twice` payment beside it can take the order only once that review ends; `none`: it was not placed or was cancelled, so no order exists for this purchase. For a `paid_twice` review the person then places it from this payment with `payments_retry_order` or refunds this payment; for a `buyer_fee` review, whose order Lucky Landing never places, they make it by hand and end the review with `payments_end_order_review`, or refund this payment." }
        differences:
          type: [array, "null"]
          items: { type: string, x-luckylanding-known-values: [total, delivery_address, shipping, discount_code, unit_prices] }
          description: "Where the other payment's attempt differs from this one's, each attempt as it was priced when the shopper prepared it: `total`, `delivery_address`, `shipping` (the delivery option or its price), `discount_code` and `unit_prices`. Empty when they match. Null when Lucky Landing didn't compare this attempt with the other payment's, so a person checks both before refunding either."
    OrderRefusal:
      type: object
      required: [field, message]
      properties:
        field: { type: [string, "null"], description: "The input the store refused, as the path through its own API's order fields, such as `order.shippingAddress.firstName` on Shopify; null when the store named none." }
        message: { type: [string, "null"], description: "The store's own words for what it refused; null when it gave none, or when they could quote the shopper's details (an `@`, three digits or more, or any of the shopper's name, address or cart text), so LL kept only `field`." }
    PaymentRefund:
      type: object
      required: [id, status, amount, observed_at]
      properties:
        id: { type: string, description: "The processor's refund ID." }
        status: { type: string, x-luckylanding-known-values: [pending, requires_action, succeeded, failed, canceled] }
        amount: { $ref: "#/components/schemas/Money" }
        observed_at: { type: string, format: date-time, description: "When LL last recorded the refund's status." }
    PaymentCaseCheck:
      type: object
      description: "What Lucky Landing last read at Whop for a payment it refunded into an open Resolution Center case. The cases it read are the payment's `cases`."
      required: [since, read_at, refund_records]
      properties:
        since: { type: string, format: date-time, description: "When Lucky Landing sent that refund of everything left of the payment." }
        read_at: { type: [string, "null"], format: date-time, description: "When Lucky Landing last read the payment's cases and Whop's refund records for it since; null until the first read." }
        refund_records: { type: [integer, "null"], format: int64, minimum: 0, description: "How many refund records Whop held for the payment, in any state, at that read; the case closes cleanly with exactly one. Null until a read lists them, and when the last read couldn't." }
    PaymentCase:
      type: object
      description: "A Whop Resolution Center case, as Lucky Landing last read it from Whop. It holds nothing of the shopper's, and moves no money in Lucky Landing."
      required: [id, status, reason, amount, respond_by, escalated, appealed, outcome, refund, opened_at, updated_at]
      properties:
        id: { type: string, description: "Whop's case ID, prefixed `reso_`." }
        status: { type: string, x-luckylanding-known-values: [awaiting_merchant, awaiting_customer, under_review, closed], description: "Who the case waits on: the merchant, the shopper, or Whop, which is deciding; or `closed`, with `outcome` saying how." }
        reason: { type: string, description: "What the shopper says went wrong, in Whop's dispute vocabulary, such as `product_not_received`." }
        amount: { $ref: "#/components/schemas/Money" }
        respond_by: { type: [string, "null"], format: date-time, description: "When the next response is due, as Whop reports it. Null when nothing is due." }
        escalated: { type: boolean, description: "Whether Whop has stepped in to review the case." }
        appealed: { type: boolean, description: "Whether the shopper appealed a decision." }
        outcome: { type: [string, "null"], x-luckylanding-known-values: [customer_won, merchant_won, withdrawn], description: "Who prevailed, once the case closed. Null while it is open." }
        refund: { type: [string, "null"], x-luckylanding-known-values: [none, merchant, platform], description: "Whop's word for who paid the shopper once the case closed: `merchant` from the merchant's balance, `platform` when Whop paid and the merchant keeps the payment, or `none`. It is a label, never an amount: what was refunded is this payment's `refunded` and `refunds`. Null while the case is open, on a withdrawn case, where no money moved, and on a closed case Whop recorded no payer for, such as an older one, through which Lucky Landing refuses a refund." }
        opened_at: { type: string, format: date-time, description: "When the shopper opened the case." }
        updated_at: { type: string, format: date-time, description: "When Whop last changed the case." }
    PaymentDispute:
      type: object
      required: [id, status, amount, reason, evidence_due_at]
      properties:
        id: { type: string, description: "The processor's dispute ID." }
        status: { type: string, x-luckylanding-known-values: [needs_response, warning_needs_response, generating_response, under_review, warning_under_review, won, lost, prevented, warning_closed], description: "LL's status for the dispute, to which each processor's own status is mapped." }
        amount: { $ref: "#/components/schemas/Money" }
        reason: { type: string, description: "Why the shopper disputes the payment, as the processor reports it, such as `fraudulent` or `product_not_received`." }
        evidence_due_at: { type: [string, "null"], format: date-time }
    PaymentDisputeOrder:
      type: object
      required: [fulfillment_status, fulfillments]
      properties:
        fulfillment_status: { type: string, x-luckylanding-known-values: [UNFULFILLED, PARTIALLY_FULFILLED, FULFILLED, RESTOCKED, PENDING_FULFILLMENT, OPEN, IN_PROGRESS, ON_HOLD, SCHEDULED, REQUEST_DECLINED, FULFILLMENT_NOT_REQUIRED, OTHER], description: "LL's fulfilment status for the order, to which the store's own status is mapped; `OTHER` for a status LL doesn't name." }
        fulfillments: { type: array, items: { $ref: "#/components/schemas/PaymentDisputeFulfillment" } }
    PaymentDisputeFulfillment:
      type: object
      required: [status, created_at, tracking]
      properties:
        status: { type: string, x-luckylanding-known-values: [PENDING, OPEN, SUCCESS, CANCELLED, ERROR, FAILURE, OTHER], description: "LL's status for the shipment, to which the store's own status is mapped; `OTHER` for a status LL doesn't name." }
        created_at: { type: string, format: date-time }
        tracking: { type: array, items: { $ref: "#/components/schemas/PaymentDisputeTracking" } }
    PaymentDisputeTracking:
      type: object
      required: [company, number, url]
      properties:
        company: { type: [string, "null"] }
        number: { type: [string, "null"] }
        url: { type: [string, "null"], format: uri }
    Money:
      type: object
      additionalProperties: false
      required: [amount_minor, currency, currency_exponent]
      properties:
        amount_minor: { type: integer, format: int64, description: "Minor units: the amount times 10 to the power of `currency_exponent`" }
        currency: { type: string, pattern: "^[A-Z]{3}$" }
        currency_exponent: { type: integer, minimum: 0, description: "Decimal places of the currency's minor unit (ISO 4217): show the minor-unit amounts with exactly this many fraction digits" }
    ExactMoney:
      type: object
      additionalProperties: false
      required: [amount_minor, currency, currency_exponent]
      properties:
        amount_minor: { type: string, pattern: "^-?\\d+(\\.\\d+)?$", description: "Minor units as an exact decimal, fractions of a minor unit included, as the billing engine wrote them, such as `98.776` US cents: the amount times 10 to the power of `currency_exponent`" }
        currency: { type: string, pattern: "^[A-Z]{3}$" }
        currency_exponent: { type: integer, minimum: 0, description: "Decimal places of the currency's minor unit (ISO 4217)" }
    MoneyParams:
      type: object
      additionalProperties: false
      required: [amount_minor, currency]
      properties:
        amount_minor: { type: integer, format: int64, description: "Amount in ISO 4217 minor units." }
        currency: { type: string, pattern: "^[A-Z]{3}$" }
        currency_exponent: { type: integer, minimum: 0, description: "Optional. Must match currency." }
    Project:
      type: object
      required: [type, id, name]
      properties:
        type: { type: string, const: project }
        id: { type: string, pattern: "^project_[0-7][0-9a-hjkmnp-tv-z]{25}$" }
        name: { type: string }
    ProjectList:
      type: object
      required: [data, has_more, first_id, last_id]
      properties:
        data: { type: array, items: { $ref: "#/components/schemas/Project" } }
        has_more: { type: boolean }
        first_id: { type: [string, "null"] }
        last_id: { type: [string, "null"] }
    ProjectCreateParams:
      type: object
      additionalProperties: false
      required: [name]
      properties:
        name: { type: string, minLength: 1, maxLength: 120 }
    SessionProjectParams:
      type: object
      additionalProperties: false
      required: [project_id]
      properties:
        project_id: { type: string, pattern: "^project_[0-7][0-9a-hjkmnp-tv-z]{25}$" }
    CurrentSession:
      type: object
      required: [type, person_id, email, org_id, project_id, entitlements, permissions, project_grant_scopes, has_connected_app, policies_to_accept, mcp_url, org_closing]
      properties:
        type: { type: string, const: current_session }
        has_connected_app: { type: boolean, description: "The current person has an active MCP connection in the selected project." }
        person_id: { type: string }
        email: { type: string, description: "The signed-in person's own email address, as their sign-in provider gives it." }
        org_id: { type: string }
        project_id: { type: string }
        entitlements: { type: array, items: { type: string } }
        permissions:
          type: array
          items: { type: string }
          description: "What the person's role in the org allows: every scope it covers, such as `checkout:read` and `*:write`, and the named capability `org:team` (rename the org, manage members and invites, make and revoke API keys, and read the audit log). A client offers only these; the server checks each call again."
        project_grant_scopes: { type: array, items: { type: string }, description: "The project scopes this person may offer to a connected app." }
        policies_to_accept:
          type: array
          items: { $ref: "#/components/schemas/Policy" }
          description: "Each current version of Lucky Landing's policies the person has not accepted in this org, empty once they have accepted them all. Creating an org or joining one by invite accepts the versions current then; when a policy gets a new version, the dashboard asks the person to accept it with `acceptPolicies` before anything else. An agent can't accept for the person."
        mcp_url: { type: string, format: uri, description: "This deployment's MCP server, where an agent acts as the person, within their access, but can't change the team or API keys." }
        org_closing: { anyOf: [{ $ref: "#/components/schemas/OrgClosing" }, { type: "null" }], description: "Set while the session's org is closed, as `getOrg` gives it, so the dashboard shows its owners only when it is deleted and how to undo it; null otherwise." }
    Person:
      type: object
      required: [type, id, email, name]
      properties:
        type: { type: string, const: person }
        id: { type: string }
        email: { type: string, description: "The person's own email address, as their sign-in provider gives it." }
        name: { type: [string, "null"], description: "The name the person goes by, as they typed it or as their sign-in provider first gave it; null until either has." }
    Credential:
      type: object
      required: [type, operations]
      properties:
        type: { type: string, const: credential }
        operations:
          type: array
          items: { type: string }
          description: "The `operationId` of each operation that takes a credential and that this one may call now. A call can still be refused for the store or the record it names, or by a rule its own description gives, such as one only a person signed in to the dashboard may call."
    PersonUpdateParams:
      type: object
      additionalProperties: false
      required: [name]
      properties:
        name: { type: string, minLength: 1, maxLength: 120 }
    SessionOrgParams:
      type: object
      additionalProperties: false
      required: [org_id]
      properties:
        org_id: { type: string, pattern: "^org_[0-7][0-9a-hjkmnp-tv-z]{25}$", description: "An org the signed-in person is an active member of, from `listSessionOrgs`." }
    SessionOrg:
      type: object
      required: [type, id, name, closed]
      properties:
        type: { type: string, const: session_org }
        id: { type: string }
        name: { type: string }
        closed: { type: boolean, description: "Whether an owner has closed the org, so only its owners reach it until it is deleted (`getOrg`'s `closing`)." }
    SessionOrgList:
      type: object
      required: [data, has_more, first_id, last_id]
      properties:
        data: { type: array, items: { $ref: "#/components/schemas/SessionOrg" } }
        has_more: { type: boolean }
        first_id: { type: [string, "null"] }
        last_id: { type: [string, "null"] }
    Policy:
      type: object
      required: [document, version]
      properties:
        document: { type: string, x-luckylanding-known-values: [terms, privacy, acceptable_use], description: "`terms`: the Terms of service. `privacy`: the Privacy policy. `acceptable_use`: the Acceptable use policy." }
        version: { type: string, description: "The policy's version, a date as YYYY-MM-DD." }
    PolicyAcceptance:
      type: object
      required: [type, accepted]
      properties:
        type: { type: string, const: policy_acceptance }
        accepted:
          type: array
          items: { $ref: "#/components/schemas/Policy" }
          description: "The versions this request recorded; empty when the person had already accepted every current version."
    ReleaseAvailability:
      type: string
      x-luckylanding-known-values: [available, coming_soon, unavailable]
    DashboardProducts:
      type: object
      required: [type, org_id, project_id, products, steps]
      properties:
        type: { type: string, const: dashboard_products }
        org_id: { type: string }
        project_id: { type: string }
        payment_route_ready: { type: boolean, description: "Checkout can route a card under the current payment policy of at least one verified store the caller can read in this project." }
        products: { type: array, items: { $ref: "#/components/schemas/DashboardProduct" } }
        steps: { type: array, items: { $ref: "#/components/schemas/DashboardSetupStep" } }
    DashboardProduct:
      type: object
      required: [type, key, availability, held, accessible, agent_setup, setup_step_ids]
      properties:
        type: { type: string, const: dashboard_product }
        key: { type: string, x-luckylanding-known-values: [checkout, ad_canvas, customer_connect] }
        availability: { $ref: "#/components/schemas/ReleaseAvailability" }
        held: { type: boolean, description: "The organization holds this product through an active entitlement or an existing product grant." }
        accessible: { type: boolean, description: "The signed-in person can enter the product from this project. Checkout can be configured before purchase." }
        agent_setup: { type: boolean, description: "Agent-assisted setup is available for this product in the selected project." }
        setup_step_ids: { type: array, items: { type: string }, description: "Applicable IDs from steps, in setup order." }
    DashboardSetupStep:
      type: object
      required: [type, id, done]
      properties:
        type: { type: string, const: dashboard_setup_step }
        id: { type: string, x-luckylanding-known-values: [connect_store, connect_payments, turn_off_processor_tax, turn_off_processor_buyer_fee, add_domain, install_store_script, buy_product, connect_meta_ads] }
        done: { type: boolean }
    SetupStatus:
      type: object
      required: [type, org_id, project_id, connections, steps]
      properties:
        type: { type: string, const: setup_status }
        project_id: { type: string }
        org_id: { type: string }
        payment_route_ready: { type: boolean, description: "Checkout can route a card under the current payment policy of at least one verified store the caller can read in this project." }
        connections: { type: object, additionalProperties: { type: string }, description: "provider → status" }
        entitlements: { type: array, items: { type: string } }
        card_billing: { type: boolean, description: "Whether the org can add the checkout with its saved card here, as `buy_product` asks: billing by saved card is open and the checkout has a price in effect for the org. False otherwise: there an add answers `card_billing_off` or `not_on_sale`, Lucky Landing's staff turn the checkout on for the org, and `buy_product` is done once they have." }
        steps:
          type: array
          items: { $ref: "#/components/schemas/SetupStep" }
          description: "The steps this org needs, in the order a merchant can take them: the store, the payment processor, the checkout's domain and the theme first, none of which needs the checkout live, and `buy_product` last, which makes the checkout live so that it takes the store's payments and Lucky Landing starts billing for it."
    SetupStep:
      type: object
      required: [id, product, done]
      properties:
        id: { type: string, x-luckylanding-known-values: [connect_store, connect_payments, turn_off_processor_tax, turn_off_processor_buyer_fee, add_domain, install_store_script, buy_product] }
        product: { type: string, x-luckylanding-known-values: ["", checkout], description: "The product this step sets up; empty for a step every org takes" }
        done: { type: boolean, description: "Whether what the step asks for is true now, whatever the steps before it say" }
    StoreScript:
      type: object
      required: [type, script_tag, state, seen_at, install, install_reason, written_at]
      properties:
        type: { type: string, const: store_script }
        script_tag: { type: [string, "null"], description: "The line to paste just before </body> in the published theme's layout/theme.liquid; null until the checkout domain is verified" }
        state: { type: string, x-luckylanding-known-values: [missing, waiting, draft, seen, silent] }
        seen_at: { type: [string, "null"], format: date-time, description: "When a page of the published theme last reported the script; null if none has" }
        install: { type: string, x-luckylanding-known-values: [automatic, paste], description: "automatic: Lucky Landing writes the line into the published theme; paste: the person pastes script_tag" }
        install_reason: { type: [string, "null"], x-luckylanding-known-values: [domain_not_ready, scope_missing, refused, no_body_tag], description: "Why install is paste; null when it is automatic, or before Lucky Landing has tried" }
        written_at: { type: [string, "null"], format: date-time, description: "When Lucky Landing last wrote the line into the published theme, or found it there; null if it hasn't" }
    WaitlistParams:
      type: object
      additionalProperties: false
      required: [email, name, products, consent, consent_version, source, turnstile_token]
      properties:
        email: { type: string, format: email, maxLength: 254 }
        name: { type: string, minLength: 1, maxLength: 100 }
        products: { type: array, maxItems: 1, items: { type: string, enum: [checkout] } }
        consent: { type: boolean, enum: [true], description: The person agreed to be emailed about their request. }
        consent_version: { type: string, pattern: "^[0-9]{4}-[0-9]{2}-[0-9]{2}$", description: The date of the consent wording the person agreed to. }
        source: { type: string, enum: [site, ad_canvas], description: "The page the form was sent from, kept only for an address not yet on the waitlist, so a request stays with the page the person first asked from: `site` for /signup, `ad_canvas` for the Ad Canvas early-access page /ad-canvas" }
        turnstile_token: { type: string, minLength: 1, maxLength: 2048, description: "The token the form's Cloudflare Turnstile widget gave the browser. It is checked with Cloudflare once before the request is kept, and a token Cloudflare refuses is answered as an invalid field." }
    WaitlistConfirmParams:
      type: object
      additionalProperties: false
      required: [token]
      properties:
        token: { type: string, pattern: "^[A-Za-z0-9_-]{43}$", description: "The token from the link in LL's email." }
    WaitlistReceipt:
      type: object
      required: [type]
      properties:
        type: { type: string, const: waitlist_request }
    OrgCreateParams:
      type: object
      additionalProperties: false
      required: [name]
      properties:
        name: { type: string, minLength: 1, maxLength: 120 }
        referrer: { type: string, maxLength: 120 }
        invite_token: { type: string, pattern: "^[A-Za-z0-9_-]{43}$", description: "The token from a Lucky Landing invite to create an org. Production needs one until public launch." }
    OrgUpdateParams:
      type: object
      additionalProperties: false
      properties:
        name: { type: string, minLength: 1, maxLength: 120 }
    Org:
      type: object
      required: [type, id, name, etag, created_at, closing]
      properties:
        type: { type: string, const: org }
        etag: { type: string, description: "Strong entity tag of this version (RFC 9110); send it back in If-Match to change the resource." }
        id: { type: string }
        name: { type: string }
        created_at: { type: string, format: date-time }
        closing: { anyOf: [{ $ref: "#/components/schemas/OrgClosing" }, { type: "null" }], description: "Set while the org is closed, until an owner undoes it or it is deleted; null otherwise." }
    OrgClosing:
      type: object
      required: [closed_by, closed_at, deletes_at, reopenable]
      properties:
        closed_by: { type: string, description: "The email address of the owner who closed the org, or `Lucky Landing` when we closed it." }
        closed_at: { type: string, format: date-time }
        deletes_at: { type: string, format: date-time, description: "When Lucky Landing deletes the org and its data, unless an owner undoes the closing first." }
        reopenable: { type: boolean, description: "Whether an owner can undo the closing with `reopenOrg`: true unless Lucky Landing closed the org." }
    OrgCloseParams:
      type: object
      additionalProperties: false
      required: [name]
      properties:
        name: { type: string, minLength: 1, maxLength: 120, description: "The org's name exactly as it is, which confirms that the person means this org." }
    AssignableRole:
      type: string
      enum: [owner, admin, member]
      description: "The roles an invite or a role change can give. `owner` and `admin` reach every area, move money (refunds, the saved card and what is billed), rename the org and manage the team; only an `owner` closes the org or makes, changes or removes an owner. `member` reads and writes without moving money. Each can connect agents within its own access."
    Member:
      type: object
      required: [type, id, email, name, role, etag, created_at, ended_at]
      properties:
        type: { type: string, const: member }
        etag: { type: string, description: "Strong entity tag of this version (RFC 9110); send it back in If-Match to change the resource." }
        id: { type: string, description: "The person's ID" }
        email: { type: string }
        name: { type: [string, "null"], description: "The name the person goes by, which they choose themself; null when they have given none. It identifies nobody: a client shows it beside the email, or the email alone." }
        role: { type: string, x-luckylanding-known-values: [owner, admin, member] }
        created_at: { type: string, format: date-time, description: "When the person joined the org" }
        ended_at: { type: [string, "null"], format: date-time, description: "When the membership ended; null while the person belongs to the org" }
    MemberList:
      type: object
      required: [data, has_more, first_id, last_id]
      properties:
        data: { type: array, items: { $ref: "#/components/schemas/Member" } }
        has_more: { type: boolean }
        first_id: { type: [string, "null"] }
        last_id: { type: [string, "null"] }
    MemberUpdateParams:
      type: object
      additionalProperties: false
      required: [role]
      properties:
        role: { $ref: "#/components/schemas/AssignableRole" }
    Invite:
      type: object
      required: [type, id, email, role, status, mail, etag, created_at, expires_at]
      properties:
        type: { type: string, const: invite }
        etag: { type: string, description: "Strong entity tag of this version (RFC 9110); send it back in If-Match to change the resource." }
        id: { type: string }
        email: { type: string }
        role: { type: string, x-luckylanding-known-values: [owner, admin, member] }
        status: { type: string, x-luckylanding-known-values: [pending, accepted, revoked] }
        mail:
          type: string
          x-luckylanding-known-values: [sent, delivered, failed, undeliverable]
          description: "How the invite's email went: `sent` while Lucky Landing sends it or its mail provider holds it with no outcome yet, and `delivered` once the invitee's mail server took it. `failed` means the provider could not send it, so inviting the address again may work. `undeliverable` means the address bounced it, marked an earlier email as spam, is on the provider's suppression list or can't receive mail, so sending again won't help: revoke the invite and invite the right address."
        created_at: { type: string, format: date-time }
        expires_at: { type: string, format: date-time, description: "The link stops working at this time" }
    InviteList:
      type: object
      required: [data, has_more, first_id, last_id]
      properties:
        data: { type: array, items: { $ref: "#/components/schemas/Invite" } }
        has_more: { type: boolean }
        first_id: { type: [string, "null"] }
        last_id: { type: [string, "null"] }
    AgentGrant:
      type: object
      required: [type, id, project_id, project_name, person_id, client_id, scopes, etag, created_at, revoked_at]
      properties:
        type: { type: string, const: agent_grant }
        etag: { type: string, description: "Strong entity tag of this version (RFC 9110); send it back in If-Match to change the resource." }
        id: { type: string }
        project_id: { type: string }
        project_name: { type: string }
        person_id: { type: string, description: "The person who connected the app, and as whom it acts" }
        client_id: { type: [string, "null"], description: "The OAuth client ID from the first call. For a client identified by a metadata document, this is its HTTPS URL. Null until the app makes its first call." }
        mcp_reconnect_required: { type: boolean, description: "True when this grant uses a different issuer from the one the MCP resource accepts. Connect again from the MCP client to authorize that resource." }
        pending: { type: boolean, description: "The client has not presented its first access token. This request can be revoked before first use." }
        scopes: { type: array, items: { type: string }, description: "What the app may do, at most. Each call is also limited to what its person's role allows at that moment." }
        created_at: { type: string, format: date-time }
        revoked_at: { type: [string, "null"], format: date-time }
    AgentGrantList:
      type: object
      required: [data, has_more, first_id, last_id]
      properties:
        data: { type: array, items: { $ref: "#/components/schemas/AgentGrant" } }
        has_more: { type: boolean }
        first_id: { type: [string, "null"] }
        last_id: { type: [string, "null"] }
    ApiKey:
      type: object
      required: [type, id, name, scopes, created_by, etag, created_at, expires_at, revoked_at, last_used_at]
      properties:
        type: { type: string, const: api_key }
        etag: { type: string, description: "Strong entity tag of this version (RFC 9110); send it back in If-Match to change the resource." }
        id: { type: string }
        name: { type: string }
        scopes: { type: array, items: { type: string }, description: "What the key may do, in every store of the org" }
        created_by: { type: string, description: "The person who made the key. The key belongs to the org and keeps working when this person leaves or changes role." }
        created_at: { type: string, format: date-time }
        expires_at: { type: [string, "null"], format: date-time, description: "When the key stops working; `null` for a key that works until it is revoked" }
        revoked_at: { type: [string, "null"], format: date-time }
        last_used_at: { type: [string, "null"], format: date-time, description: "When the key last authenticated a request, to within an hour, since a use is recorded only once the recorded one is an hour old; `null` for a key never used" }
    ApiKeyList:
      type: object
      required: [data, has_more, first_id, last_id]
      properties:
        data: { type: array, items: { $ref: "#/components/schemas/ApiKey" } }
        has_more: { type: boolean }
        first_id: { type: [string, "null"] }
        last_id: { type: [string, "null"] }
    AuditEntry:
      type: object
      required: [type, id, actor_kind, actor_id, client_id, action, target, result, call_id, created_at]
      properties:
        type: { type: string, const: audit_entry }
        id: { type: string }
        actor_kind: { type: [string, "null"], x-luckylanding-known-values: [person, api_key, oauth, staff, service, shopper], description: "Who acted: a person in the dashboard, one of the org's API keys, an app acting as its person, Lucky Landing staff, a Lucky Landing service, or a shopper at checkout. `null` when Lucky Landing acted on its own, such as a sweep recording what a provider reported." }
        actor_id: { type: [string, "null"], description: "The ID of the person, API key, staff member, service or shopper who acted. An app names its person here and itself in `client_id`." }
        client_id: { type: [string, "null"], description: "The API key's ID or the app's client ID; `null` when no key or app was used" }
        action:
          type: string
          description: "What was done, one of the listed actions, such as `connection.disconnect` or `mcp.tool_call`. The list grows, so a client handles an action it does not know yet."
          x-luckylanding-exhaustive: true
          x-luckylanding-known-values:
            - billing.add
            - billing.card
            - billing.card_setup
            - billing.engine_call
            - billing.fee_rate
            - billing.grant
            - billing.managed
            - billing.tax_location
            - billing.pay
            - billing.price
            - billing.rail_call
            - billing.remove
            - billing.retire
            - checkout.design.publish
            - checkout.design.rollback
            - checkout.design.save
            - checkout.domain.check
            - checkout.domain.claim
            - checkout.domain.release
            - checkout.e2e_hostname.bind
            - checkout.hero_image.create
            - checkout.logo.create
            - checkout.offer_draft.create
            - checkout.offer_draft.pause
            - checkout.offer_draft.publish
            - checkout.offer_draft.rollback
            - checkout.offer_draft.save
            - checkout.payment.order_placed_by_hand
            - checkout.payment.order_placed_by_hand.undo
            - checkout.payment.order_review.end
            - checkout.payment.place_order
            - checkout.payment.refund
            - checkout.routing_policy.set
            - checkout.tracking.save
            - checkout.wallet_domain.left_at_processor
            - commerce.store_refund.follow
            - connection.connect
            - connection.disconnect
            - connection.link.create
            - connection.processor_settings.check
            - connection.store_script.write
            - connection.test_event
            - connection.test_key
            - connection.uninstall
            - identity.agent_grant.create
            - identity.agent_grant.revoke
            - identity.api_key.create
            - identity.api_key.revoke
            - identity.project.create
            - identity.session.switch_project
            - identity.support_access
            - identity.org.close
            - identity.org.erase
            - identity.org.reopen
            - identity.org_invite.issue
            - identity.org_invite.use
            - identity.policies.accept
            - identity.session.switch_org
            - mcp.tool_call
            - outreach.alert.dismiss
            - outreach.allowlist.add
            - outreach.allowlist.remove
            - outreach.budget.maximum
            - outreach.budget.set
            - outreach.conversation.delete
            - outreach.draft.approve
            - outreach.draft.reject
            - outreach.flow.create
            - outreach.flow.update
            - outreach.persona.create
            - outreach.persona.delete
            - outreach.persona.update
            - outreach.product.eligibility
            - staff.read
            - staff.scopes.set
            - staff.sign_in
            - staff.write
            - stripe.merchant_token
            - stripe.platform_key
            - whop.app_key
            - whop.merchant_token
        target: { type: string, description: "The ID or name of what the action was done to" }
        result: { type: string, description: "How the action ended, such as `created`, `allowed` or `refused`" }
        call_id: { type: [string, "null"], description: "The MCP tool call the entry belongs to: the call's `mcp.tool_call` entry and each change it made carry the same ID. `null` outside a tool call." }
        created_at: { type: string, format: date-time }
    AuditEntryList:
      type: object
      required: [data, has_more, first_id, last_id]
      properties:
        data: { type: array, items: { $ref: "#/components/schemas/AuditEntry" } }
        has_more: { type: boolean }
        first_id: { type: [string, "null"] }
        last_id: { type: [string, "null"] }
    ApiKeyCreateParams:
      type: object
      examples: [{ name: "Payment reporting", scopes: ["payments:read"] }]
      additionalProperties: false
      required: [name, scopes]
      properties:
        name: { type: string, minLength: 1, maxLength: 100, description: "A label to tell this key from the org's others" }
        scopes: { type: array, minItems: 1, maxItems: 32, uniqueItems: true, items: { type: string, maxLength: 64 }, description: "Scopes of this API, as the oauth security scheme lists them, such as `checkout:read`" }
        expires_at: { type: string, format: date-time, description: "When the key stops working, in the future. Leave it out for a key that works until it is revoked." }
    ApiKeyCreated:
      type: object
      required: [type, secret, api_key]
      properties:
        type: { type: string, const: api_key_created }
        secret: { type: string, description: "The key itself. It is shown only here: store it now." }
        api_key: { $ref: "#/components/schemas/ApiKey" }
    InviteCreateParams:
      type: object
      additionalProperties: false
      required: [email, role]
      properties:
        email: { type: string, minLength: 3, maxLength: 254 }
        role: { $ref: "#/components/schemas/AssignableRole" }
    InvitePreview:
      type: object
      required: [type, org_name, invited_by, role, status, signed_in_as, sent_to_you]
      properties:
        type: { type: string, const: invite_preview }
        org_name: { type: string, description: "The name of the org the invite adds the person to" }
        invited_by: { type: string, description: "The email address of the member who sent the invite, as the invite email names them" }
        role: { type: string, x-luckylanding-known-values: [owner, admin, member], description: "The role the person gets on joining" }
        status: { type: string, x-luckylanding-known-values: [pending, accepted, revoked, expired], description: "`pending`: the link can still be used. `accepted`: someone joined with it. `revoked`: an owner or admin withdrew it, or invited the same address again. `expired`: nobody joined with it in time." }
        signed_in_as: { type: [string, "null"], description: "The email address of the person signed in to the dashboard on this request; null without a dashboard session" }
        sent_to_you: { type: [boolean, "null"], description: "Whether `signed_in_as` is the verified address the invite was sent to, the only one that can accept it; null without a dashboard session" }
    InviteAcceptParams:
      type: object
      additionalProperties: false
      required: [token]
      properties:
        token: { type: string, pattern: "^[A-Za-z0-9_-]{43}$", description: "The token from the invite link" }
    Price:
      type: object
      required: [type, id, product, price, interval]
      properties:
        type: { type: string, const: price }
        id: { type: string }
        product: { type: string, x-luckylanding-known-values: [ads, pixel, checkout] }
        price: { $ref: "#/components/schemas/Money" }
        interval: { type: string, x-luckylanding-known-values: [month, year, one_time] }
        org_id: { type: string, description: "Set on a price that is this one org's alone, which replaces the list price for that org (BILL-R1); absent on a list price." }
        effective_until: { type: string, format: date-time, description: "When this org's own price stops replacing the list price, so a product added after it is at the list price; absent when it has no end. A product already added is billed at the list price from its first period that begins at or after then." }
    Catalogue:
      type: object
      required: [type, data]
      properties:
        type: { type: string, const: catalogue }
        data: { type: array, items: { $ref: "#/components/schemas/Price" } }
    Entitlement:
      type: object
      required: [type, id, product, source, status, period_end, cancel_at_period_end]
      properties:
        type: { type: string, const: entitlement }
        id: { type: string }
        product: { type: string }
        source: { type: string, x-luckylanding-known-values: [purchase, grant, bill], description: "`purchase` is a subscription bought through a checkout link on the billing rail before products moved to the saved card, which runs to `period_end` and doesn't renew; `grant` is a staff grant that ends on its date (BILL-R9); `bill` is a product the org added with its saved card, on Lucky Landing's own bills (BILL-R16)" }
        status: { type: string, x-luckylanding-known-values: [active, canceled], description: "`canceled` has ended; a `bill` product also ends when a Lucky Landing bill it is on is still unpaid at the bill's `grace_until`, and paying that bill later does not turn it back on" }
        period_end: { type: [string, "null"], format: date-time, description: "When the paid period ends. For a grant, the date it ends. For a `purchase`, the date it ends, since it no longer renews; `null` on one that ended without a period. For a `bill` product, `null` until it ends." }
        cancel_at_period_end: { type: boolean }
    PriceList:
      type: object
      required: [data, has_more, first_id, last_id]
      properties:
        data: { type: array, items: { $ref: "#/components/schemas/Price" } }
        has_more: { type: boolean }
        first_id: { type: [string, "null"] }
        last_id: { type: [string, "null"] }
    EntitlementList:
      type: object
      required: [data, has_more, first_id, last_id]
      properties:
        data: { type: array, items: { $ref: "#/components/schemas/Entitlement" } }
        has_more: { type: boolean }
        first_id: { type: [string, "null"] }
        last_id: { type: [string, "null"] }
    CardSetupParams:
      type: object
      additionalProperties: false
      properties:
        return_to: { $ref: "#/components/schemas/ReturnTo" }
    ReturnTo:
      type: string
      enum: [setup]
      description: "The dashboard page the person comes back to from the provider's or the billing rail's page: `setup` is the setup step that asked for it. Leave it out, as an agent does, to come back to Settings."
    ConnectReturnTo:
      type: string
      enum: [setup, tracking]
      description: "The dashboard page the person comes back to from the provider's page: `setup` is the setup step that asked for it, and `tracking` is Checkout's Tracking tab, for Klaviyo. Leave it out, as an agent does, to come back to Settings."
    CardSetup:
      type: object
      required: [type, id, url]
      properties:
        type: { type: string, const: card_setup }
        id: { type: string }
        url: { type: string, format: uri }
    BillingCard:
      type: object
      required: [type, brand, last4, exp_month, exp_year, saved_at]
      properties:
        type: { type: string, const: billing_card }
        brand: { type: [string, "null"], description: "The card's network as the billing rail names it, such as `visa`." }
        last4: { type: [string, "null"] }
        exp_month: { type: [integer, "null"] }
        exp_year: { type: [integer, "null"] }
        saved_at: { type: [string, "null"], format: date-time, description: "When the billing rail saved the card; null while the org has no saved card." }
    BillingDue:
      type: object
      required: [type, amount_due, bills, managed, confirm_url]
      properties:
        type: { type: string, const: billing_due }
        confirm_url: { type: [string, "null"], format: uri, description: "Only in `billing_pay_due`'s answer to a signed-in person, when the bank asked to confirm the bill's last charge and it wasn't confirmed: the billing rail's page where they pay the bill and confirm it with their bank. Open it at once in their browser; it names their billing email, so never store, log or share it. Null otherwise" }
        managed: { type: boolean, description: "True when Lucky Landing's staff settle this org's bills outside Lucky Landing: nothing is charged to its card, its bills stay listed as owed here, and `billing_pay_due` answers `billing_managed`" }
        amount_due: { $ref: "#/components/schemas/Money", description: "What the saved card is charged for the unpaid bills, before the tax the billing rail adds: each open bill's exact due, less the account credit taken off a bill whose product was cancelled while it was unpaid, rounded half up to whole cents once per charge, with the carried bills joining the first open bill's charge, or rounded once together while every bill is carried; other account credit is already off each bill's total" }
        bills: { type: array, maxItems: 100, items: { $ref: "#/components/schemas/DueBill" } }
    DueBill:
      type: object
      required: [type, id, status, total, amount_due, issued_at, retry_at, grace_until, products_ended_at]
      properties:
        type: { type: string, const: due_bill }
        id: { type: string }
        status: { type: string, x-luckylanding-known-values: [open, carried], description: "`open` is charged to the saved card, or waits until the org saves one; `carried` is under the billing rail's minimum and joins the next charge" }
        total: { $ref: "#/components/schemas/ExactMoney", description: "What the bill says, exactly, with the account credit already applied to it, before tax" }
        amount_due: { $ref: "#/components/schemas/ExactMoney", description: "What is left, exactly, after the credit taken off it for a product cancelled while it was unpaid" }
        issued_at: { type: string, format: date-time }
        retry_at: { type: [string, "null"], format: date-time, description: "When Lucky Landing next charges the saved card for it by itself; null while a charge is being made and once no such try is left: after the last of its 4 tries, after a decline only the cardholder can fix, and on a bill a lost dispute reopened. Saving a card or `billing_pay_due` tries it at once" }
        grace_until: { type: [string, "null"], format: date-time, description: "When the products on the bill end if it is still unpaid then: they turn off, which turns the checkout off, nothing more is charged for them, and the bill is still owed; 7 days after the last try, or after the payment a lost dispute reversed. Null until its first charge is tried, and for an add's first bill, which is undone instead" }
        products_ended_at: { type: [string, "null"], format: date-time, description: "When the products on the bill ended, for it or for an earlier bill, so none of them is on any more; null while one is on. The bill is still owed after they end" }
    BillList:
      type: object
      required: [data, has_more, first_id, last_id]
      properties:
        data: { type: array, items: { $ref: "#/components/schemas/Bill" } }
        has_more: { type: boolean }
        first_id: { type: [string, "null"] }
        last_id: { type: [string, "null"] }
    Bill:
      type: object
      required: [type, id, kind, status, issued_at, settled_at, period_starts_at, period_ends_before, total, credit_spent, rounding, carried, lines, charge]
      properties:
        type: { type: string, const: bill }
        id: { type: string }
        kind: { type: string, x-luckylanding-known-values: [add, period], description: "`add` is the first bill of a product added with the saved card, which is undone, and the bill voided, if its charge fails; `period` is any other bill, such as the monthly bill" }
        status: { type: string, x-luckylanding-known-values: [open, paid, carried, void], description: "`open` is owed and charged to the saved card; `carried` is under the billing rail's minimum and joins the next charge; `paid` was paid by its own charge, by a later bill's charge that carried it, by account credit, or as it was copied when its total was zero or less; `void` is owed by nobody. A refund leaves a bill `paid`, and its charge's `refunded` shows it." }
        issued_at: { type: string, format: date-time, description: "When the billing engine issued it" }
        period_starts_at: { type: string, format: date-time, description: "The start of the bill's own period as the billing engine set it; for a bill issued at once for an add, the moment it was issued" }
        period_ends_before: { type: string, format: date-time, description: "The end of the bill's own period as the billing engine set it, up to this instant" }
        settled_at: { type: [string, "null"], format: date-time, description: "When Lucky Landing last recorded it paid, carried or void, which for a bill paid as it was copied is when it was copied; null while it is open, and for a bill carried again after a lost dispute" }
        total: { $ref: "#/components/schemas/ExactMoney", description: "The billing engine's total exactly as it wrote it, fractions of a cent included: the sum of its lines, after the account credit the engine applied and before tax" }
        rounding: { anyOf: [{ $ref: "#/components/schemas/ExactMoney" }, { type: "null" }], description: "What rounding to whole cents added to (above zero) or dropped from (below zero) what was charged for this bill, with the bills its charge carried, or what was dropped when it was settled without a charge for being under half a cent; never more than half a cent either way; null until then, and for a bill paid as it was copied" }
        credit_spent: { $ref: "#/components/schemas/ExactMoney", description: "The account credit used on it: the sum of the `spent` entries the account credit ledger holds for it, both what the billing engine applied and what Lucky Landing took off a bill whose product was cancelled while it was unpaid. On a `void` bill, its `voided` entry gave that credit back" }
        carried: { type: array, items: { $ref: "#/components/schemas/CarriedBill" }, description: "Earlier bills under the billing rail's minimum that its last charge took with it" }
        lines: { type: array, items: { $ref: "#/components/schemas/BillLine" }, description: "Every line in the billing engine's order; one product can have several lines" }
        charge: { anyOf: [{ $ref: "#/components/schemas/BillCharge" }, { type: "null" }], description: "Its last charge to the saved card; null when it was never charged itself, such as a bill account credit paid or a later bill's charge carried" }
    BillLine:
      type: object
      required: [line, kind, name, product, starts_at, ends_before, quantity, unit_price, amount]
      properties:
        line: { type: integer, format: int64, description: "Its place on the bill, from 0; an account credit entry's `line` names it" }
        kind: { type: string, x-luckylanding-known-values: [subscription, usage, account_credit], description: "What the line is, as the billing engine typed it: `subscription` bills a product, `usage` the checkout fee, and `account_credit` takes the org's account credit off the line it names in `product`, or off the checkout fee when `product` is null" }
        name: { type: string, description: "The line's name as the billing engine wrote it, such as the checkout fee's product or the credit it applied" }
        product: { type: [string, "null"], description: "The product it bills or, for `account_credit`, the product the credit came off; null for a line Lucky Landing matched to no product, such as the checkout fee" }
        starts_at: { type: [string, "null"], format: date-time, description: "The start of the line's own period, as the billing engine billed it" }
        ends_before: { type: [string, "null"], format: date-time, description: "The end of the line's own period, as the billing engine billed it: the period runs up to this instant" }
        quantity: { type: [string, "null"], pattern: "^-?\\d+(\\.\\d+)?$", description: "The line's quantity as the billing engine wrote it, as an exact decimal: a fraction of 1 for a subscription line split by account credit, the cents of sales for the checkout fee; null where the engine wrote none, such as an account credit line, and for a line copied before Lucky Landing kept it" }
        unit_price: { anyOf: [{ $ref: "#/components/schemas/ExactMoney" }, { type: "null" }], description: "The price of one unit of `quantity` as the billing engine wrote it, which can be a fraction of a cent; null where `quantity` is" }
        amount: { $ref: "#/components/schemas/ExactMoney", description: "Exactly as the billing engine billed it, fractions of a cent included, before tax; below zero for a line that takes something off, such as checkout refunds larger than the sales" }
    CarriedBill:
      type: object
      required: [bill_id, amount]
      properties:
        bill_id: { type: string }
        amount: { $ref: "#/components/schemas/ExactMoney", description: "What that bill added to the charge, exactly: its total less the credit Lucky Landing took off it" }
    BillCharge:
      type: object
      required: [status, amount, tax, total, tried_at, settled_at, decline, refunded, dispute, bank_check_since, on_session]
      properties:
        on_session: { type: boolean, description: "True when a signed-in person's `billing_pay_due` made this charge as the billing rail's page, where they pay the bill and confirm it with their bank; while it is still being made, that page waits to be paid, and `billing_pay_due` returns to it" }
        status: { type: string, x-luckylanding-known-values: [claimed, sent, paid, failed, reversed], description: "`claimed` and `sent` are still being made; `failed` was declined, refused or never reached the billing rail, and moved no money; `reversed` was paid, then lost in a dispute" }
        amount: { $ref: "#/components/schemas/Money", description: "What was asked of the saved card before tax: the bill's `total` less the credit Lucky Landing took off it, plus what each bill in `carried` added, rounded half up to the cent as the bill's `rounding` shows; the billing rail's subtotal once it is paid" }
        tax: { anyOf: [{ $ref: "#/components/schemas/Money" }, { type: "null" }], description: "The sales tax the billing rail added, as its payment gave it; null until it is paid" }
        total: { anyOf: [{ $ref: "#/components/schemas/Money" }, { type: "null" }], description: "What the billing rail charged the card, tax included, as its payment gave it; null until it is paid" }
        tried_at: { type: string, format: date-time, description: "When Lucky Landing started the charge" }
        settled_at: { type: [string, "null"], format: date-time, description: "When it was paid or failed; null while it is being made" }
        decline: { type: [string, "null"], description: "Why it failed: the billing rail's decline code, such as `generic_decline` or `expired_card`, `unspecified` when the rail declined it without a code, `refused` when the rail refused the charge itself, `forbidden` when the rail turned away Lucky Landing's own key so the card was never tried, `authentication_required` when the card's bank asked to confirm it and it wasn't confirmed within the hour, or `unsent` when it never reached the rail; null otherwise" }
        bank_check_since: { type: [string, "null"], format: date-time, description: "When Lucky Landing first read, while the charge was being made, that the card's bank asked to confirm it. The billing rail gives no link to confirm it, so a charge still waiting an hour after it started fails with `authentication_required`: an add's charge undoes the add, and a period bill's card is tried again only after the org saves a card or pays now. Null when Lucky Landing read no such request" }
        refunded: { anyOf: [{ $ref: "#/components/schemas/Money" }, { type: "null" }], description: "What the billing rail has refunded of it: the refunds Lucky Landing has read that succeeded; null when there is none" }
        dispute: { type: [string, "null"], x-luckylanding-known-values: [open, won, lost], description: "The state of a dispute the cardholder opened over it; null when there is none" }
    PriceSchedules:
      type: object
      required: [type, schedules]
      properties:
        type: { type: string, const: price_schedules }
        schedules: { type: array, maxItems: 10, items: { $ref: "#/components/schemas/ProductPriceSchedule" }, description: "One for each product an add can name" }
    ProductPriceSchedule:
      type: object
      required: [type, product, prices]
      properties:
        type: { type: string, const: product_price_schedule }
        product: { type: string, x-luckylanding-known-values: [pixel, checkout] }
        prices: { type: array, maxItems: 25, items: { $ref: "#/components/schemas/ScheduledPrice" }, description: "The price an add bills now, then each price that takes its place later, oldest first; empty when no add can bill one" }
    ScheduledPrice:
      type: object
      required: [type, id, price, interval, starts_at, ends_before]
      properties:
        type: { type: string, const: scheduled_price }
        id: { type: string, description: "The price's ID" }
        price: { $ref: "#/components/schemas/Money" }
        interval: { type: string, x-luckylanding-known-values: [month, year] }
        starts_at: { type: string, format: date-time, description: "When an add bills it: for the first, the start of the hour an add now bills from" }
        ends_before: { type: [string, "null"], format: date-time, description: "When the next price takes its place, or it stops with none after it; null while neither is set" }
    FeeRates:
      type: object
      required: [type, rates]
      properties:
        type: { type: string, const: fee_rates }
        rates: { type: array, maxItems: 100, items: { $ref: "#/components/schemas/FeeRate" }, description: "Each meter's rates in force now or later, by product and meter, oldest first" }
    FeeRate:
      type: object
      required: [type, product, meter, unit, unit_price, tiers, starts_at, ends_before]
      properties:
        type: { type: string, const: fee_rate }
        product: { type: string, x-luckylanding-known-values: [checkout], description: "The product whose usage the meter counts" }
        meter: { type: string, x-luckylanding-known-values: [sales, sale_count], description: "`sales` is a share of each sale, which a refund or a lost dispute takes back; `sale_count` is a price for each paid sale, which neither returns" }
        unit: { type: string, x-luckylanding-known-values: [sales_cent, sale], description: "What one unit of the meter is: `sales_cent` is one cent of a sale, `sale` one paid sale" }
        unit_price: { $ref: "#/components/schemas/ExactMoney", description: "The price of one `unit` after the last tier, exactly as Lucky Landing gives it to its billing engine, which can be a fraction of a cent; for a `unit` of `sales_cent` it is the share of each sale" }
        tiers: { type: array, items: { $ref: "#/components/schemas/FeeRateTier" }, description: "Volume tiers before `unit_price`, in order; empty on a flat rate" }
        starts_at: { type: string, format: date-time, description: "When it starts to apply (UTC). A prospective zero Checkout fee can start on a whole hour; other rates start on a month boundary." }
        ends_before: { type: [string, "null"], format: date-time, description: "When the next rate takes over or this org's own rate ends; null while no later rate is set" }
    FeeRateTier:
      type: object
      required: [size, unit_price]
      properties:
        size: { type: integer, format: int64, description: "How many units of the meter in each calendar month (UTC) this tier prices, after the tiers before it" }
        unit_price: { $ref: "#/components/schemas/ExactMoney", description: "The price of one unit in this tier, exactly as Lucky Landing gives it to its billing engine; zero for an allowance" }
    UpcomingBills:
      type: object
      required: [type, bills]
      properties:
        type: { type: string, const: upcoming_bills }
        bills: { type: array, maxItems: 100, items: { $ref: "#/components/schemas/UpcomingBill" }, description: "Oldest first: the first is the org's next bill" }
    UpcomingBill:
      type: object
      required: [type, period_starts_at, period_ends_before, issues_at, total, lines]
      properties:
        type: { type: string, const: upcoming_bill }
        period_starts_at: { type: string, format: date-time, description: "The start of the bill's period as the billing engine set it" }
        period_ends_before: { type: string, format: date-time, description: "The end of the bill's period, up to this instant" }
        issues_at: { type: string, format: date-time, description: "When the billing engine issues the bill, as it holds it now" }
        total: { $ref: "#/components/schemas/ExactMoney", description: "The billing engine's total so far exactly as it holds it, fractions of a cent included: the sum of its lines, after the account credit the engine applied and before tax" }
        lines: { type: array, items: { $ref: "#/components/schemas/BillLine" }, description: "Every line so far in the billing engine's order" }
    CancelPreview:
      type: object
      required: [type, entitlement_id, undone, credit]
      properties:
        type: { type: string, const: cancel_preview }
        entitlement_id: { type: string, description: "The entitlement a cancel would end" }
        undone: { type: boolean, description: "True when a cancel now takes the product off as if it was never added, because its first bill isn't paid, carried or being charged yet: nothing is owed for it and `credit` is zero" }
        credit: { $ref: "#/components/schemas/ExactMoney", description: "The account credit a cancel in this hour gives, before tax, exactly as the cancel computes it: zero when `undone`, when the product has ended, or when it was bought through a checkout link" }
    BillingTaxLocation:
      type: object
      required: [type, country, state, postal_code]
      properties:
        type: { type: string, const: billing_tax_location }
        country: { type: string, description: "ISO 3166-1 alpha-2 country the card is billed in" }
        state: { type: [string, "null"], description: "The state or province, for the United States and Canada" }
        postal_code: { type: string }
    BillingTaxLocationParams:
      type: object
      additionalProperties: false
      required: [country, postal_code]
      properties:
        country: { type: string, pattern: "^[A-Z]{2}$" }
        state: { type: string, pattern: "^[A-Z0-9]{1,3}$" }
        postal_code: { type: string, minLength: 1, maxLength: 12 }
    AddPreview:
      type: object
      required: [type, product, price_id, starts_at, ends_before, prorated, credit, carried, bill_status, charge, tax_status, tax, total]
      properties:
        type: { type: string, const: add_preview }
        product: { type: string, description: "The product an add would put on" }
        price_id: { type: string, description: "The price the add bills, the `price_id` it sends: the first of the product's schedule in `getPriceSchedules`" }
        starts_at: { type: string, format: date-time, description: "The start of this hour, from which the add bills the product" }
        ends_before: { type: string, format: date-time, description: "The 1st of next month (UTC), where the add's first bill ends and the monthly bills begin" }
        prorated: { $ref: "#/components/schemas/Money", description: "What the add's bill charges for the product from `starts_at` to `ends_before`, before credit and tax: the price's share of the month's hours, rounded half up to the cent, as the billing engine prorates it; the full monthly price at the start of a 1st" }
        credit: { $ref: "#/components/schemas/ExactMoney", description: "The account credit the billing engine takes off the add's bill, up to `prorated`, exactly as it holds it: zero when the org holds none" }
        carried: { $ref: "#/components/schemas/ExactMoney", description: "What the org's earlier bills under the billing rail's minimum charge come to, before tax: they join this charge when `bill_status` is `open`, and stay owed for the next charge otherwise" }
        bill_status: { type: string, x-luckylanding-known-values: [open, paid, carried], description: "`open` when the saved card is charged `charge` now; `paid` when nothing is due, because the credit pays the bill in full or it comes to zero; `carried` when the bill comes to less than the billing rail's minimum charge, so it isn't charged yet and joins the org's next charge" }
        charge: { $ref: "#/components/schemas/Money", description: "What the saved card is charged today, before sales tax: `prorated` less `credit`, with `carried`, rounded half up to the cent once; zero unless `bill_status` is `open`" }
        tax_status: { type: string, x-luckylanding-known-values: [calculated, not_applicable, location_required, unavailable, not_charged], description: "`calculated` when the billing rail priced today's sales tax on `charge` for the org's billing location; `not_applicable` when it collects none there; `location_required` when the org has given no billing location, so tax can't be priced and an add is refused with `location_required`; `unavailable` when the rail couldn't price it now, so an add can't be confirmed; `not_charged` when nothing is charged today" }
        tax: { $ref: "#/components/schemas/Money", description: "The sales tax the billing rail adds to `charge` today, for the org's billing location; zero unless `tax_status` is `calculated`" }
        total: { $ref: "#/components/schemas/Money", description: "What the saved card is charged today, sales tax included: `charge` plus `tax`. The charge is made at exactly this total, or not at all" }
    AccountCredit:
      type: object
      required: [type, balance, entries]
      properties:
        type: { type: string, const: account_credit }
        balance: { $ref: "#/components/schemas/Money", description: "The account credit the org holds now, before tax, rounded down to the cent" }
        entries: { type: array, maxItems: 100, items: { $ref: "#/components/schemas/AccountCreditEntry" }, description: "The newest 100 entries of the ledger, newest first" }
    AccountCreditEntry:
      type: object
      required: [type, kind, bill_id, line, amount, balance, created_at]
      properties:
        type: { type: string, const: account_credit_entry }
        kind: { type: string, x-luckylanding-known-values: [granted, spent, voided, negative_bill, reversed], description: "`granted` is the unused part of a cancelled product's period, from the bill line in `line`; `spent` came off the bill; `voided` undoes what credit a voided bill spent or granted; `negative_bill` is the amount of a bill below zero; `reversed` takes credit granted from a bill back while a lost dispute leaves that bill owed, and gives it back once it is paid again" }
        bill_id: { type: [string, "null"], description: "The bill the entry belongs to, as `billing_list_bills` lists it; null for an entry that belongs to no bill" }
        line: { type: [integer, "null"], format: int64, description: "For `granted`, the line of that bill it was granted from, and for a `spent` entry Lucky Landing took off that bill, the line whose credit it was; null otherwise" }
        amount: { $ref: "#/components/schemas/ExactMoney", description: "Exactly what the entry added to the balance, fractions of a cent included; below zero when it took credit away" }
        balance: { $ref: "#/components/schemas/ExactMoney", description: "The exact balance after this entry" }
        created_at: { type: string, format: date-time }
    BillingProductParams:
      type: object
      additionalProperties: false
      required: [product, consent_version, price_id, prorated, charge, total]
      properties:
        product: { type: string, enum: [pixel, checkout, ad_canvas, customer_connect], description: "The requested product. A planned product returns coming_soon." }
        consent_version: { type: string, pattern: "^[0-9]{4}-[0-9]{2}-[0-9]{2}$", description: "The version of the card terms the person read and accepted for this add, as the dashboard shows them" }
        price_id: { type: string, pattern: "^price_[0-7][0-9a-hjkmnp-tv-z]{25}$", description: "The price the card terms showed the person, the first of its product's schedule in `getPriceSchedules`; the add is refused when it is not the price the add bills" }
        prorated: { $ref: "#/components/schemas/MoneyParams", description: "The `prorated` amount `billing_preview_addition` showed the person: the add is refused when it is not what the add bills for the rest of this month" }
        charge: { $ref: "#/components/schemas/MoneyParams", description: "The `charge` `billing_preview_addition` showed the person: the add is refused when it is not what the add charges the saved card today, before sales tax" }
        total: { $ref: "#/components/schemas/MoneyParams", description: "The `total` `billing_preview_addition` showed the person, sales tax included: the add is refused when it is not the total Lucky Landing priced for today's charge" }
    StripeOnboardingCountries:
      type: object
      required: [type, countries, fixed_country]
      properties:
        type: { type: string, const: stripe_onboarding_countries }
        countries: { type: array, items: { type: string, pattern: "^[A-Z]{2}$" }, description: "For a first account, country codes from Stripe Country Specs. For a fixed account, its country alone. Stripe checks business and platform eligibility when onboarding." }
        fixed_country: { type: [string, "null"], description: "Country of a sent opening or account in this environment, or null when the merchant can choose." }
    ProcessorStoreList:
      type: object
      required: [data, has_more, first_id, last_id]
      properties:
        data: { type: array, items: { $ref: "#/components/schemas/ProcessorStore" } }
        has_more: { type: boolean }
        first_id: { type: [string, "null"] }
        last_id: { type: [string, "null"] }
    ProcessorStore:
      type: object
      required: [type, id, domain]
      properties:
        type: { type: string, const: processor_store }
        id: { type: string }
        domain: { type: string }
        available_providers: { type: array, items: { type: string, x-luckylanding-known-values: [whop, stripe] }, description: "Processor registrations that can start a link for this store. Setup also requires the capability to be available to this organization." }
    ConnectLinkParams:
      type: object
      additionalProperties: false
      required: [provider]
      properties:
        provider: { type: string, enum: [shopify, meta, whop, klaviyo, stripe, google, google_ads] }
        store_id: { type: string, pattern: "^store_[0-7][0-9a-hjkmnp-tv-z]{25}$", description: "Select a verified store from connections_list_processor_stores." }
        return_to: { $ref: "#/components/schemas/ConnectReturnTo" }
    ConnectLink:
      type: object
      required: [type, id, provider, status, url, expires_at, found, shopify_app]
      properties:
        type: { type: string, const: connect_link }
        id: { type: string }
        provider: { type: string }
        status: { type: string, x-luckylanding-known-values: [pending, completed, expired] }
        url: { type: string, format: uri, description: "The dashboard's page for the link, where the person who requested it opens it (openConnectLink). The provider's leg lands on the page `return_to` named, or else on the dashboard's Connections page, or back on this page while the link waits for the person to confirm what it found." }
        google_streams_partial: { type: boolean, description: "Some Google accounts or properties could not be read. The returned streams remain selectable." }
        google_ads_actions:
          description: Eligible website purchase actions found for this pending Google Ads link.
          type: array
          items: { $ref: "#/components/schemas/GoogleAdsAction" }
        google_streams:
          description: Web streams discovered for the person who started this pending Google link. Empty when Google returned no web streams.
          type: array
          items: { $ref: "#/components/schemas/GoogleAnalyticsStream" }
        expires_at: { type: string, format: date-time }
        connection_id: { type: [string, "null"] }
        store_id: { type: string, description: "Store selected for this link." }
        found: { anyOf: [{ $ref: "#/components/schemas/ConnectLinkFound" }, { type: "null" }], description: "What the provider's sign-in found, while a `pending` link waits for the person to confirm it (confirmConnectLink) or to start again as another account; null otherwise. Nothing is connected until the person confirms." }
        shopify_app: { anyOf: [{ $ref: "#/components/schemas/ConnectLinkShopifyApp" }, { type: "null" }], description: "For a Shopify link, the store address and client ID the person pasted when they opened it (openConnectLink), so a try after a failed connect asks only for the client secret again; null for other providers and before the link is opened. The client secret is never returned." }
    ConnectLinkShopifyApp:
      type: object
      additionalProperties: false
      required: [shop, client_id]
      properties:
        shop: { type: string, description: "The store's myshopify.com address." }
        client_id: { type: string, description: "The client ID of the person's own Shopify app." }
    GoogleAdsAction:
      type: object
      required: [account_id, account, name, send_to]
      properties:
        account_id: { type: string }
        account: { type: string }
        name: { type: string }
        send_to: { type: string }
    GoogleAnalyticsStream:
      type: object
      required: [measurement_id, account, property, stream]
      properties:
        measurement_id: { type: string }
        account: { type: string }
        property: { type: string }
        stream: { type: string }
    ConnectLinkFound:
      type: object
      additionalProperties: false
      required: [type, signed_in_as, external_id, display_name, refusal]
      properties:
        type: { type: string, const: connect_link_found }
        signed_in_as: { type: string, description: "The provider account the person signed in to, as the provider names it." }
        external_id: { type: [string, "null"], description: "The provider's ID of the account LL would connect, such as a Whop company's; null when the sign-in found none LL can connect (`refusal`)." }
        display_name: { type: [string, "null"], description: "That account's name at the provider; null when the provider gave none." }
        refusal: { type: [string, "null"], x-luckylanding-known-values: [not_team_admin, whop_company_not_allowed, whop_company_ambiguous], description: "Why LL can't connect anything this sign-in found (CONN-R8); null when `external_id` is set. There is nothing to confirm then: the person starts again as another account, or fixes what it names." }
    ConnectLinkOpenParams:
      type: object
      additionalProperties: false
      properties:
        shop: { type: string, pattern: "^[a-z0-9][a-z0-9-]*\\.myshopify\\.com$", maxLength: 255, description: "The Shopify store's myshopify.com domain, required to open a Shopify link: Shopify asks for consent on the store itself (CONN-R1)." }
        client_id: { type: string, pattern: "^[A-Za-z0-9_-]{16,128}$", description: "The client ID of the app the merchant made for the store in Shopify's Dev Dashboard, required to open a Shopify link (CONN-R13)." }
        client_secret: { type: string, minLength: 16, maxLength: 512, pattern: "^[\\x21-\\x7e]+$", writeOnly: true, description: "That app's client secret, required to open a Shopify link. Only luckylanding checkout keeps it, sealed, and no response returns it (CONN-R13)." }
        country:
          type: string
          pattern: "^[A-Z]{2}$"
          description: "The ISO 3166-1 alpha-2 code of the country the business is legally registered in, required to open the org's first Stripe link: Stripe opens the account in that country. Stripe's own country specs decide which countries it serves; a link opened with one it doesn't serve lands on `connect_error=country_unserved` and opens no account. Until Lucky Landing first asks Stripe to open the account, another country replaces it; after that, a link opened with another country is refused, and one opened with the same country, or with none, reuses the org's account."
    ShopifyAppSetup:
      type: object
      additionalProperties: false
      required: [type, redirect_url, scopes, optional_scopes, egress_ips, webhooks_api_version]
      properties:
        type: { type: string, const: shopify_app_setup }
        optional_scopes: { type: array, items: { type: string }, description: "Access scopes the app may also have, each for one thing it lets Lucky Landing do. write_themes lets Lucky Landing write its one checkout script line into the published theme and remove it on disconnect; without it the person pastes the line. A connection without one is never needs_reconsent." }
        redirect_url: { type: string, format: uri, description: "The app's one allowed redirection URL, where Shopify returns after the merchant installs the app." }
        scopes: { type: array, items: { type: string }, description: "Every access scope the app asks for, comma-joined when pasted. A connection without one of the required ones shows needs_reconsent with the missing list." }
        egress_ips: { type: array, items: { type: string }, description: "LL's egress addresses in this environment, for the app's optional IP allowlist." }
        webhooks_api_version: { type: string, pattern: "^[0-9]{4}-[0-9]{2}$", description: "The Admin API version the app's webhooks use, the one LL reads their payloads in." }
    GooglePlacesSetup:
      type: object
      additionalProperties: false
      required: [type, key_page_url, api_page_url, api_name, egress_ips, pricing, pricing_url]
      properties:
        type: { type: string, const: google_places_setup }
        key_page_url: { type: string, format: uri, description: "Google Cloud's page where the person makes the API key, in a project with billing on." }
        api_page_url: { type: string, format: uri, description: "Google Cloud's page where the person enables `api_name` in that project." }
        api_name: { type: string, description: "The API the key is restricted to, under API restrictions, as Google Cloud names it." }
        egress_ips: { type: array, items: { type: string }, description: "LL's egress addresses in this environment, for the key's IP address restriction under Application restrictions. Every call LL makes to Google comes from one of them." }
        pricing: { type: string, description: "What Google bills the merchant for address suggestions, at Google's prices on the date it gives." }
        pricing_url: { type: string, format: uri, description: "Google's price list." }
    WhopSignup:
      type: object
      additionalProperties: false
      required: [type, url, asks_twice]
      properties:
        type: { type: string, const: whop_signup }
        url: { type: [string, "null"], format: uri, description: "LL's Whop partner referral link; null when this environment has none, and the Connect Whop step then offers no link." }
        asks_twice: { type: boolean, description: "Whether connecting Whop in this environment shows two Whop screens, one to sign in and one to approve payments for the person's company (CONN-R10), so the Connect Whop step says so before the person starts." }
    ConnectLinkOpening:
      type: object
      required: [type, url]
      properties:
        type: { type: string, const: connect_link_opening }
        url: { type: string, format: uri, description: "The dashboard host's /auth/providers/start for the link, which redirects to the provider only the browser holding the cookie this response set." }
    TrackingEvidence:
      type: object
      required: [type, connections]
      properties:
        type: { type: string, const: tracking_evidence }
        connections: { type: array, items: { $ref: "#/components/schemas/ConnectionTrackingEvidence" } }
    ConnectionTrackingEvidence:
      type: object
      required: [connection_id, last_test, last_server_send]
      properties:
        connection_id: { type: string, pattern: "^connection_[0-7][0-9a-hjkmnp-tv-z]{25}$" }
        last_test:
          type: [object, "null"]
          required: [tested_at, outcome, current_connection]
          properties:
            tested_at: { type: string, format: date-time }
            current_connection: { type: boolean, description: "Whether the native test used the current version of the connection. False when its version was not recorded." }
            outcome: { type: string, x-luckylanding-known-values: [received, token_refused, destination_not_found, refused, unverified, rate_limited, vendor_error, unavailable, requested], description: "Most recent native test activity. A requested test has no recorded answer yet." }
        last_server_send:
          type: [object, "null"]
          required: [sent_at, event_name]
          properties:
            sent_at: { type: [string, "null"], format: date-time, description: "When the sender observed the acknowledgement. Null for historical sends without this measurement." }
            event_name: { type: string, description: "Name of the event sent to the destination." }
    ConnectionTestEventParams:
      type: object
      additionalProperties: false
      properties:
        test_event_code: { type: string, pattern: "^[A-Za-z0-9]{1,64}$", description: "For `meta_events` and `tiktok_events`, required: the code from that pixel's Test Events tab. It goes on this one test request only and is never saved. Left out for `google_analytics_events`." }
    ConnectionTestEvent:
      type: object
      additionalProperties: false
      required: [type, outcome, title, detail, vendor_message, vendor_reference]
      properties:
        type: { type: string, const: connection_test_event }
        outcome: { type: string, x-luckylanding-known-values: [received, token_refused, destination_not_found, refused, unverified, rate_limited, vendor_error], description: "What the platform answered: `received`, `token_refused`, `destination_not_found`, `refused`, or GA4’s unverified, rate_limited or vendor_error." }
        title: { type: string, description: "What happened, in plain words." }
        detail: { type: string, description: "What to do next: where to look, or what to fix." }
        vendor_message: { type: [string, "null"], description: "The platform's own words when it refused, with the saved token or secret taken out. Null for `token_refused`, whose words can hold the token." }
        vendor_reference: { type: [string, "null"], description: "The platform's ID for this request (Meta's `fbtrace_id`, TikTok's `request_id`), which its support asks for." }
    PastedConnectionParams:
      type: object
      additionalProperties: false
      required: [kind]
      properties:
        kind: { type: string, enum: [meta_events, meta_ads, tiktok_events, google_ads_conversions, google_analytics_events, google_places], description: "`meta_events`: a Meta dataset (pixel), with an optional Conversions API token. `meta_ads`: a Meta ad account, by its ID and a system-user token. `tiktok_events`: a TikTok pixel, with an optional Events API token. `google_ads_conversions`: a Google Ads purchase conversion, by its tag ID and label. `google_analytics_events`: a GA4 web data stream, by its measurement ID, with an optional Measurement Protocol API secret. `google_places`: the merchant's Google key for the checkout's address suggestions." }
        external_id: { type: string, pattern: "^[A-Za-z0-9_/-]{1,100}$", description: "Required for `meta_events` (the dataset ID, its digits), `meta_ads` (the ad account ID, its digits, without `act_`), `tiktok_events` (the pixel code, capital letters and digits), `google_ads_conversions` (`AW-` and the conversion tracking ID, a slash, and the purchase conversion label) and `google_analytics_events` (`G-` and capital letters or digits); left out for `google_places`." }
        credential: { type: [string, "null"], writeOnly: true, minLength: 1, maxLength: 4096, pattern: "^[\\x21-\\x7E]+$", description: "Write-only: no response returns it. For `meta_events`, the Conversions API token for this dataset, for `tiktok_events`, the Events API token for this pixel, and for `google_analytics_events`, the Measurement Protocol API secret for this stream: null removes the saved one, and leaving it out keeps it. For `google_places`, the Google Maps Platform API key, and for `meta_ads`, the system-user token; each is required." }
    Connection:
      type: object
      required: [type, id, provider, kind, status, external_id, display_name, has_credential, granted_scopes, missing_scopes, processor_settings, webhooks_refused, webhook_topics, credential_refused, connected_at, connected_by, requirements, requirements_read_at, takes_cards, updated_at]
      properties:
        type: { type: string, const: connection }
        id: { type: string }
        provider: { type: string, x-luckylanding-known-values: [shopify, meta, tiktok, whop, klaviyo, google, stripe, airwallex, adyen, nmi] }
        kind: { type: string, x-luckylanding-known-values: [grant, meta_ads, meta_events, tiktok_events, google_ads_conversions, google_analytics_events, klaviyo_events, google_places], description: "`grant`: the store or processor the provider granted through a connect link. `meta_ads`: the Meta ad account in `external_id`, granted through a connect link, that Ad Canvas launches to. `meta_events`: the Meta dataset (pixel) in `external_id` that the checkout reports to, with an optional pasted Conversions API token. `tiktok_events`: the TikTok pixel in `external_id` that the checkout reports to, with an optional pasted Events API token. `google_ads_conversions`: the Google Ads tag ID and purchase label in `external_id`, `AW-…/label`, that the checkout's Google tag reports purchases to. `google_analytics_events`: the GA4 measurement ID in `external_id` for checkout purchases. With a Measurement Protocol API secret and a GA client ID at checkout start, the server sends checkout steps and the purchase. `klaviyo_events`: the Klaviyo account in `external_id` that the checkout sends abandoned-checkout events to (TRK-R4), with the access the merchant granted by signing in to Klaviyo. `google_places`: the merchant's pasted Google key, with which the checkout suggests addresses (CHK-R11); its `external_id` is empty, since a key names no account LL can read." }
        status: { type: string, x-luckylanding-known-values: [pending, active, degraded, store_unavailable, needs_reauth, needs_reconsent, revoking, revoked], description: "`store_unavailable` when Shopify reports the shop is unavailable during its webhook check. Open Shopify admin to restore the store. `degraded` while a store refuses a webhook subscription LL needs, which `webhooks_refused` names; LL checks a store's subscriptions every hour, creates any that are missing, and the connection returns to `active` once a check finds them all. A `klaviyo_events` connection is `degraded` while Klaviyo hasn't renewed LL's access since it expired: LL keeps asking, its events are held, and it returns to `active`, sending the held events that are still due, once Klaviyo renews the access or the person signs in to Klaviyo again." }
        external_id: { type: string }
        display_name: { type: [string, "null"], description: "The account's name at the provider as Lucky Landing read it at the last connect: the shop's name for Shopify, the company's title for Whop and the account's name for Klaviyo. Null for a Meta dataset, whose ID is `external_id`, and for a Google key, which carry none." }
        has_credential: { type: boolean, description: "Whether LL holds a sealed credential for this connection. The credential itself is never returned." }
        granted_scopes: { type: array, items: { type: string }, description: "For a Shopify store, the scopes its app holds, as Lucky Landing's last check of the store's webhooks read them from Shopify, about hourly and at connect; empty for other connections and before the first check. A write scope includes its read scope, which the list may leave out. `status` and `missing_scopes` still follow the grant at connect." }
        missing_scopes: { type: array, items: { type: string }, description: "The provider permissions LL needs that the grant left out, empty unless `status` is `needs_reconsent`; reconnecting asks for them again (CONN-R8, CONN-AC2)." }
        processor_settings: { anyOf: [{ $ref: "#/components/schemas/ProcessorSettings" }, { type: "null" }], description: "Null unless `kind` is `grant` and `provider` is a processor whose own tax and buyer fee LL reads, such as `whop`; null for `stripe`." }
        store_access_problem: { type: string, x-luckylanding-known-values: [store_unavailable, ip_allowlist], description: "The most recent webhook check found the Shopify store unavailable, or the app’s IP allowlist refused access. Omitted otherwise. The grant status and missing scopes are independent." }
        webhooks_refused: { type: [string, "null"], description: "The store's refusal of webhook subscriptions for the app LL uses on it, naming each refused topic. Null means no topic refusal was recorded, including when Shopify reported the store unavailable before topics could be verified. While set, LL hears nothing on the topics it names: fix the app, for example its protected customer data access; LL's hourly check or a connect again then subscribes it (CONN-R8, CONN-R13)." }
        webhook_topics: { type: array, items: { type: string }, description: "For a Shopify store, the webhook topics of Lucky Landing's subscriptions, as its last check of the store's webhooks found or made them; empty for other connections and before the first check." }
        credential_refused:
          type: [string, "null"]
          x-luckylanding-known-values: [key_invalid, api_disabled, api_restricted, ip_restricted, wrong_restriction, billing_disabled, project_suspended, refused]
          description: |
            What the provider refused about the pasted key when LL last used or tested it, null while it works; set only on a `google_places` connection, which is `needs_reauth` while it is set. Fix it in Google Cloud, then `connections_test_google_key`.
            - `key_invalid`. Google doesn't know the key, or it expired: copy it again, or make a new one.
            - `api_disabled`. Places API (New) isn't enabled in the key's project.
            - `api_restricted`. The key's API restrictions leave out Places API (New).
            - `ip_restricted`. The key's IP address restriction leaves out LL's egress addresses.
            - `wrong_restriction`. The key is restricted to websites or apps; LL calls from its servers, so restrict it to IP addresses.
            - `billing_disabled`. The key's project has no billing account.
            - `project_suspended`. Google suspended the key's project.
            - `refused`. Google refused the key for another reason; Google Cloud's API dashboard for the project shows the errors.
        connected_at: { type: [string, "null"], format: date-time, description: "When this record was last connected, by a connect link or by sending its key; null for one connected before Lucky Landing kept the record. A health change moves `updated_at`, not this." }
        connected_by: { anyOf: [{ $ref: "#/components/schemas/ConnectionActor" }, { type: "null" }], description: "Who last connected this record, as the audit log names them; null when `connected_at` is." }
        requirements: { type: array, items: { $ref: "#/components/schemas/ConnectionRequirement" }, description: "What the processor still needs from the business, as LL last read it, for a `stripe` connection; empty for every other connection. A `stripe` connection is `pending` until Stripe lets the account take card payments, and `degraded` while it takes them but an item is `past_due`. Only the person gives these to Stripe, on Stripe's own pages, from the connection's Continue on Stripe button in the dashboard; tell them so." }
        takes_cards: { type: [boolean, "null"], description: "Whether the processor lets the account take card payments, as LL last read it; null for a connection no processor read describes. A `degraded` `stripe` connection may take cards with something past due, or have lost them, which this tells apart." }
        requirements_read_at: { type: [string, "null"], format: date-time, description: "When LL last read `status` and `requirements` from the processor; null for a connection whose status no processor read moves. Reading the connection reads them again when this is over a minute old." }
        updated_at: { type: string, format: date-time }
    ConnectionActor:
      type: object
      required: [kind, id, client_id]
      properties:
        kind: { type: string, x-luckylanding-known-values: [person, api_key, oauth, staff, service], description: "Who acted, as the audit log's `actor_kind`: a person in the dashboard, one of the org's API keys, an app acting as its person, Lucky Landing staff, or a service." }
        id: { type: string, description: "The person's, key's, staff member's or service's ID; for `oauth`, the person the app acts for. A person's name and email are in `listMembers`." }
        client_id: { type: [string, "null"], description: "The API key's ID or the app's client ID; null when no key or app was used." }
    ConnectionProviders:
      type: object
      required: [type, providers]
      properties:
        type: { type: string, const: connection_providers }
        providers: { type: array, items: { $ref: "#/components/schemas/ConnectionProvider" } }
    ConnectionProvider:
      type: object
      required: [type, provider, connects, country, capabilities]
      properties:
        type: { type: string, const: connection_provider }
        connects: { type: boolean, description: "Whether this api can start a connect link for the provider (`connections_create_link`) for this organization. For `stripe`, that is whether the api runs with Stripe connect links on (`LUCKYLANDING_STRIPE_CONNECT`) and Stripe is available to the organization (its capability's `availability`); it says nothing of whether checkout holds Stripe's key, so a link can still fail at Stripe." }
        country: { type: [string, "null"], description: "Legacy hint for one writable verified store with one matching sent Stripe opening. Null when ambiguous. Use getStripeOnboardingCountries for the selected store." }
        provider: { type: string, x-luckylanding-known-values: [shopify, meta, tiktok, whop, klaviyo, google, stripe, airwallex, adyen, nmi] }
        capabilities: { type: array, items: { $ref: "#/components/schemas/ConnectionCapability" } }
    ConnectionCapability:
      type: object
      required: [type, kind, status, availability, requires, products, connections, start]
      properties:
        type: { type: string, const: connection_capability }
        google_ads_discovery: { type: boolean, description: "Whether this organization can discover Google Ads purchase actions with a Google sign-in." }
        availability: { $ref: "#/components/schemas/ReleaseAvailability", description: "`coming_soon` while Lucky Landing is still testing the capability and hasn't made it available to this organization: it is listed so a person or agent knows it is coming, its `start` names no `tool`, and connecting it is refused with 403 `coming_soon`. The organization can still manage and disconnect saved connections. Checkout tracking delivery pauses while its destination is off. Whop is `unavailable`, with no start tool, when the project has a connected store but none of the stores the caller can write is in an environment Lucky Landing has a Whop app for, as for a caller that can write no store; with no connected store it is `available` and `requires` names `connect_store`. Otherwise `available`." }
        requires: { type: array, items: { type: string, x-luckylanding-known-values: [connect_store] }, description: "The setup steps, by `DashboardSetupStep.id`, the organization finishes before it can connect this capability; empty when none. While it isn't empty, `start` names no `tool`. `connect_store` for a payment provider such as Whop, whose connect link is for one of the organization's stores." }
        kind: { type: string, x-luckylanding-known-values: [grant, meta_ads, meta_events, tiktok_events, google_ads_conversions, google_analytics_events, klaviyo_events, google_places], description: "The `kind` of the capability's connections, as `Connection.kind` describes it." }
        status:
          type: string
          x-luckylanding-known-values: [not_connected, pending, active, degraded, store_unavailable, needs_reauth, needs_reconsent, revoking, revoked]
          description: "`not_connected` when the org holds no connection of this kind, `revoked` when every one it held is revoked, and otherwise the worst status among the rest: `needs_reauth`, `needs_reconsent`, `store_unavailable`, `degraded`, `pending`, `active`, then `revoking`."
        products: { type: array, items: { $ref: "#/components/schemas/ConnectionUse" }, description: "The products that declare they use this capability, in a stable order; empty when none has declared it yet, which does not prove that nothing uses it." }
        connections: { type: array, items: { $ref: "#/components/schemas/Connection" }, description: "The capability's connections that aren't `revoked`, newest first." }
        start: { $ref: "#/components/schemas/ConnectionStart" }
    ConnectionUse:
      type: object
      required: [type, product, in_use]
      properties:
        type: { type: string, const: connection_use }
        product: { type: string, x-luckylanding-known-values: [checkout, ad_canvas] }
        in_use: { type: boolean, description: "Whether this org runs the product now, so that disconnecting the capability stops it. The checkout runs while the org's `checkout` product is active; Ad Canvas, which is no add-on, runs for every org wherever Lucky Landing has turned its model on." }
    ConnectionStart:
      type: object
      required: [type, tool, url]
      properties:
        type: { type: string, const: connection_start }
        tool: { type: [string, "null"], x-luckylanding-known-values: [connections_create_link, connections_connect_tracking_id], description: "The tool that connects it: `connections_create_link` with this `provider`, or `connections_connect_tracking_id` for a Meta pixel's ID, whose Conversions API token the person still pastes at `url`. Null when only a person can: it takes a secret no tool takes, or, for Klaviyo, a sign-in only a person signed in to the dashboard starts." }
        url: { type: string, format: uri, description: "The dashboard page where a person connects it." }
    ConnectionRequirement:
      type: object
      additionalProperties: false
      required: [type, description, past_due]
      properties:
        type: { type: string, const: connection_requirement }
        description: { type: string, description: "What the processor needs, in words for the person, such as `Bank account for payouts`." }
        past_due: { type: boolean, description: "Whether the processor already wants it: while any item is, Stripe can pause the account's payments or payouts." }
    ProcessorSettings:
      type: object
      required: [type, connection_id, adds_tax, adds_buyer_fee, checked_at]
      properties:
        type: { type: string, const: processor_settings }
        connection_id: { type: string }
        adds_tax: { type: [boolean, "null"], description: "Whether the processor account adds its own tax to a payment, as LL last read it. The checkout needs false, which on Whop is \"I'll handle tax myself\"." }
        adds_buyer_fee: { type: [boolean, "null"], description: "Whether the processor charges the account's buyers a fee on top of the price, in any region, as LL last read it. The checkout needs false." }
        checked_at: { type: [string, "null"], format: date-time, description: "When LL last read them; null before the first read. A null `adds_tax` or `adds_buyer_fee` after a read means the processor didn't say." }
    ConnectionList:
      type: object
      required: [data, has_more, first_id, last_id]
      properties:
        data: { type: array, items: { $ref: "#/components/schemas/Connection" } }
        has_more: { type: boolean }
        first_id: { type: [string, "null"] }
        last_id: { type: [string, "null"] }
    CheckoutLogoParams:
      type: object
      additionalProperties: false
      required: [image]
      properties:
        image: { type: string, format: byte, description: "The image's bytes, base64-encoded." }
    AdBreakdownParams:
      type: object
      additionalProperties: false
      required: [store_id, video]
      properties:
        store_id: { type: string, pattern: "^store_[0-7][0-9a-hjkmnp-tv-z]{25}$", description: "The store whose brand the ad is for" }
        video: { type: string, format: byte, maxLength: 12582400, description: "The ad's video, an MP4 or WebM file, base64-encoded; at most 12,582,400 characters keeps the request within the 12 MiB the API takes." }
    AdBreakdown:
      type: object
      required: [type, id, store_id, state, failure, scenes, created_at, finished_at]
      properties:
        type: { type: string, const: ad_breakdown }
        id: { type: string }
        store_id: { type: string }
        state: { type: string, x-luckylanding-known-values: [breaking_down, broken_down, failed] }
        failure: { type: [string, "null"], x-luckylanding-known-values: [video_unreadable, breakdown_failed], description: "Why the breakdown failed; null unless state is failed" }
        scenes: { type: array, items: { $ref: "#/components/schemas/AdScene" }, description: "Every scene in the order it plays; empty unless state is broken_down" }
        created_at: { type: string, format: date-time }
        finished_at: { type: [string, "null"], format: date-time, description: "When the breakdown was broken down or failed; null while it is breaking down" }
    AdBreakdownItem:
      type: object
      required: [type, id, store_id, state, failure, scene_count, created_at, finished_at]
      properties:
        type: { type: string, const: ad_breakdown }
        id: { type: string }
        store_id: { type: string }
        state: { type: string, x-luckylanding-known-values: [breaking_down, broken_down, failed] }
        failure: { type: [string, "null"], x-luckylanding-known-values: [video_unreadable, breakdown_failed], description: "Why the breakdown failed; null unless state is failed" }
        scene_count: { type: integer, minimum: 0, description: "How many scenes the ad was broken into; 0 unless state is broken_down" }
        created_at: { type: string, format: date-time, description: "When the ad was dropped in" }
        finished_at: { type: [string, "null"], format: date-time, description: "When the breakdown was broken down or failed; null while it is breaking down" }
    AdBreakdownList:
      type: object
      required: [data, has_more, first_id, last_id]
      properties:
        data: { type: array, items: { $ref: "#/components/schemas/AdBreakdownItem" } }
        has_more: { type: boolean }
        first_id: { type: [string, "null"] }
        last_id: { type: [string, "null"] }
    AdCanvasStore:
      type: object
      required: [type, id, domain]
      properties:
        type: { type: string, const: ad_canvas_store }
        id: { type: string }
        domain: { type: string, description: "The store's domain on its platform, such as its myshopify.com domain" }
    AdCanvasStoreList:
      type: object
      required: [data, has_more, first_id, last_id]
      properties:
        data: { type: array, items: { $ref: "#/components/schemas/AdCanvasStore" } }
        has_more: { type: boolean }
        first_id: { type: [string, "null"] }
        last_id: { type: [string, "null"] }
    AdRebuildParams:
      type: object
      additionalProperties: false
      required: [product, angle, audience]
      properties:
        product: { type: string, minLength: 1, maxLength: 500, pattern: "[^\\s\\u0085\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]", description: "What the brand sells in this ad" }
        angle: { type: string, minLength: 1, maxLength: 500, pattern: "[^\\s\\u0085\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]", description: "The angle to sell it on" }
        audience: { type: string, minLength: 1, maxLength: 500, pattern: "[^\\s\\u0085\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]", description: "Who buys it" }
    AdRebuild:
      type: object
      required: [type, id, breakdown_id, store_id, product, angle, audience, state, failure, scenes, render, created_at, finished_at]
      properties:
        type: { type: string, const: ad_rebuild }
        id: { type: string }
        breakdown_id: { type: string }
        store_id: { type: string }
        product: { type: string }
        angle: { type: string }
        audience: { type: string }
        state: { type: string, x-luckylanding-known-values: [rebuilding, rebuilt, failed] }
        failure: { type: [string, "null"], x-luckylanding-known-values: [rebuild_failed], description: "Why the rebuild failed; null unless state is failed" }
        scenes: { type: array, items: { $ref: "#/components/schemas/AdScene" }, description: "One rewritten scene for each scene of the breakdown, in the order it plays; empty unless state is rebuilt" }
        render: { oneOf: [{ $ref: "#/components/schemas/AdRender" }, { type: "null" }], description: "The video Lucky Landing renders of the rebuild once it is rebuilt; null unless state is rebuilt" }
        created_at: { type: string, format: date-time }
        finished_at: { type: [string, "null"], format: date-time, description: "When the rebuild was rebuilt or failed; null while it is rebuilding" }
    AdVariantParams:
      type: object
      additionalProperties: false
      required: [kind]
      properties:
        kind: { type: string, enum: [hook, words, shot, style], description: "What the one change rewrites: the hook, one scene's words, one scene's shot, or the style across the scenes" }
        scene: { type: integer, minimum: 0, maximum: 99, description: "The scene whose words or shot the change rewrites, counting from 0 in the order they play; only for words and shot" }
        style: { type: string, enum: [claymation, singing, ai_ugc], description: "The style to apply across the scenes; only for style" }
        instruction: { type: string, maxLength: 500, description: "What the merchant wants from the change, if anything" }
    AdChange:
      type: object
      required: [kind, scene, style, instruction]
      properties:
        kind: { type: string, x-luckylanding-known-values: [hook, words, shot, style] }
        scene: { type: [integer, "null"], minimum: 0, description: "The scene whose words or shot the change rewrites, counting from 0; null for hook and style, since a hook is always the first scene" }
        style: { type: [string, "null"], x-luckylanding-known-values: [claymation, singing, ai_ugc], description: "The style applied across the scenes; null unless kind is style" }
        instruction: { type: string, description: "What the merchant asked of the change; empty when they asked nothing" }
    AdVariant:
      type: object
      required: [type, id, rebuild_id, parent_variant_id, breakdown_id, store_id, change, state, failure, scenes, render, created_at, finished_at]
      properties:
        type: { type: string, const: ad_variant }
        id: { type: string }
        rebuild_id: { type: string, description: "The rebuild whose tree the variant is in" }
        parent_variant_id: { type: [string, "null"], description: "The variant this one was made from; null when it was made from the rebuild itself" }
        breakdown_id: { type: string }
        store_id: { type: string }
        change: { $ref: "#/components/schemas/AdChange" }
        state: { type: string, x-luckylanding-known-values: [varying, varied, failed] }
        failure: { type: [string, "null"], x-luckylanding-known-values: [variant_failed], description: "Why the variant failed; null unless state is failed" }
        scenes: { type: array, items: { $ref: "#/components/schemas/AdScene" }, description: "One scene for each scene of the breakdown, in the order it plays, with only the change's part different from the parent's; empty unless state is varied" }
        render: { oneOf: [{ $ref: "#/components/schemas/AdRender" }, { type: "null" }], description: "The video Lucky Landing renders of the variant once it is varied; null unless state is varied" }
        created_at: { type: string, format: date-time }
        finished_at: { type: [string, "null"], format: date-time, description: "When the variant was varied or failed; null while it is varying" }
    AdVariantNode:
      type: object
      required: [type, id, rebuild_id, parent_variant_id, breakdown_id, store_id, change, state, failure, created_at, finished_at]
      properties:
        type: { type: string, const: ad_variant }
        id: { type: string }
        rebuild_id: { type: string, description: "The rebuild whose tree the variant is in" }
        parent_variant_id: { type: [string, "null"], description: "The variant this one was made from; null when it was made from the rebuild itself" }
        breakdown_id: { type: string }
        store_id: { type: string }
        change: { $ref: "#/components/schemas/AdChange" }
        state: { type: string, x-luckylanding-known-values: [varying, varied, failed] }
        failure: { type: [string, "null"], x-luckylanding-known-values: [variant_failed], description: "Why the variant failed; null unless state is failed" }
        created_at: { type: string, format: date-time }
        finished_at: { type: [string, "null"], format: date-time, description: "When the variant was varied or failed; null while it is varying" }
    AdVariantList:
      type: object
      required: [data, has_more, first_id, last_id]
      properties:
        data: { type: array, items: { $ref: "#/components/schemas/AdVariantNode" } }
        has_more: { type: boolean }
        first_id: { type: [string, "null"] }
        last_id: { type: [string, "null"] }
    AdLaunch:
      type: object
      required: [type, id, rebuild_id, variant_id, breakdown_id, store_id, ad_account_id, state, failure, campaign_id, ad_set_id, creative_id, ad_id, unconfirmed, created_at, finished_at]
      properties:
        type: { type: string, const: ad_launch }
        id: { type: string }
        rebuild_id: { type: string, description: "The rebuild launched, or whose tree the launched variant is in" }
        variant_id: { type: [string, "null"], description: "The variant launched; null when the rebuild itself was launched" }
        breakdown_id: { type: string }
        store_id: { type: string }
        ad_account_id: { type: string, description: "The Meta ad account the launch goes to, without the act_ prefix" }
        state: { type: string, x-luckylanding-known-values: [launching, launched, failed] }
        failure: { type: [string, "null"], x-luckylanding-known-values: [launch_failed, meta_not_connected], description: "Why the launch failed; null unless state is failed" }
        campaign_id: { type: [string, "null"], description: "The Meta campaign's ID; null until Lucky Landing has made it" }
        ad_set_id: { type: [string, "null"], description: "The Meta ad set's ID; null until Lucky Landing has made it" }
        creative_id: { type: [string, "null"], description: "The Meta ad creative's ID; null until Lucky Landing has made it" }
        ad_id: { type: [string, "null"], description: "The Meta ad's ID; null until Lucky Landing has made it" }
        unconfirmed: { type: array, items: { type: string, x-luckylanding-known-values: [campaign, adset, adcreative, ad] }, description: "The levels Meta may hold that Lucky Landing has not yet confirmed paused and as sent: while launching, the object it is checking; once failed, any it could not pause" }
        created_at: { type: string, format: date-time }
        finished_at: { type: [string, "null"], format: date-time, description: "When the launch was launched or failed; null while it is launching" }
    AdLaunchList:
      type: object
      required: [data, has_more, first_id, last_id]
      properties:
        data: { type: array, items: { $ref: "#/components/schemas/AdLaunch" } }
        has_more: { type: boolean }
        first_id: { type: [string, "null"] }
        last_id: { type: [string, "null"] }
    AdRender:
      type: object
      required: [type, id, state, failure, created_at, finished_at]
      properties:
        type: { type: string, const: ad_render }
        id: { type: string, description: "The render's ID, which `getAdRenderVideo` takes" }
        state: { type: string, x-luckylanding-known-values: [rendering, rendered, failed] }
        failure: { type: [string, "null"], x-luckylanding-known-values: [render_failed], description: "Why the render failed; null unless state is failed" }
        created_at: { type: string, format: date-time }
        finished_at: { type: [string, "null"], format: date-time, description: "When the render was rendered or failed; null while it is rendering" }
    AdRenderVideo:
      type: object
      required: [type, render_id, video_type, video]
      properties:
        type: { type: string, const: ad_render_video }
        render_id: { type: string }
        video_type: { type: string, x-luckylanding-known-values: [video/mp4, video/webm] }
        video: { type: string, format: byte, description: "The rendered video's bytes, base64-encoded; at most 12 MiB before encoding" }
    AdScene:
      type: object
      required: [start_ms, end_ms, role, words, shot]
      properties:
        start_ms: { type: integer, minimum: 0, description: "When the scene starts, in milliseconds from the start of the video" }
        end_ms: { type: integer, minimum: 1, description: "When the scene ends, in milliseconds from the start of the video" }
        role: { type: string, x-luckylanding-known-values: [hook, body, call_to_action], description: "What the scene does in the ad" }
        words: { type: string, description: "The words spoken or shown in the scene; empty when there are none" }
        shot: { type: string, description: "What the scene shows" }
    CheckoutHeroImageParams:
      type: object
      additionalProperties: false
      required: [image]
      properties:
        image: { type: string, format: byte, description: "The image's bytes, base64-encoded." }
    CheckoutHeroImage:
      type: object
      required: [type, url]
      properties:
        type: { type: string, const: checkout_hero_image }
        url: { type: string, format: uri, description: "The hero image's link, for an offer draft's `hero_image_url`. It names the upload and never changes." }
    CheckoutLogo:
      type: object
      required: [type, url]
      properties:
        type: { type: string, const: checkout_logo }
        url: { type: string, format: uri, description: "The logo's link, for the checkout or offer draft's `logo_url`. It names the upload and never changes." }
    CheckoutThemeSource:
      description: Exact source, up to 16 KiB of UTF-8 per file.
      type: object
      additionalProperties: false
      required: [header_html, trust_html, guarantees_html, css]
      properties:
        header_html: { type: string, maxLength: 16384 }
        trust_html: { type: string, maxLength: 16384 }
        guarantees_html: { type: string, maxLength: 16384 }
        css: { type: string, maxLength: 16384 }
    CheckoutSourcePatchParams:
      type: object
      additionalProperties: false
      required: [expected_revision, patches]
      properties:
        expected_revision: { type: integer, format: int64, minimum: 1 }
        patches:
          type: array
          minItems: 1
          maxItems: 32
          items:
            type: object
            additionalProperties: false
            required: [file, find, replace]
            properties:
              file: { type: string, description: A name returned in the draft’s files. }
              find: { type: string, maxLength: 16384 }
              replace: { type: string, maxLength: 16384 }
              text_check: { $ref: "#/components/schemas/CheckoutSourceTextCheck", description: For a visible-text edit, find and replace contain the complete original and proposed file. The server verifies the shopper text with its HTML parser. }
    CheckoutSourceTextCheck:
      type: object
      additionalProperties: false
      required: [offset, value, fallback]
      properties:
        offset: { type: integer, minimum: 0, maximum: 16384, description: Offset of the original returned editable range. }
        value: { type: string, maxLength: 16384, description: Exact desired text content, including its surrounding whitespace. }
        fallback: { type: string, maxLength: 16384, description: Alternate spelling of just this range to use only if the primary spelling changes its rendered meaning. }

    CheckoutSourceDiff:
      type: object
      required: [type, revision, diff]
      properties:
        type: { type: string, const: checkout_source_diff }
        revision: { type: integer, format: int64 }
        diff: { type: string, description: Unified diff of the proposed file changes. }
    CheckoutLayout:
      type: string
      enum: [step_by_step, one_page]
    CheckoutProtectionPreviewParams:
      type: object
      additionalProperties: false
      required: [order_protection]
      properties:
        order_protection: { $ref: "#/components/schemas/CheckoutProtectionVariants" }
    CheckoutProtectionPreview:
      type: object
      required: [type, store_id, variant_id, unit_minor, currency, currency_exponent]
      properties:
        type: { type: string, const: checkout_protection_preview }
        store_id: { type: string, pattern: "^store_[0-7][0-9a-hjkmnp-tv-z]{25}$" }
        variant_id: { type: string, pattern: "^catalog_variant_[0-7][0-9a-hjkmnp-tv-z]{25}$" }
        unit_minor: { type: integer, format: int64, minimum: 1 }
        currency: { type: string, pattern: "^[A-Z]{3}$" }
        currency_exponent: { type: integer, minimum: 0 }
    CheckoutProtectionVariants:
      type: object
      maxProperties: 256
      description: Catalogue variant ID keyed by store ID. An empty object clears order protection.
      additionalProperties: { type: string, pattern: "^catalog_variant_[0-7][0-9a-hjkmnp-tv-z]{25}$" }
    CheckoutDesign:
      type: object
      required: [version]
      properties:
        version: { type: integer, const: 3 }
        theme: { $ref: "#/components/schemas/CheckoutThemeSource" }
        checkout_layout: { type: string, x-luckylanding-known-values: [step_by_step, one_page], description: New merchants start on one page. Choose one_page or step_by_step explicitly to change the draft. Older saved designs without a layout retain their step-by-step flow. }
        cart_link: { type: boolean }
        express_enabled: { type: boolean }
        discount_enabled: { type: boolean }
        order_protection: { $ref: "#/components/schemas/CheckoutProtectionVariants" }
        payment_action_color: { type: string, pattern: "^#[0-9a-fA-F]{6}$", description: Accent for the hosted payment action. The checkout chooses its readable foreground. }
        logo_url: { type: [string, "null"], minLength: 1, maxLength: 2048, description: Project-uploaded logo for the native store heading. Null clears it. }
    CheckoutDesignPreviewParams:
      type: object
      additionalProperties: false
      required: [draft_id, revision, page]
      properties:
        stage: { type: string, pattern: "^(details|payment)$", description: "Sample checkout before pricing or with payment ready." }
        page: { type: string, pattern: "^(checkout|thank_you)$" }
        block_id: { type: string, pattern: "^[a-z0-9-]+[.]html$", description: An authored HTML filename returned in the named draft. }
        draft_id: { type: string, pattern: "^design_draft_[0-7][0-9a-hjkmnp-tv-z]{25}$" }
        revision: { type: integer, format: int64, minimum: 1 }
    CheckoutDesignPreview:
      type: object
      required: [type, page, block_id, draft_id, revision, candidate_hash, scenario, captures]
      properties:
        type: { type: string, const: checkout_design_preview }
        page: { type: string, x-luckylanding-known-values: [checkout, thank_you] }
        block_id: { type: [string, "null"] }
        draft_id: { type: string }
        revision: { type: integer, format: int64 }
        candidate_hash: { type: string, description: SHA-256 of the typed design rendered by this preview. }
        scenario: { $ref: "#/components/schemas/CheckoutDesignPreviewScenario" }
        captures: { type: array, items: { $ref: "#/components/schemas/CheckoutDesignPreviewCapture" } }
    CheckoutDesignPreviewScenario:
      type: object
      required: [type, currency, currency_exponent, wallets]
      properties:
        stage: { type: string, x-luckylanding-known-values: [details, payment] }
        type: { type: string, const: sample }
        currency: { type: string }
        currency_exponent: { type: integer }
        wallets: { type: array, items: { type: string } }
    CheckoutDesignPreviewCapture:
      type: object
      required: [width, height, selected, image, axe, findings]
      properties:
        width: { type: integer }
        height: { type: integer }
        selected: { type: boolean, description: Whether the image contains just the requested block. }
        image: { type: string, format: byte, description: Base64-encoded JPEG image. }
        axe: { type: string, description: Version of axe-core. }
        findings: { type: array, items: { $ref: "#/components/schemas/CheckoutDesignPreviewFinding" } }
    CheckoutDesignPreviewFinding:
      type: object
      required: [outcome, rule, help, text, block_id, ratio, needed, reason]
      properties:
        outcome: { type: string, x-luckylanding-known-values: [violation, incomplete] }
        rule: { type: string }
        help: { type: string }
        text: { type: string, maxLength: 80, description: Visible sample text identifying the element with this finding. }
        block_id: { type: [string, "null"] }
        ratio: { type: [number, "null"], format: double }
        needed: { type: [number, "null"], format: double }
        reason: { type: [string, "null"] }
    CheckoutDesignParams:
      type: object
      additionalProperties: false
      required: [version]
      properties:
        version: { type: integer, const: 3 }
        checkout_layout: { $ref: "#/components/schemas/CheckoutLayout" }
        cart_link: { type: boolean }
        express_enabled: { type: boolean }
        discount_enabled: { type: boolean }
        payment_action_color: { type: string, pattern: "^#[0-9a-fA-F]{6}$", description: Accent for the hosted payment action. The checkout chooses its readable foreground. }
        logo_url: { type: [string, "null"], minLength: 1, maxLength: 2048, description: Project-uploaded logo for the native store heading. Null clears it. }
    CheckoutCheck:
      type: object
      required: [id, state, message]
      properties:
        id: { type: string, x-luckylanding-known-values: [checkout_design_inaccessible, invalid_design] }
        state: { type: string, x-luckylanding-known-values: [pass, warn, fail], description: "`pass` and `warn` allow publishing. `fail` and any value a client does not know block it." }
        message: { type: string }
    CheckoutDesignDraftSummary:
      type: object
      required: [type, id, name, revision]
      properties:
        type: { type: string, const: checkout_design_draft }
        id: { type: string }
        name: { type: string }
        revision: { type: integer, format: int64, minimum: 1 }
    CheckoutDesignDraft:
      type: object
      required: [type, id, name, revision, etag, design, can_undo, published_version_id]
      properties:
        type: { type: string, const: checkout_design_draft }
        id: { type: string }
        name: { type: string }
        revision: { type: integer, format: int64, minimum: 1 }
        etag: { type: string }
        files: { type: array, items: { $ref: "#/components/schemas/CheckoutThemeFile" }, description: Editable source files for this draft, including empty files. Pass a returned name to patch or diff. }
        design: { $ref: "#/components/schemas/CheckoutDesign" }
        can_undo: { type: boolean }
        published_version_id: { type: [string, "null"] }
    CheckoutThemeFile:
      type: object
      required: [name, source]
      properties:
        name: { type: string }
        source: { type: string, description: Exact UTF-8 content of this file. }
        editable_text: { type: array, items: { $ref: "#/components/schemas/CheckoutThemeText" }, description: Original text ranges in this revision of a merchant HTML section. Use the source editor for other content. }
    CheckoutThemeText:
      type: object
      required: [offset, parts]
      properties:
        offset: { type: integer, minimum: 0, description: Start of the entire original text node in UTF-16 code units, including any padding. }
        context: { type: string, description: A section landmark or source position distinguishing repeated copy. }
        parts: { type: array, items: { $ref: "#/components/schemas/CheckoutThemeTextPart" }, description: Consecutive pieces of this range in source order. }
    CheckoutThemeTextPart:
      type: object
      required: [text]
      properties:
        text: { type: string, description: Text seen by the shopper. }
        source: { type: string, description: Original spelling of a character reference or line ending when it differs from text. }
    CheckoutDesignDraftLookup:
      type: object
      required: [type, matches, match_count]
      properties:
        type: { type: string, const: checkout_design_draft_lookup }
        draft: { $ref: "#/components/schemas/CheckoutDesignDraft", description: The draft when exactly one name matches. }
        matches: { type: array, items: { $ref: "#/components/schemas/CheckoutDesignDraftSummary" }, description: Newest choices when the name is ambiguous. Use the draft list for the remaining IDs if match_count exceeds the number of choices. }
        match_count: { type: integer, format: int64, minimum: 0, description: Number of drafts in this project with the exact name. }
    CheckoutDesignDraftList:
      type: object
      required: [data, has_more, first_id, last_id]
      properties:
        data: { type: array, items: { $ref: "#/components/schemas/CheckoutDesignDraftSummary" } }
        has_more: { type: boolean }
        first_id: { type: [string, "null"] }
        last_id: { type: [string, "null"] }
    CheckoutDesignDraftParams:
      type: object
      additionalProperties: false
      required: [name]
      properties:
        name: { type: string, minLength: 1, maxLength: 100, pattern: "\\S" }
        source: { $ref: "#/components/schemas/CheckoutDesignDraftSourceParams" }
    CheckoutDesignDraftSourceParams:
      type: object
      additionalProperties: false
      required: [draft_id, revision]
      properties:
        draft_id: { type: string, pattern: "^design_draft_[0-7][0-9a-hjkmnp-tv-z]{25}$" }
        revision: { type: integer, format: int64, minimum: 1 }
    CheckoutDesignDraftPublishParams:
      type: object
      additionalProperties: false
      required: [expected_revision, expected_live_version_id]
      properties:
        expected_revision: { type: integer, format: int64, minimum: 1 }
        expected_live_version_id: { type: [string, "null"], pattern: "^design_version_[0-7][0-9a-hjkmnp-tv-z]{25}$" }
    CheckoutDesignUndoParams:
      type: object
      additionalProperties: false
      required: [expected_revision]
      properties:
        expected_revision: { type: integer, format: int64, minimum: 1 }
    CheckoutDesignEditsParams:
      type: object
      additionalProperties: false
      required: [expected_revision]
      properties:
        expected_revision: { type: integer, format: int64, minimum: 1 }
        checkout_layout: { $ref: "#/components/schemas/CheckoutLayout" }
        cart_link: { type: boolean }
        express_enabled: { type: boolean }
        discount_enabled: { type: boolean }
        order_protection: { $ref: "#/components/schemas/CheckoutProtectionVariants" }
        payment_action_color: { type: string, pattern: "^#[0-9a-fA-F]{6}$", description: Accent for the hosted payment action. The checkout chooses its readable foreground. }
        logo_url: { type: [string, "null"], minLength: 1, maxLength: 2048, description: Project-uploaded logo for the native store heading. Null clears it. }
    CheckoutDesignState:
      type: object
      required: [type, etag, revision, draft, published, published_revision, published_version_id, updated_at, checks]
      properties:
        type: { type: string, const: checkout_design }
        project_id: { type: string, pattern: "^project_[0-7][0-9a-hjkmnp-tv-z]{25}$", description: The project whose checkout design the caller is authorized to read. }
        etag: { type: string, description: "Strong entity tag of this version (RFC 9110); send it back in If-Match to change the resource." }
        revision: { type: integer, format: int64, minimum: 0 }
        draft: { $ref: "#/components/schemas/CheckoutDesign" }
        published: { oneOf: [{ $ref: "#/components/schemas/CheckoutDesign" }, { type: "null" }] }
        published_revision: { type: [integer, "null"], format: int64 }
        published_draft_id: { type: string, description: The named draft that produced the live version. Omitted for the default working design. }
        published_version_id: { type: [string, "null"], description: "The live version, from `checkout_list_design_versions`, or null before the first publish. `published` and `published_revision` are its design and revision." }
        updated_at: { type: string, format: date-time }
        checks: { type: array, items: { $ref: "#/components/schemas/CheckoutCheck" } }
    CheckoutDesignVersion:
      type: object
      required: [type, id, revision, design, published_at, actor_kind, actor_id, client_id, checks, live]
      properties:
        type: { type: string, const: checkout_design_version }
        id: { type: string }
        draft_id: { type: string, description: The named draft that produced this version. Omitted for the default working design. }
        draft_name: { type: string, description: Current name of the source draft when this is a named version. }
        draft_revision: { type: integer, format: int64, description: Current working revision of the source draft. }
        revision: { type: integer, format: int64, description: The draft revision this version published. }
        design: { $ref: "#/components/schemas/CheckoutDesign" }
        published_at: { type: string, format: date-time }
        actor_kind: { type: string, x-luckylanding-known-values: [person, api_key, oauth], description: "Who published it: a person in the dashboard, one of the org's API keys, or an app acting as its person, as in the audit log." }
        actor_id: { type: string, description: "The ID of the person or API key who published it. An app names its person here and itself in `client_id`." }
        client_id: { type: [string, "null"], description: "The API key's ID or the app's client ID; `null` when no key or app was used" }
        checks: { type: [array, "null"], items: { $ref: "#/components/schemas/CheckoutCheck" }, description: "The latest successful accessibility scan of this immutable source version. Re-audit can refresh these checks without changing the version or its original publication date. Null means no audit exists." }
        theme_status: { type: string, x-luckylanding-known-values: [audited, audit_required, release_updating], description: The authored theme’s status for the serving release. An audit is temporarily unavailable while the renderer is updating. A live theme requiring an audit uses the native checkout until its source passes. }
        live: { type: boolean, description: This version is the live design now. }
    CheckoutDesignVersionList:
      type: object
      required: [data, has_more, first_id, last_id]
      properties:
        data: { type: array, items: { $ref: "#/components/schemas/CheckoutDesignVersion" } }
        has_more: { type: boolean }
        first_id: { type: [string, "null"] }
        last_id: { type: [string, "null"] }
    CheckoutDesignRollbackParams:
      type: object
      additionalProperties: false
      required: [version_id]
      properties:
        version_id: { type: string, pattern: "^design_version_[0-7][0-9a-hjkmnp-tv-z]{25}$" }
    CheckoutDesignSaveParams:
      type: object
      additionalProperties: false
      required: [design]
      properties:
        design: { $ref: "#/components/schemas/CheckoutDesignParams" }
    CheckoutDnsRecord:
      type: object
      required: [type, name, value, state, reason]
      properties:
        type: { type: string, x-luckylanding-known-values: [CNAME, TXT] }
        name: { type: string, description: "Record host, e.g. checkout.shop.example or _ll-verify.checkout.shop.example" }
        value: { type: string }
        state: { type: string, x-luckylanding-known-values: [pending, verified, failed] }
        reason: { type: [string, "null"], x-luckylanding-known-values: [record_missing, record_wrong, record_elsewhere, record_proxied], description: "Why the record isn't verified at the last check: `record_missing` when the hostname has no such record, `record_wrong` when the TXT record holds another value, `record_elsewhere` when the hostname already has another record (an A, AAAA or a CNAME to another target), and `record_proxied` when the merchant's Cloudflare proxies it. `null` once verified or before the first check." }
    CheckoutDomainParams:
      type: object
      additionalProperties: false
      required: [hostname]
      properties:
        hostname: { type: string, minLength: 1, maxLength: 253, description: "The checkout hostname: one label in front of the merchant's domain, such as checkout.shop.example or pay.shop.example. Letters are matched without case." }
    CheckoutDomain:
      type: object
      required: [type, hostname, state, reason, records, checked_at]
      properties:
        type: { type: string, const: checkout_domain }
        hostname: { type: [string, "null"], maxLength: 253, format: hostname, description: "Bare hostname: no scheme, port, path or IP literal." }
        state: { type: string, x-luckylanding-known-values: [pending, verified, failed] }
        reason: { type: [string, "null"], x-luckylanding-known-values: [zone_on_cloudflare, caa_blocks, not_available], description: "Why the hostname is refused at the last check: `zone_on_cloudflare` when the merchant's own Cloudflare zone proxies it, and `caa_blocks` when its CAA records let no certificate authority Cloudflare issues from sign its certificate. `not_available` when Lucky Landing has not turned checkout hostnames on in this environment: `records` is empty, since no record can verify the hostname yet. `null` otherwise; each record's own `reason` says what it lacks." }
        records: { type: array, items: { $ref: "#/components/schemas/CheckoutDnsRecord" } }
        checked_at: { type: [string, "null"], format: date-time }
    MetaRefusals:
      type: object
      required: [type, pixels]
      properties:
        type: { type: string, const: meta_refusals }
        pixels: { type: array, items: { $ref: "#/components/schemas/MetaPixelRefusals" } }
    MetaPixelRefusals:
      type: object
      required: [connection_id, reason, refused, last_refused_at]
      properties:
        connection_id: { type: string, pattern: "^connection_[0-7][0-9a-hjkmnp-tv-z]{25}$" }
        reason: { type: string, x-luckylanding-known-values: [permission, invalid_event, other] }
        refused: { type: integer, format: int64, minimum: 1, description: "Server events the pixel's platform refused in the last 7 days." }
        last_refused_at: { type: string, format: date-time }
    CheckoutWallet:
      type: object
      required: [type, id, state, message]
      properties:
        type: { type: string, const: checkout_wallet }
        id: { type: string, x-luckylanding-known-values: [apple_pay, google_pay, paypal] }
        state: { type: string, x-luckylanding-known-values: [active, pending, degraded, unavailable] }
        message: { type: [string, "null"] }
    CheckoutWalletList:
      type: object
      required: [data, has_more, first_id, last_id]
      properties:
        data: { type: array, items: { $ref: "#/components/schemas/CheckoutWallet" } }
        has_more: { type: boolean }
        first_id: { type: [string, "null"] }
        last_id: { type: [string, "null"] }
    OutreachStore:
      type: object
      required: [type, id, name]
      properties:
        type: { type: string, const: outreach_store }
        id: { type: string }
        name: { type: string, description: "The store's myshopify.com domain" }
    OutreachStoreList:
      type: object
      required: [data, has_more, first_id, last_id]
      properties:
        data: { type: array, items: { $ref: "#/components/schemas/OutreachStore" } }
        has_more: { type: boolean }
        first_id: { type: [string, "null"] }
        last_id: { type: [string, "null"] }
    OutreachPersonaParams:
      type: object
      additionalProperties: false
      required: [name, role, tone, audience, selling_approach, emoji, instructions]
      properties:
        name: { type: string, maxLength: 30, description: "A first name only: no surname, title or brand. Saved in Unicode NFKC form with invisible (default-ignorable) characters removed, so styled letters save as plain ones" }
        role: { type: string, maxLength: 80 }
        tone: { type: string, maxLength: 80 }
        audience: { type: string, maxLength: 200 }
        selling_approach: { type: string, maxLength: 300 }
        wording: { type: string, maxLength: 300 }
        curiosity: { type: string, maxLength: 200 }
        emoji: { type: string, enum: [none, light] }
        local_style: { type: string, maxLength: 80 }
        boundaries: { type: string, maxLength: 500 }
        instructions: { type: string, maxLength: 2000 }
    OutreachPersona:
      type: object
      required: [type, id, etag, version, name, role, tone, audience, selling_approach, wording, curiosity, emoji, local_style, boundaries, instructions, created_at, updated_at]
      properties:
        type: { type: string, const: outreach_persona }
        id: { type: string }
        etag: { type: string, description: "Strong entity tag of this version (RFC 9110); send it back in If-Match to change the persona." }
        version: { type: integer, format: int64 }
        name: { type: string }
        role: { type: string }
        tone: { type: string }
        audience: { type: string }
        selling_approach: { type: string }
        wording: { type: string, description: "Empty when not set" }
        curiosity: { type: string, description: "Empty when not set" }
        emoji: { type: string, x-luckylanding-known-values: [none, light] }
        local_style: { type: string, description: "Empty when not set" }
        boundaries: { type: string, description: "Empty when not set" }
        instructions: { type: string }
        created_at: { type: string, format: date-time }
        updated_at: { type: string, format: date-time }
    OutreachPersonaDeleted:
      type: object
      required: [type, id]
      properties:
        type: { type: string, const: outreach_persona_deleted }
        id: { type: string }
    OutreachPersonaList:
      type: object
      required: [data, has_more, first_id, last_id]
      properties:
        data: { type: array, items: { $ref: "#/components/schemas/OutreachPersona" } }
        has_more: { type: boolean }
        first_id: { type: [string, "null"] }
        last_id: { type: [string, "null"] }
    OutreachEligibilityParams:
      type: object
      additionalProperties: false
      required: [included]
      properties:
        included: { type: boolean }
    OutreachProduct:
      type: object
      required: [type, id, store_id, title, image_url, active, category_name, eligibility, restricted_reason]
      properties:
        type: { type: string, const: outreach_product }
        id: { type: string, description: "The Shopify product ID" }
        store_id: { type: string }
        title: { type: string }
        image_url: { type: string, description: "Empty when the product has no image" }
        active: { type: boolean, description: "Whether the product's Shopify status is ACTIVE" }
        category_name: { type: string, description: "The product's full Shopify category, empty when none is set" }
        eligibility: { type: string, x-luckylanding-known-values: [included, excluded, restricted, inactive] }
        restricted_reason: { type: [string, "null"], x-luckylanding-known-values: [alcohol, tobacco, cannabis, weapons, gambling, prescription_drugs, adult, financial, unknown_category, no_category], description: "Why a restricted product is restricted; null otherwise" }
    OutreachProductList:
      type: object
      required: [data, has_more, first_id, last_id]
      properties:
        data: { type: array, items: { $ref: "#/components/schemas/OutreachProduct" } }
        has_more: { type: boolean }
        first_id: { type: [string, "null"] }
        last_id: { type: [string, "null"] }
    OutreachPersonaWeightParams:
      type: object
      additionalProperties: false
      required: [persona_id, weight]
      properties:
        persona_id: { type: string, pattern: "^persona_[0-7][0-9a-hjkmnp-tv-z]{25}$" }
        weight: { type: integer, minimum: 1, maximum: 100 }
    OutreachSendingHoursParams:
      type: object
      additionalProperties: false
      required: [start_hour, end_hour, days]
      properties:
        start_hour: { type: integer, minimum: 0, maximum: 23 }
        end_hour: { type: integer, minimum: 0, maximum: 24 }
        days: { type: array, maxItems: 7, items: { type: string, enum: [mon, tue, wed, thu, fri, sat, sun] } }
    OutreachFlowParams:
      type: object
      additionalProperties: false
      required: [store_id, delay_minutes, persona_weights, sending_hours, discount_tiers, max_tier, enabled]
      properties:
        store_id: { type: string, pattern: "^store_[0-7][0-9a-hjkmnp-tv-z]{25}$" }
        delay_minutes: { type: integer, minimum: 0, maximum: 10080 }
        persona_weights: { type: array, maxItems: 10, items: { $ref: "#/components/schemas/OutreachPersonaWeightParams" } }
        sending_hours: { $ref: "#/components/schemas/OutreachSendingHoursParams" }
        discount_tiers: { type: array, maxItems: 10, items: { type: integer, minimum: 0, maximum: 100 } }
        max_tier: { type: integer, minimum: 0, maximum: 100, description: "The highest discount tier allowed, as a percentage: 0 for no discount, otherwise one of discount_tiers" }
        enabled: { type: boolean, description: "Must be false: a flow cannot be turned on until sending is enabled for the org" }
    OutreachPersonaWeight:
      type: object
      required: [persona_id, weight]
      properties:
        persona_id: { type: string }
        weight: { type: integer }
    OutreachSendingHours:
      type: object
      required: [start_hour, end_hour, days]
      properties:
        start_hour: { type: integer }
        end_hour: { type: integer }
        days: { type: array, items: { type: string, x-luckylanding-known-values: [mon, tue, wed, thu, fri, sat] } }
    OutreachFlow:
      type: object
      required: [type, id, etag, version, store_id, trigger, delay_minutes, persona_weights, sending_hours, discount_tiers, max_tier, enabled, created_at, updated_at]
      properties:
        type: { type: string, const: outreach_flow }
        id: { type: string }
        etag: { type: string, description: "Strong entity tag of this version (RFC 9110); send it back in If-Match to change the flow." }
        version: { type: integer, format: int64 }
        store_id: { type: string }
        trigger: { type: string, x-luckylanding-known-values: [abandoned_cart] }
        delay_minutes: { type: integer }
        persona_weights: { type: array, items: { $ref: "#/components/schemas/OutreachPersonaWeight" } }
        sending_hours: { $ref: "#/components/schemas/OutreachSendingHours" }
        discount_tiers: { type: array, items: { type: integer } }
        max_tier: { type: integer }
        enabled: { type: boolean }
        created_at: { type: string, format: date-time }
        updated_at: { type: string, format: date-time }
    OutreachFlowList:
      type: object
      required: [data, has_more, first_id, last_id]
      properties:
        data: { type: array, items: { $ref: "#/components/schemas/OutreachFlow" } }
        has_more: { type: boolean }
        first_id: { type: [string, "null"] }
        last_id: { type: [string, "null"] }
    OutreachConversation:
      type: object
      required: [type, id, etag, store_id, flow_id, state, item_count, checkout_created_at, last_activity_at, created_at]
      properties:
        type: { type: string, const: outreach_conversation }
        id: { type: string }
        etag: { type: string, description: "Strong entity tag of this version (RFC 9110); send it back in If-Match to delete the conversation." }
        store_id: { type: string }
        flow_id: { type: string }
        state: { type: string, x-luckylanding-known-values: [automated, waiting_for_person, taken_over, closed] }
        item_count: { type: integer, format: int64, description: "How many items the abandoned checkout holds" }
        checkout_created_at: { type: string, format: date-time, description: "When the shopper started the abandoned checkout" }
        last_activity_at: { type: string, format: date-time }
        created_at: { type: string, format: date-time }
    OutreachConversationList:
      type: object
      required: [data, has_more, first_id, last_id]
      properties:
        data: { type: array, items: { $ref: "#/components/schemas/OutreachConversation" } }
        has_more: { type: boolean }
        first_id: { type: [string, "null"] }
        last_id: { type: [string, "null"] }
    OutreachConversationDeleted:
      type: object
      required: [type, id]
      properties:
        type: { type: string, const: outreach_conversation_deleted }
        id: { type: string }
    OutreachDraft:
      type: object
      required: [type, id, conversation_id, state, body, staff_note, refused_for, created_at, decided_at]
      properties:
        type: { type: string, const: outreach_draft }
        id: { type: string }
        conversation_id: { type: string }
        state: { type: string, x-luckylanding-known-values: [pending, approved, rejected, refused] }
        body: { type: [string, "null"], description: "The message as it would be sent, as plain text; null when the draft was refused or purged" }
        staff_note: { type: [string, "null"], description: "The model's plain-text note for the store's staff, never sent to a shopper; null when the draft was refused or purged" }
        refused_for: { type: array, items: { type: string, x-luckylanding-known-values: [malformed, refused, truncated, out_of_bounds, names_ineligible_product, unsafe_title, unsafe_staff_note, call_unconfirmed, expired] }, description: "Each rule the model's plan broke; call_unconfirmed when Lucky Landing can't tell whether the model answered and charged the worst case; expired when the draft was still waiting for its model call after 30 days; empty unless the draft was refused" }
        created_at: { type: string, format: date-time }
        decided_at: { type: [string, "null"], format: date-time, description: "When a person approved or rejected the draft" }
    OutreachDraftList:
      type: object
      required: [data, has_more, first_id, last_id]
      properties:
        data: { type: array, items: { $ref: "#/components/schemas/OutreachDraft" } }
        has_more: { type: boolean }
        first_id: { type: [string, "null"] }
        last_id: { type: [string, "null"] }
    OutreachAlert:
      type: object
      required: [type, id, kind, conversation_id, created_at, dismissed_at]
      properties:
        type: { type: string, const: outreach_alert }
        id: { type: string }
        kind: { type: string, x-luckylanding-known-values: [handoff_needed, stop_received, send_failed, budget_reached, provider_down] }
        conversation_id: { type: [string, "null"], description: "The conversation the alert is about; null for an alert about the whole org, such as budget_reached or provider_down" }
        created_at: { type: string, format: date-time }
        dismissed_at: { type: [string, "null"], format: date-time }
    OutreachBudget:
      type: object
      required: [type, ceiling, maximum, reserved, spent]
      properties:
        type: { type: string, const: outreach_budget }
        ceiling: { $ref: "#/components/schemas/Money", description: "The most the org's model calls may cost, set by the org" }
        maximum: { $ref: "#/components/schemas/Money", description: "The highest ceiling Lucky Landing staff allow this org" }
        reserved: { $ref: "#/components/schemas/Money", description: "The worst-case cost of the model calls still running" }
        spent: { $ref: "#/components/schemas/Money", description: "What finished model calls cost, at list price" }
    OutreachBudgetParams:
      type: object
      additionalProperties: false
      required: [ceiling]
      properties:
        ceiling: { $ref: "#/components/schemas/MoneyParams" }
    OutreachAlertList:
      type: object
      required: [data, has_more, first_id, last_id]
      properties:
        data: { type: array, items: { $ref: "#/components/schemas/OutreachAlert" } }
        has_more: { type: boolean }
        first_id: { type: [string, "null"] }
        last_id: { type: [string, "null"] }
