{
  "components": {
    "schemas": {
      "ActivationOut": {
        "properties": {
          "id": {
            "description": "The machine's activation id, act_…",
            "title": "Id",
            "type": "string"
          },
          "last_seen": {
            "description": "When the machine last reached Keyseal.",
            "format": "date-time",
            "title": "Last Seen",
            "type": "string"
          },
          "machine_name": {
            "description": "The machine's name, as the software sent it.",
            "title": "Machine Name",
            "type": "string"
          },
          "platform": {
            "description": "The machine's platform, as the software sent it.",
            "title": "Platform",
            "type": "string"
          }
        },
        "required": [
          "id",
          "machine_name",
          "platform",
          "last_seen"
        ],
        "title": "ActivationOut",
        "type": "object"
      },
      "AnalyticsDay": {
        "properties": {
          "activations": {
            "description": "New activations and successful reactivations.",
            "title": "Activations",
            "type": "integer"
          },
          "active_machines": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Occupied seats at the sample, null for a gap.",
            "title": "Active Machines"
          },
          "cancellations": {
            "description": "Subscriptions that ended on this UTC day.",
            "title": "Cancellations",
            "type": "integer"
          },
          "coverage": {
            "$ref": "#/components/schemas/Coverage",
            "description": "Current reconciliation coverage of contributing orders."
          },
          "day": {
            "description": "UTC calendar day.",
            "format": "date",
            "title": "Day",
            "type": "string"
          },
          "machines_observed_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "UTC gauge sample, null for a gap.",
            "title": "Machines Observed At"
          },
          "sales": {
            "description": "Sale amounts by original buyer currency.",
            "items": {
              "$ref": "#/components/schemas/SalesAmounts"
            },
            "title": "Sales",
            "type": "array"
          },
          "sales_count": {
            "description": "Number of orders paid, including zero-amount sales.",
            "title": "Sales Count",
            "type": "integer"
          },
          "settlement": {
            "description": "Balance amounts by observed settlement currency. Unknown currencies are omitted. Partial amounts include only evidenced movements.",
            "items": {
              "$ref": "#/components/schemas/SettlementAmounts"
            },
            "title": "Settlement",
            "type": "array"
          },
          "subscription_renewals": {
            "description": "Subsequent paid subscription periods.",
            "title": "Subscription Renewals",
            "type": "integer"
          },
          "updates_extended": {
            "description": "Paid extensions of the update entitlement.",
            "title": "Updates Extended",
            "type": "integer"
          }
        },
        "required": [
          "sales_count",
          "sales",
          "settlement",
          "coverage",
          "updates_extended",
          "subscription_renewals",
          "day",
          "activations",
          "active_machines",
          "machines_observed_at",
          "cancellations"
        ],
        "title": "AnalyticsDay",
        "type": "object"
      },
      "AnalyticsReport": {
        "properties": {
          "by_country": {
            "description": "Totals grouped by original buyer country.",
            "items": {
              "$ref": "#/components/schemas/CountryTotals"
            },
            "title": "By Country",
            "type": "array"
          },
          "by_plan": {
            "description": "Totals grouped by the original plan.",
            "items": {
              "$ref": "#/components/schemas/PlanTotals"
            },
            "title": "By Plan",
            "type": "array"
          },
          "daily": {
            "description": "UTC days through the observation date.",
            "items": {
              "$ref": "#/components/schemas/AnalyticsDay"
            },
            "title": "Daily",
            "type": "array"
          },
          "from": {
            "description": "Requested first UTC date, inclusive.",
            "format": "date",
            "title": "From",
            "type": "string"
          },
          "observed_at": {
            "description": "UTC instant of observation.",
            "format": "date-time",
            "title": "Observed At",
            "type": "string"
          },
          "product_id": {
            "anyOf": [
              {
                "format": "uuid",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Selected product, or null for the entire scope.",
            "title": "Product Id"
          },
          "recurring": {
            "$ref": "#/components/schemas/RecurringReport",
            "description": "Period-end MRR and effective cancellations."
          },
          "to": {
            "description": "Requested last UTC date, inclusive.",
            "format": "date",
            "title": "To",
            "type": "string"
          },
          "totals": {
            "$ref": "#/components/schemas/Totals",
            "description": "Financial and renewal totals over the selected dates."
          }
        },
        "required": [
          "from",
          "to",
          "observed_at",
          "product_id",
          "totals",
          "daily",
          "by_country",
          "by_plan",
          "recurring"
        ],
        "title": "AnalyticsReport",
        "type": "object"
      },
      "ApiKeyCreate": {
        "properties": {
          "name": {
            "description": "A name to recognise the key by, 1 to 200 characters.",
            "maxLength": 200,
            "minLength": 1,
            "pattern": "^[^\\x00-\\x1f\\x7f]*$",
            "title": "Name",
            "type": "string"
          },
          "scopes": {
            "description": "The key's rights, at least one: read, licences, catalog, files, customers, admin (admin implies all the others).",
            "items": {
              "$ref": "#/components/schemas/ApiScope"
            },
            "maxItems": 6,
            "minItems": 1,
            "title": "Scopes",
            "type": "array"
          }
        },
        "required": [
          "name",
          "scopes"
        ],
        "title": "ApiKeyCreate",
        "type": "object"
      },
      "ApiKeyCreated": {
        "properties": {
          "created_at": {
            "description": "When the key was made.",
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "created_by": {
            "anyOf": [
              {
                "format": "uuid",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The id of the person the key belongs to (for a key made by a key, that key's person); null for a key made by the command line. The key is revoked when this person leaves the organization or becomes a member.",
            "title": "Created By"
          },
          "environment": {
            "$ref": "#/components/schemas/Environment",
            "description": "The key's environment, the one of its prefix (ksk_test_ or ksk_live_)."
          },
          "hint": {
            "description": "The prefix and the first characters of the key, to recognise it: never the key.",
            "title": "Hint",
            "type": "string"
          },
          "id": {
            "description": "The key's id.",
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "key": {
            "description": "The key itself, ksk_test_… or ksk_live_…: shown in this answer only, never again.",
            "title": "Key",
            "type": "string"
          },
          "last_used_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the key was last used; null if never.",
            "title": "Last Used At"
          },
          "name": {
            "description": "The key's name.",
            "title": "Name",
            "type": "string"
          },
          "revoked_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the key was revoked; null while it works.",
            "title": "Revoked At"
          },
          "scopes": {
            "description": "The key's rights; admin implies all the others.",
            "items": {
              "$ref": "#/components/schemas/ApiScope"
            },
            "title": "Scopes",
            "type": "array"
          }
        },
        "required": [
          "id",
          "name",
          "environment",
          "scopes",
          "hint",
          "created_by",
          "created_at",
          "last_used_at",
          "revoked_at",
          "key"
        ],
        "title": "ApiKeyCreated",
        "type": "object"
      },
      "ApiKeyOut": {
        "properties": {
          "created_at": {
            "description": "When the key was made.",
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "created_by": {
            "anyOf": [
              {
                "format": "uuid",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The id of the person the key belongs to (for a key made by a key, that key's person); null for a key made by the command line. The key is revoked when this person leaves the organization or becomes a member.",
            "title": "Created By"
          },
          "environment": {
            "$ref": "#/components/schemas/Environment",
            "description": "The key's environment, the one of its prefix (ksk_test_ or ksk_live_)."
          },
          "hint": {
            "description": "The prefix and the first characters of the key, to recognise it: never the key.",
            "title": "Hint",
            "type": "string"
          },
          "id": {
            "description": "The key's id.",
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "last_used_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the key was last used; null if never.",
            "title": "Last Used At"
          },
          "name": {
            "description": "The key's name.",
            "title": "Name",
            "type": "string"
          },
          "revoked_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the key was revoked; null while it works.",
            "title": "Revoked At"
          },
          "scopes": {
            "description": "The key's rights; admin implies all the others.",
            "items": {
              "$ref": "#/components/schemas/ApiScope"
            },
            "title": "Scopes",
            "type": "array"
          }
        },
        "required": [
          "id",
          "name",
          "environment",
          "scopes",
          "hint",
          "created_by",
          "created_at",
          "last_used_at",
          "revoked_at"
        ],
        "title": "ApiKeyOut",
        "type": "object"
      },
      "ApiKeysResponse": {
        "properties": {
          "api_keys": {
            "description": "The keys of the environment of the request, revoked ones included, oldest first.",
            "items": {
              "$ref": "#/components/schemas/ApiKeyOut"
            },
            "title": "Api Keys",
            "type": "array"
          }
        },
        "required": [
          "api_keys"
        ],
        "title": "ApiKeysResponse",
        "type": "object"
      },
      "ApiScope": {
        "enum": [
          "read",
          "licences",
          "catalog",
          "files",
          "customers",
          "admin"
        ],
        "title": "ApiScope",
        "type": "string"
      },
      "BillingChangeRequest": {
        "additionalProperties": false,
        "properties": {
          "edition_id": {
            "anyOf": [
              {
                "format": "uuid",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The new recurring edition. Cannot be combined with renew.",
            "title": "Edition Id"
          },
          "renew": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "description": "Enable or stop renewal at the end of the paid period.",
            "title": "Renew"
          },
          "request_id": {
            "description": "A fresh UUIDv4 for this action. Reuse it only for an exact retry.",
            "format": "uuid4",
            "title": "Request Id",
            "type": "string"
          }
        },
        "required": [
          "request_id"
        ],
        "title": "BillingChangeRequest",
        "type": "object"
      },
      "BillingDimension": {
        "properties": {
          "level": {
            "description": "Observed threshold, including reservations. Warning starts at eighty percent.",
            "enum": [
              "normal",
              "warning",
              "exceeded"
            ],
            "title": "Level",
            "type": "string"
          },
          "limit": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Maximum quantity including reservations. Null means unmetered.",
            "title": "Limit"
          },
          "reserved": {
            "description": "Quantity reserved for pending operations in this environment.",
            "title": "Reserved",
            "type": "integer"
          },
          "used": {
            "description": "Quantity already consumed in the current measurement window.",
            "title": "Used",
            "type": "integer"
          }
        },
        "required": [
          "used",
          "reserved",
          "limit",
          "level"
        ],
        "title": "BillingDimension",
        "type": "object"
      },
      "BillingEdition": {
        "properties": {
          "amount": {
            "description": "Stripe integer price. Zero means free.",
            "title": "Amount",
            "type": "integer"
          },
          "amount_exponent": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Divide amount by ten raised to this exponent. Null for free.",
            "title": "Amount Exponent"
          },
          "code": {
            "description": "Stable plan code across editions.",
            "title": "Code",
            "type": "string"
          },
          "currency": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Lowercase ISO currency code, or null for a free edition.",
            "title": "Currency"
          },
          "family_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Family shared by billing cadences. Null for historical standalone editions.",
            "title": "Family Code"
          },
          "id": {
            "description": "Immutable edition UUID.",
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "interval": {
            "anyOf": [
              {
                "enum": [
                  "month",
                  "year"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Recurring billing interval, or null for a free edition.",
            "title": "Interval"
          },
          "limits": {
            "$ref": "#/components/schemas/PlanLimits",
            "description": "Limits attached to this edition."
          },
          "name_en": {
            "description": "English display name.",
            "title": "Name En",
            "type": "string"
          },
          "name_fr": {
            "description": "French display name.",
            "title": "Name Fr",
            "type": "string"
          },
          "version": {
            "description": "Edition number of this plan.",
            "title": "Version",
            "type": "integer"
          }
        },
        "required": [
          "id",
          "code",
          "version",
          "name_fr",
          "name_en",
          "amount",
          "currency",
          "amount_exponent",
          "interval",
          "limits"
        ],
        "title": "BillingEdition",
        "type": "object"
      },
      "BillingInterval": {
        "enum": [
          "month",
          "year"
        ],
        "title": "BillingInterval",
        "type": "string"
      },
      "BillingOverview": {
        "properties": {
          "awaiting_first_payment": {
            "description": "Checkout is confirmed; the first paid invoice is pending.",
            "title": "Awaiting First Payment",
            "type": "boolean"
          },
          "cancel_at_period_end": {
            "description": "Whether automatic renewal is scheduled to stop.",
            "title": "Cancel At Period End",
            "type": "boolean"
          },
          "cancellation_effective_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Scheduled end of renewal, including future periods already paid.",
            "title": "Cancellation Effective At"
          },
          "change_effective_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Effective date of an announced change, when known.",
            "title": "Change Effective At"
          },
          "environment": {
            "$ref": "#/components/schemas/Environment",
            "description": "Environment of the displayed usage."
          },
          "manages_subscription": {
            "description": "Whether a recurring subscription exists to manage in this profile.",
            "title": "Manages Subscription",
            "type": "boolean"
          },
          "observed_at": {
            "description": "Time at which access and usage were calculated.",
            "format": "date-time",
            "title": "Observed At",
            "type": "string"
          },
          "offers": {
            "description": "Editions available from the active catalog.",
            "items": {
              "$ref": "#/components/schemas/BillingEdition"
            },
            "title": "Offers",
            "type": "array"
          },
          "operator_access": {
            "description": "Complimentary platform operator access. Unconfigured means the current catalog has no designated operator edition and ordinary rights still apply.",
            "enum": [
              "none",
              "included",
              "unconfigured"
            ],
            "title": "Operator Access",
            "type": "string"
          },
          "paid_from": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Start of the currently effective paid period, if any.",
            "title": "Paid From"
          },
          "paid_until": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Exclusive end of the currently effective paid period, if any.",
            "title": "Paid Until"
          },
          "payment_environment": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Environment"
              },
              {
                "type": "null"
              }
            ],
            "description": "Billing environment. Null in beta or if the seller is unconfigured."
          },
          "pending_payment": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PendingCheckout"
              },
              {
                "type": "null"
              }
            ],
            "description": "Unconfirmed checkout for this organization, or null."
          },
          "pending_plan": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/BillingEdition"
              },
              {
                "type": "null"
              }
            ],
            "description": "Announced renewal edition, or the next prepaid edition if none is announced."
          },
          "plan": {
            "$ref": "#/components/schemas/BillingEdition",
            "description": "The edition providing the current rights."
          },
          "prepaid_change": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PrepaidChange"
              },
              {
                "type": "null"
              }
            ],
            "description": "Next paid change of edition. May precede another announced renewal change."
          },
          "profile": {
            "description": "The platform billing profile.",
            "enum": [
              "beta",
              "sandbox",
              "commercial"
            ],
            "title": "Profile",
            "type": "string"
          },
          "status": {
            "description": "Status derived from confirmed payments and paid periods.",
            "enum": [
              "beta",
              "free",
              "active",
              "past_due",
              "canceled"
            ],
            "title": "Status",
            "type": "string"
          },
          "subscription_plan": {
            "$ref": "#/components/schemas/BillingEdition",
            "description": "The organization's ordinary edition from its subscription or the free default."
          },
          "usage": {
            "$ref": "#/components/schemas/BillingUsage",
            "description": "Usage and effective limits for the selected environment."
          }
        },
        "required": [
          "profile",
          "payment_environment",
          "environment",
          "observed_at",
          "plan",
          "subscription_plan",
          "operator_access",
          "offers",
          "status",
          "awaiting_first_payment",
          "manages_subscription",
          "paid_from",
          "paid_until",
          "pending_plan",
          "change_effective_at",
          "prepaid_change",
          "cancellation_effective_at",
          "cancel_at_period_end",
          "pending_payment",
          "usage"
        ],
        "title": "BillingOverview",
        "type": "object"
      },
      "BillingStart": {
        "additionalProperties": false,
        "properties": {
          "edition_id": {
            "description": "The paid edition from billing.get to subscribe to.",
            "format": "uuid",
            "title": "Edition Id",
            "type": "string"
          },
          "request_id": {
            "description": "A fresh UUIDv4 for this action. Reuse it only for an exact retry.",
            "format": "uuid4",
            "title": "Request Id",
            "type": "string"
          }
        },
        "required": [
          "request_id",
          "edition_id"
        ],
        "title": "BillingStart",
        "type": "object"
      },
      "BillingSubmitted": {
        "properties": {
          "status": {
            "const": "submitted",
            "default": "submitted",
            "description": "The request was submitted. Read billing.get for the confirmed state.",
            "title": "Status",
            "type": "string"
          }
        },
        "title": "BillingSubmitted",
        "type": "object"
      },
      "BillingUsage": {
        "properties": {
          "dimensions": {
            "additionalProperties": {
              "$ref": "#/components/schemas/BillingDimension"
            },
            "description": "Current quantities indexed by quota dimension.",
            "title": "Dimensions",
            "type": "object"
          },
          "enforced": {
            "description": "Whether commercial ceilings apply here.",
            "title": "Enforced",
            "type": "boolean"
          },
          "period_end": {
            "description": "First excluded day of the UTC calendar month.",
            "format": "date",
            "title": "Period End",
            "type": "string"
          },
          "period_start": {
            "description": "First included day of the UTC calendar month.",
            "format": "date",
            "title": "Period Start",
            "type": "string"
          },
          "webhook_retention_days": {
            "description": "Number of days of webhook delivery history retained.",
            "title": "Webhook Retention Days",
            "type": "integer"
          }
        },
        "required": [
          "period_start",
          "period_end",
          "enforced",
          "webhook_retention_days",
          "dimensions"
        ],
        "title": "BillingUsage",
        "type": "object"
      },
      "CatalogSyncOut": {
        "description": "What a push of the catalogue did. ``failures``: the objects Stripe refused, skipped;\n``error``: why the push stopped (``stripe_unavailable``, ``stripe_not_connected``,\n``catalog_sync_failed``), what came before it being kept.",
        "properties": {
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Why the push stopped (stripe_unavailable, stripe_not_connected, catalog_sync_failed), what came before being kept; null when it went to its end.",
            "title": "Error"
          },
          "failures": {
            "description": "The objects Stripe refused: skipped, the others pushed.",
            "items": {
              "$ref": "#/components/schemas/SyncFailureOut"
            },
            "title": "Failures",
            "type": "array"
          },
          "prices_created": {
            "description": "The prices created at Stripe.",
            "title": "Prices Created",
            "type": "integer"
          },
          "prices_deactivated": {
            "description": "The prices deactivated at Stripe (replaced by a new price).",
            "title": "Prices Deactivated",
            "type": "integer"
          },
          "products_created": {
            "description": "The products created at Stripe.",
            "title": "Products Created",
            "type": "integer"
          },
          "products_updated": {
            "description": "The products updated at Stripe.",
            "title": "Products Updated",
            "type": "integer"
          },
          "synced": {
            "description": "True when everything passed.",
            "title": "Synced",
            "type": "boolean"
          }
        },
        "required": [
          "synced",
          "error",
          "products_created",
          "products_updated",
          "prices_created",
          "prices_deactivated",
          "failures"
        ],
        "title": "CatalogSyncOut",
        "type": "object"
      },
      "CheckoutLocation": {
        "properties": {
          "url": {
            "description": "Private, temporary HTTPS checkout link for this signed-in person.",
            "title": "Url",
            "type": "string"
          }
        },
        "required": [
          "url"
        ],
        "title": "CheckoutLocation",
        "type": "object"
      },
      "ConfirmResponse": {
        "properties": {
          "results": {
            "description": "One result per match_id, in the order sent.",
            "items": {
              "$ref": "#/components/schemas/ConfirmationOut"
            },
            "title": "Results",
            "type": "array"
          }
        },
        "required": [
          "results"
        ],
        "title": "ConfirmResponse",
        "type": "object"
      },
      "ConfirmationOut": {
        "properties": {
          "code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Why a pair is not linked (subscription_match_stale, subscription_match_not_confirmable, stripe_unavailable, stripe_key_invalid, stripe_permissions_missing, stripe_refused, internal_error), or why its metadata is not at Stripe yet; null otherwise.",
            "title": "Code"
          },
          "licence_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The licence, lic_…; null for a match_id not of this import.",
            "title": "Licence Id"
          },
          "match_id": {
            "description": "The pair, as sent.",
            "title": "Match Id",
            "type": "string"
          },
          "outcome": {
            "description": "linked, already_linked, stale (read the proposals again), not_confirmable or failed.",
            "title": "Outcome",
            "type": "string"
          },
          "subscription_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The Stripe subscription, sub_…; null for a match_id not of this import.",
            "title": "Subscription Id"
          },
          "tag_pending": {
            "description": "True when the pair is linked but Stripe did not take Keyseal's metadata yet (code says why): confirm the same pair again.",
            "title": "Tag Pending",
            "type": "boolean"
          }
        },
        "required": [
          "match_id",
          "outcome",
          "code",
          "subscription_id",
          "licence_id",
          "tag_pending"
        ],
        "title": "ConfirmationOut",
        "type": "object"
      },
      "CountryTotals": {
        "properties": {
          "country": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Buyer country at the sale (ISO alpha-2), or null.",
            "title": "Country"
          },
          "coverage": {
            "$ref": "#/components/schemas/Coverage",
            "description": "Current reconciliation coverage of contributing orders."
          },
          "sales": {
            "description": "Sale amounts by original buyer currency.",
            "items": {
              "$ref": "#/components/schemas/SalesAmounts"
            },
            "title": "Sales",
            "type": "array"
          },
          "sales_count": {
            "description": "Number of orders paid, including zero-amount sales.",
            "title": "Sales Count",
            "type": "integer"
          },
          "settlement": {
            "description": "Balance amounts by observed settlement currency. Unknown currencies are omitted. Partial amounts include only evidenced movements.",
            "items": {
              "$ref": "#/components/schemas/SettlementAmounts"
            },
            "title": "Settlement",
            "type": "array"
          },
          "subscription_renewals": {
            "description": "Subsequent paid subscription periods.",
            "title": "Subscription Renewals",
            "type": "integer"
          },
          "updates_extended": {
            "description": "Paid extensions of the update entitlement.",
            "title": "Updates Extended",
            "type": "integer"
          }
        },
        "required": [
          "sales_count",
          "sales",
          "settlement",
          "coverage",
          "updates_extended",
          "subscription_renewals",
          "country"
        ],
        "title": "CountryTotals",
        "type": "object"
      },
      "Coverage": {
        "properties": {
          "missing_fees": {
            "description": "Orders whose settlement fee evidence is incomplete.",
            "title": "Missing Fees",
            "type": "integer"
          },
          "missing_net": {
            "description": "Orders whose balance reconciliation is incomplete.",
            "title": "Missing Net",
            "type": "integer"
          },
          "missing_refunds": {
            "description": "Orders with incomplete evidence of buyer refunds.",
            "title": "Missing Refunds",
            "type": "integer"
          },
          "missing_tax": {
            "description": "Orders whose tax evidence is incomplete.",
            "title": "Missing Tax",
            "type": "integer"
          },
          "orders": {
            "description": "Distinct orders with a sale, movement or possible undated refund in the group.",
            "title": "Orders",
            "type": "integer"
          }
        },
        "required": [
          "orders",
          "missing_tax",
          "missing_fees",
          "missing_net",
          "missing_refunds"
        ],
        "title": "Coverage",
        "type": "object"
      },
      "CurrentOrganization": {
        "properties": {
          "brand_color": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The brand colour, #RRGGBB; null for none.",
            "title": "Brand Color"
          },
          "environment": {
            "$ref": "#/components/schemas/Environment",
            "description": "The environment of the request: test or live."
          },
          "id": {
            "description": "The organization's id.",
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "logo_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The logo URL used in mail, the customer area and the public pages. The logo uploaded to Keyseal (organization.upload_logo) is shown inline; logos hosted externally are offered as links. Null for none.",
            "title": "Logo Url"
          },
          "name": {
            "description": "The organization's name, shown in the mails to buyers.",
            "title": "Name",
            "type": "string"
          },
          "reply_to_ok": {
            "description": "True when support_email is a plain address, used as the Reply-To of the mails to buyers; false without one, or for an address Keyseal would not use.",
            "title": "Reply To Ok",
            "type": "boolean"
          },
          "sale_alerts": {
            "description": "True when each owner of the organization gets a mail for each sale paid through the checkout page (a purchase, a renewal, a subscription's first payment; 0 included), in both environments; true by default.",
            "title": "Sale Alerts",
            "type": "boolean"
          },
          "slug": {
            "description": "The organization's slug: the value of the Keyseal-Organization header.",
            "title": "Slug",
            "type": "string"
          },
          "support_email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The Reply-To address of the mails to buyers; null for none.",
            "title": "Support Email"
          }
        },
        "required": [
          "id",
          "slug",
          "name",
          "environment",
          "support_email",
          "logo_url",
          "brand_color",
          "reply_to_ok",
          "sale_alerts"
        ],
        "title": "CurrentOrganization",
        "type": "object"
      },
      "CurrentUsage": {
        "properties": {
          "active_licences": {
            "description": "Currently usable licences.",
            "title": "Active Licences",
            "type": "integer"
          },
          "active_machines": {
            "description": "Currently occupied seats on usable licences.",
            "title": "Active Machines",
            "type": "integer"
          },
          "members": {
            "description": "Members in the entire organization, across environments.",
            "title": "Members",
            "type": "integer"
          },
          "observed_at": {
            "description": "UTC instant of observation.",
            "format": "date-time",
            "title": "Observed At",
            "type": "string"
          },
          "products": {
            "description": "Products in this environment.",
            "title": "Products",
            "type": "integer"
          },
          "storage_bytes": {
            "description": "Total bytes of confirmed ready files.",
            "title": "Storage Bytes",
            "type": "integer"
          }
        },
        "required": [
          "observed_at",
          "active_licences",
          "active_machines",
          "storage_bytes",
          "products",
          "members"
        ],
        "title": "CurrentUsage",
        "type": "object"
      },
      "CustomOut": {
        "properties": {
          "intro": {
            "description": "The introduction, paragraphs apart by a blank line.",
            "title": "Intro",
            "type": "string"
          },
          "outro": {
            "description": "The conclusion, paragraphs apart by a blank line.",
            "title": "Outro",
            "type": "string"
          },
          "subject": {
            "description": "The subject.",
            "title": "Subject",
            "type": "string"
          },
          "updated_at": {
            "description": "When the publisher's text was last written.",
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "subject",
          "intro",
          "outro",
          "updated_at"
        ],
        "title": "CustomOut",
        "type": "object"
      },
      "CustomerDetail": {
        "properties": {
          "country": {
            "description": "The customer's country, two letters; empty when unknown.",
            "title": "Country",
            "type": "string"
          },
          "created_at": {
            "description": "When Keyseal first knew the customer.",
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "email": {
            "description": "The customer's address.",
            "title": "Email",
            "type": "string"
          },
          "emails": {
            "description": "The customer's latest 20 mails, newest first: never the address nor the text.",
            "items": {
              "$ref": "#/components/schemas/EmailOut"
            },
            "title": "Emails",
            "type": "array"
          },
          "emails_count": {
            "description": "All the customer's mails.",
            "title": "Emails Count",
            "type": "integer"
          },
          "id": {
            "description": "The customer's id.",
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "licences": {
            "description": "The customer's latest 100 licences, newest first, as licences.list gives them.",
            "items": {
              "$ref": "#/components/schemas/LicenceOut"
            },
            "title": "Licences",
            "type": "array"
          },
          "licences_count": {
            "description": "All the customer's licences, revoked ones included.",
            "title": "Licences Count",
            "type": "integer"
          },
          "licences_truncated": {
            "description": "True when the customer has more licences than are listed.",
            "title": "Licences Truncated",
            "type": "boolean"
          },
          "locale": {
            "description": "The language of the mails to the customer: fr or en.",
            "title": "Locale",
            "type": "string"
          },
          "name": {
            "description": "The customer's name; empty when unknown.",
            "title": "Name",
            "type": "string"
          },
          "orders": {
            "description": "The customer's latest 20 sales, newest first.",
            "items": {
              "$ref": "#/components/schemas/OrderOut"
            },
            "title": "Orders",
            "type": "array"
          },
          "orders_count": {
            "description": "All the customer's sales.",
            "title": "Orders Count",
            "type": "integer"
          }
        },
        "required": [
          "id",
          "email",
          "name",
          "country",
          "locale",
          "created_at",
          "licences_count",
          "licences",
          "licences_truncated",
          "orders",
          "orders_count",
          "emails",
          "emails_count"
        ],
        "title": "CustomerDetail",
        "type": "object"
      },
      "CustomerOut": {
        "properties": {
          "country": {
            "description": "The customer's country, two letters; empty when unknown.",
            "title": "Country",
            "type": "string"
          },
          "created_at": {
            "description": "When Keyseal first knew the customer.",
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "email": {
            "description": "The customer's address.",
            "title": "Email",
            "type": "string"
          },
          "id": {
            "description": "The customer's id.",
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "licences_count": {
            "description": "All the customer's licences, revoked ones included.",
            "title": "Licences Count",
            "type": "integer"
          },
          "locale": {
            "description": "The language of the mails to the customer: fr or en.",
            "title": "Locale",
            "type": "string"
          },
          "name": {
            "description": "The customer's name; empty when unknown.",
            "title": "Name",
            "type": "string"
          }
        },
        "required": [
          "id",
          "email",
          "name",
          "country",
          "locale",
          "created_at",
          "licences_count"
        ],
        "title": "CustomerOut",
        "type": "object"
      },
      "CustomerRef": {
        "properties": {
          "email": {
            "description": "The customer's address.",
            "title": "Email",
            "type": "string"
          },
          "id": {
            "description": "The customer's id.",
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "name": {
            "description": "The customer's name; empty when unknown.",
            "title": "Name",
            "type": "string"
          }
        },
        "required": [
          "id",
          "email",
          "name"
        ],
        "title": "CustomerRef",
        "type": "object"
      },
      "CustomersResponse": {
        "properties": {
          "customers": {
            "description": "The customers of the page, newest first.",
            "items": {
              "$ref": "#/components/schemas/CustomerOut"
            },
            "title": "Customers",
            "type": "array"
          },
          "next_cursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The cursor of the next page, to pass as cursor; null on the last page.",
            "title": "Next Cursor"
          }
        },
        "required": [
          "customers",
          "next_cursor"
        ],
        "title": "CustomersResponse",
        "type": "object"
      },
      "DiscountCodeDetail": {
        "properties": {
          "active": {
            "description": "What Keyseal last asked of Stripe or read there; status says if it works.",
            "title": "Active",
            "type": "boolean"
          },
          "code": {
            "description": "The code the buyer types: as secret as what it gives (100 % is a licence).",
            "title": "Code",
            "type": "string"
          },
          "created_at": {
            "description": "When it was made.",
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "discount": {
            "$ref": "#/components/schemas/DiscountOut",
            "description": "The discount the code belongs to."
          },
          "discount_id": {
            "description": "Its discount, dsc_…",
            "title": "Discount Id",
            "type": "string"
          },
          "expires_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When it stops; null: never.",
            "title": "Expires At"
          },
          "id": {
            "description": "The code's id, dco_…",
            "title": "Id",
            "type": "string"
          },
          "max_redemptions": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Its number of uses; null: no limit.",
            "title": "Max Redemptions"
          },
          "next_cursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The cursor of the next page of uses; null on the last page.",
            "title": "Next Cursor"
          },
          "note": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Who it is for; null when none, or when a customer who used it has their processing restricted.",
            "title": "Note"
          },
          "redemptions": {
            "description": "The uses of the page, newest first.",
            "items": {
              "$ref": "#/components/schemas/DiscountRedemptionOut"
            },
            "title": "Redemptions",
            "type": "array"
          },
          "status": {
            "description": "active, inactive, expired, used_up, pending (its creation at Stripe is not confirmed yet: activating it makes it; a reading only looks for it) or unavailable (Stripe disconnected or changed, or the account no longer has it).",
            "enum": [
              "active",
              "inactive",
              "expired",
              "used_up",
              "pending",
              "unavailable"
            ],
            "title": "Status",
            "type": "string"
          },
          "stripe_checked": {
            "description": "True when the code was just read at Stripe (or looked for there); false: the state Keyseal keeps.",
            "title": "Stripe Checked",
            "type": "boolean"
          },
          "stripe_error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Why Stripe could not be asked: stripe_unavailable, stripe_not_connected or stripe_permissions_missing; null when it was, or when there is nothing to check (an unavailable code whose creation was confirmed).",
            "title": "Stripe Error"
          },
          "stripe_missing": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "With stripe_permissions_missing: the rights to add; null otherwise.",
            "title": "Stripe Missing"
          },
          "uses": {
            "description": "The uses Keyseal was told of.",
            "title": "Uses",
            "type": "integer"
          }
        },
        "required": [
          "id",
          "discount_id",
          "code",
          "note",
          "max_redemptions",
          "expires_at",
          "active",
          "status",
          "uses",
          "created_at",
          "discount",
          "stripe_checked",
          "stripe_error",
          "stripe_missing",
          "redemptions",
          "next_cursor"
        ],
        "title": "DiscountCodeDetail",
        "type": "object"
      },
      "DiscountCodeOut": {
        "properties": {
          "active": {
            "description": "What Keyseal last asked of Stripe or read there; status says if it works.",
            "title": "Active",
            "type": "boolean"
          },
          "code": {
            "description": "The code the buyer types: as secret as what it gives (100 % is a licence).",
            "title": "Code",
            "type": "string"
          },
          "created_at": {
            "description": "When it was made.",
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "discount_id": {
            "description": "Its discount, dsc_…",
            "title": "Discount Id",
            "type": "string"
          },
          "expires_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When it stops; null: never.",
            "title": "Expires At"
          },
          "id": {
            "description": "The code's id, dco_…",
            "title": "Id",
            "type": "string"
          },
          "max_redemptions": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Its number of uses; null: no limit.",
            "title": "Max Redemptions"
          },
          "note": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Who it is for; null when none, or when a customer who used it has their processing restricted.",
            "title": "Note"
          },
          "status": {
            "description": "active, inactive, expired, used_up, pending (its creation at Stripe is not confirmed yet: activating it makes it; a reading only looks for it) or unavailable (Stripe disconnected or changed, or the account no longer has it).",
            "enum": [
              "active",
              "inactive",
              "expired",
              "used_up",
              "pending",
              "unavailable"
            ],
            "title": "Status",
            "type": "string"
          },
          "uses": {
            "description": "The uses Keyseal was told of.",
            "title": "Uses",
            "type": "integer"
          }
        },
        "required": [
          "id",
          "discount_id",
          "code",
          "note",
          "max_redemptions",
          "expires_at",
          "active",
          "status",
          "uses",
          "created_at"
        ],
        "title": "DiscountCodeOut",
        "type": "object"
      },
      "DiscountCodeUpdate": {
        "additionalProperties": false,
        "properties": {
          "active": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "description": "True to activate the code, false to deactivate it.",
            "title": "Active"
          },
          "note": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The new note, 200 characters at most; null (or empty) removes it. Left out, the note stays.",
            "title": "Note"
          }
        },
        "title": "DiscountCodeUpdate",
        "type": "object"
      },
      "DiscountCodesCreate": {
        "additionalProperties": false,
        "properties": {
          "active": {
            "default": true,
            "description": "False: made inactive, to be activated later. True by default.",
            "title": "Active",
            "type": "boolean"
          },
          "code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "A chosen code: 3 to 40 letters, digits and hyphens, kept in upper case. Either code, or series_prefix and count.",
            "title": "Code"
          },
          "count": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "With series_prefix: how many codes, 1 to 50.",
            "title": "Count"
          },
          "expires_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the codes stop, a date with a time zone, in the future.",
            "title": "Expires At"
          },
          "max_redemptions": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "How many times a chosen code may be used; unlimited when left out. A series is single use.",
            "title": "Max Redemptions"
          },
          "note": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "A free note, 200 characters at most: who the code is for (a first name or a reference, no more).",
            "title": "Note"
          },
          "series_prefix": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The prefix of a series: PREFIX-XXXXXXXX, each code used once.",
            "title": "Series Prefix"
          }
        },
        "title": "DiscountCodesCreate",
        "type": "object"
      },
      "DiscountCodesCreated": {
        "properties": {
          "created": {
            "description": "The codes Stripe confirmed, in the order they were made.",
            "items": {
              "$ref": "#/components/schemas/DiscountCodeOut"
            },
            "title": "Created",
            "type": "array"
          },
          "failed": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Null when every code asked for was made; else the error code of what stopped the rest (stripe_unavailable, stripe_permissions_missing, discount_code_taken…). With stripe_unavailable, one code may be kept pending among the discount's codes.",
            "title": "Failed"
          },
          "missing": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "With failed stripe_permissions_missing: the rights to add to the restricted key; null otherwise.",
            "title": "Missing"
          }
        },
        "required": [
          "created",
          "failed",
          "missing"
        ],
        "title": "DiscountCodesCreated",
        "type": "object"
      },
      "DiscountCreate": {
        "additionalProperties": false,
        "properties": {
          "amount_off": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "The amount taken off, in minor units, with its currency.",
            "title": "Amount Off"
          },
          "currency": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Three letters; with amount_off only, and required with it.",
            "title": "Currency"
          },
          "duration": {
            "$ref": "#/components/schemas/DiscountDuration",
            "default": "once",
            "description": "For subscriptions: once (the first invoice), repeating (duration_months months) or forever. A one-time purchase ignores it. once by default."
          },
          "duration_months": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "The months, with duration repeating only.",
            "title": "Duration Months"
          },
          "name": {
            "description": "1 to 40 characters, shown to the buyer by Stripe.",
            "title": "Name",
            "type": "string"
          },
          "percent_off": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "The percentage taken off, 1 to 100. Exactly one of percent_off, amount_off.",
            "title": "Percent Off"
          },
          "product_ids": {
            "description": "The products the codes apply to: at least one, each already at Stripe.",
            "items": {
              "format": "uuid",
              "type": "string"
            },
            "title": "Product Ids",
            "type": "array"
          }
        },
        "required": [
          "name",
          "product_ids"
        ],
        "title": "DiscountCreate",
        "type": "object"
      },
      "DiscountDetail": {
        "properties": {
          "active_code_count": {
            "description": "How many of them a buyer can use now.",
            "title": "Active Code Count",
            "type": "integer"
          },
          "amount_off": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "The amount taken off, in minor units; null for a percentage.",
            "title": "Amount Off"
          },
          "code_count": {
            "description": "How many codes it has.",
            "title": "Code Count",
            "type": "integer"
          },
          "codes": {
            "description": "Its codes, oldest first.",
            "items": {
              "$ref": "#/components/schemas/DiscountCodeOut"
            },
            "title": "Codes",
            "type": "array"
          },
          "created_at": {
            "description": "When it was made.",
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "currency": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The currency of amount_off; null for a percentage.",
            "title": "Currency"
          },
          "duration": {
            "$ref": "#/components/schemas/DiscountDuration",
            "description": "For subscriptions: once, repeating or forever."
          },
          "duration_months": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "The months, with repeating; null otherwise.",
            "title": "Duration Months"
          },
          "expires_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The latest end of its codes; null when one of them has none, or without a code.",
            "title": "Expires At"
          },
          "first_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The text of its oldest code; null without a code.",
            "title": "First Code"
          },
          "id": {
            "description": "The discount's id, dsc_…",
            "title": "Id",
            "type": "string"
          },
          "name": {
            "description": "Its name, shown to the buyer by Stripe.",
            "title": "Name",
            "type": "string"
          },
          "percent_off": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "The percentage taken off; null for an amount.",
            "title": "Percent Off"
          },
          "product_ids": {
            "description": "The products the codes apply to.",
            "items": {
              "format": "uuid",
              "type": "string"
            },
            "title": "Product Ids",
            "type": "array"
          },
          "status": {
            "description": "ready; pending (its creation at Stripe is not confirmed: adding codes finishes it); unavailable (Stripe was disconnected or changed: it is history).",
            "enum": [
              "ready",
              "pending",
              "unavailable"
            ],
            "title": "Status",
            "type": "string"
          },
          "uses": {
            "description": "The uses of its codes Keyseal was told of.",
            "title": "Uses",
            "type": "integer"
          }
        },
        "required": [
          "id",
          "name",
          "percent_off",
          "amount_off",
          "currency",
          "duration",
          "duration_months",
          "product_ids",
          "status",
          "code_count",
          "active_code_count",
          "uses",
          "first_code",
          "expires_at",
          "created_at",
          "codes"
        ],
        "title": "DiscountDetail",
        "type": "object"
      },
      "DiscountDuration": {
        "description": "How long a discount holds for a subscription: its first invoice (`once`), those of its\nfirst `duration_months` months (`repeating`), or all of them (`forever`). A one-time\npurchase pays no heed to it.",
        "enum": [
          "once",
          "repeating",
          "forever"
        ],
        "title": "DiscountDuration",
        "type": "string"
      },
      "DiscountOut": {
        "properties": {
          "active_code_count": {
            "description": "How many of them a buyer can use now.",
            "title": "Active Code Count",
            "type": "integer"
          },
          "amount_off": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "The amount taken off, in minor units; null for a percentage.",
            "title": "Amount Off"
          },
          "code_count": {
            "description": "How many codes it has.",
            "title": "Code Count",
            "type": "integer"
          },
          "created_at": {
            "description": "When it was made.",
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "currency": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The currency of amount_off; null for a percentage.",
            "title": "Currency"
          },
          "duration": {
            "$ref": "#/components/schemas/DiscountDuration",
            "description": "For subscriptions: once, repeating or forever."
          },
          "duration_months": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "The months, with repeating; null otherwise.",
            "title": "Duration Months"
          },
          "expires_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The latest end of its codes; null when one of them has none, or without a code.",
            "title": "Expires At"
          },
          "first_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The text of its oldest code; null without a code.",
            "title": "First Code"
          },
          "id": {
            "description": "The discount's id, dsc_…",
            "title": "Id",
            "type": "string"
          },
          "name": {
            "description": "Its name, shown to the buyer by Stripe.",
            "title": "Name",
            "type": "string"
          },
          "percent_off": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "The percentage taken off; null for an amount.",
            "title": "Percent Off"
          },
          "product_ids": {
            "description": "The products the codes apply to.",
            "items": {
              "format": "uuid",
              "type": "string"
            },
            "title": "Product Ids",
            "type": "array"
          },
          "status": {
            "description": "ready; pending (its creation at Stripe is not confirmed: adding codes finishes it); unavailable (Stripe was disconnected or changed: it is history).",
            "enum": [
              "ready",
              "pending",
              "unavailable"
            ],
            "title": "Status",
            "type": "string"
          },
          "uses": {
            "description": "The uses of its codes Keyseal was told of.",
            "title": "Uses",
            "type": "integer"
          }
        },
        "required": [
          "id",
          "name",
          "percent_off",
          "amount_off",
          "currency",
          "duration",
          "duration_months",
          "product_ids",
          "status",
          "code_count",
          "active_code_count",
          "uses",
          "first_code",
          "expires_at",
          "created_at"
        ],
        "title": "DiscountOut",
        "type": "object"
      },
      "DiscountRedemptionOut": {
        "properties": {
          "amount_discount": {
            "description": "The amount taken off, in minor units.",
            "title": "Amount Discount",
            "type": "integer"
          },
          "currency": {
            "description": "The currency, three letters.",
            "title": "Currency",
            "type": "string"
          },
          "customer": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CustomerRef"
              },
              {
                "type": "null"
              }
            ],
            "description": "The buyer; null until Keyseal knows them, or while their processing is restricted."
          },
          "licence_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The licence that sale gave to, lic_…; null until Keyseal has it.",
            "title": "Licence Id"
          },
          "order_id": {
            "anyOf": [
              {
                "format": "uuid",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The sale that took the code (a subscription's first invoice); null until Keyseal has it.",
            "title": "Order Id"
          },
          "redeemed_at": {
            "description": "When Keyseal recorded the use.",
            "format": "date-time",
            "title": "Redeemed At",
            "type": "string"
          }
        },
        "required": [
          "redeemed_at",
          "amount_discount",
          "currency",
          "order_id",
          "licence_id",
          "customer"
        ],
        "title": "DiscountRedemptionOut",
        "type": "object"
      },
      "DiscountUpdate": {
        "additionalProperties": false,
        "properties": {
          "name": {
            "description": "The new name, 1 to 40 characters.",
            "title": "Name",
            "type": "string"
          }
        },
        "required": [
          "name"
        ],
        "title": "DiscountUpdate",
        "type": "object"
      },
      "DiscountsResponse": {
        "properties": {
          "discounts": {
            "description": "The discounts, newest first.",
            "items": {
              "$ref": "#/components/schemas/DiscountOut"
            },
            "title": "Discounts",
            "type": "array"
          }
        },
        "required": [
          "discounts"
        ],
        "title": "DiscountsResponse",
        "type": "object"
      },
      "EmailKind": {
        "description": "What a mail is. `licence_issued`: the licence and its key, after a purchase, a licence\nmade by hand, or each `licences.send_key`. `renewal_confirmed`: a renewal was paid, with the\nnew end of the updates. `renewal_link`: a renewal link (`licences.renewal_links.create` with\n`send`). `updates_ending`: 30 days before the end of the updates of an active\n`perpetual_with_updates` licence. `payment_failed`: a subscription's payment failed.\n`licence_revoked`, `licence_suspended`: the licence's new status, after a Stripe refund or\ndispute, or an action by hand with `notify`. `licence_reinstated`: the licence usable again,\nafter `licences.reinstate` with `notify`. `login_link`: a link to the customer area.\n`member_invitation`: an invitation to join the publisher's team. `publisher_message`: a free\nmessage from the publisher (`customers.messages.send`). `free_licence_confirm`: the link\nthat confirms an address before a free plan's licence is given (to no customer yet: the\naddress is in `data`). `billing_quota`: a usage notice to an organization owner or admin.\n`sale_alert`: a sale paid through the checkout page, told to each owner of the organization\n(no buyer data: the order is read when it is sent).",
        "enum": [
          "licence_issued",
          "renewal_confirmed",
          "renewal_link",
          "updates_ending",
          "payment_failed",
          "licence_revoked",
          "licence_suspended",
          "login_link",
          "member_invitation",
          "licence_reinstated",
          "publisher_message",
          "billing_quota",
          "free_licence_confirm",
          "sale_alert"
        ],
        "title": "EmailKind",
        "type": "string"
      },
      "EmailOut": {
        "properties": {
          "body_length": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "The length of a free message's text, in characters, never the text; null for the other mails.",
            "title": "Body Length"
          },
          "created_at": {
            "description": "When the mail was queued.",
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "customer_id": {
            "anyOf": [
              {
                "format": "uuid",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The customer the mail is for; null for a mail to no customer yet (free_licence_confirm: the confirmation of an address asking for a free plan).",
            "title": "Customer Id"
          },
          "id": {
            "description": "The mail's id.",
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "kind": {
            "$ref": "#/components/schemas/EmailKind",
            "description": "What the mail is: licence_issued, renewal_link, licence_revoked, publisher_message…"
          },
          "last_error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The code of the last failure; null for none.",
            "title": "Last Error"
          },
          "licence_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The licence the mail is about, lic_…; null for none.",
            "title": "Licence Id"
          },
          "recipient_ref": {
            "description": "A digest of the address the mail went to, 10 characters: never the address.",
            "title": "Recipient Ref",
            "type": "string"
          },
          "sent_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the mail was handed to the mail provider; null until then.",
            "title": "Sent At"
          },
          "status": {
            "$ref": "#/components/schemas/EmailStatus",
            "description": "Where the mail is: queued, sending, sent, delivered, bounced, complained, failed or expired."
          },
          "subject": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "A free message's subject (publisher_message); null for the other mails.",
            "title": "Subject"
          }
        },
        "required": [
          "id",
          "kind",
          "status",
          "licence_id",
          "customer_id",
          "recipient_ref",
          "created_at",
          "sent_at",
          "last_error"
        ],
        "title": "EmailOut",
        "type": "object"
      },
      "EmailStatus": {
        "description": "Where a mail is. `queued`: waiting to be sent. `sending`: taken by a worker, for 10\nminutes at most. `sent`: accepted by the mail provider. `delivered`, `bounced`, `complained`\n(marked as spam): as the mail provider reported. `failed`: given up (a final refusal, 9\nattempts without success, a mail that can no longer be written); `last_error` says why.\n`expired`: left in the queue more than 7 days past its due attempt, never sent.",
        "enum": [
          "queued",
          "sending",
          "sent",
          "delivered",
          "bounced",
          "complained",
          "failed",
          "expired"
        ],
        "title": "EmailStatus",
        "type": "string"
      },
      "EmailsResponse": {
        "properties": {
          "emails": {
            "description": "The mails of the page, newest first.",
            "items": {
              "$ref": "#/components/schemas/EmailOut"
            },
            "title": "Emails",
            "type": "array"
          },
          "next_cursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The cursor of the next page, to pass as cursor; null on the last page.",
            "title": "Next Cursor"
          }
        },
        "required": [
          "emails",
          "next_cursor"
        ],
        "title": "EmailsResponse",
        "type": "object"
      },
      "Environment": {
        "enum": [
          "test",
          "live"
        ],
        "title": "Environment",
        "type": "string"
      },
      "ErrorDetail": {
        "additionalProperties": true,
        "properties": {
          "code": {
            "description": "The error's code: each operation lists the codes it may answer, with their message; /llms-full.txt lists them all.",
            "title": "Code",
            "type": "string"
          },
          "fields": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "With invalid_request: the names of the offending fields.",
            "title": "Fields"
          },
          "message": {
            "description": "A short sentence in English saying what the code means; never a secret, an address or what was sent.",
            "title": "Message",
            "type": "string"
          }
        },
        "required": [
          "code",
          "message"
        ],
        "title": "ErrorDetail",
        "type": "object"
      },
      "ErrorResponse": {
        "properties": {
          "error": {
            "$ref": "#/components/schemas/ErrorDetail",
            "description": "The error: its code, its message, and the details its code adds."
          }
        },
        "required": [
          "error"
        ],
        "title": "ErrorResponse",
        "type": "object"
      },
      "EventOut": {
        "properties": {
          "actor": {
            "description": "Who did it: user:<id>, api_key:<id>, stripe:<event>, import:imp_…, customer:<id>, client, ls-compat or cli.",
            "title": "Actor",
            "type": "string"
          },
          "created_at": {
            "description": "When it happened; the events of one transaction share it.",
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "data": {
            "additionalProperties": true,
            "description": "The details, only the keys listed for its kind (the list is in /llms-full.txt): never a licence key, a token or an address. An unknown kind shows {}.",
            "title": "Data",
            "type": "object"
          },
          "id": {
            "description": "The event's id.",
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "kind": {
            "description": "What happened: issued, activated, reactivated, deactivated, activation_released, status_changed, imported, subscription_linked, renewed, dispute_opened…",
            "title": "Kind",
            "type": "string"
          },
          "licence_id": {
            "description": "The licence, lic_…",
            "title": "Licence Id",
            "type": "string"
          }
        },
        "required": [
          "id",
          "created_at",
          "licence_id",
          "kind",
          "actor",
          "data"
        ],
        "title": "EventOut",
        "type": "object"
      },
      "EventsResponse": {
        "properties": {
          "events": {
            "description": "The events of the page, newest first.",
            "items": {
              "$ref": "#/components/schemas/EventOut"
            },
            "title": "Events",
            "type": "array"
          },
          "next_cursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The cursor of the next page, to pass as cursor; null on the last page.",
            "title": "Next Cursor"
          }
        },
        "required": [
          "events",
          "next_cursor"
        ],
        "title": "EventsResponse",
        "type": "object"
      },
      "FileCreate": {
        "additionalProperties": false,
        "properties": {
          "content_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The file's media type; application/octet-stream by default.",
            "title": "Content Type"
          },
          "filename": {
            "description": "The file's name, 200 characters at most, without slash, backslash, double quote or control character.",
            "title": "Filename",
            "type": "string"
          },
          "platform": {
            "description": "The platform: macos-universal, macos-arm64, macos-x64, windows-x64, windows-arm64, linux-x64, linux-arm64 or any. One file per platform and release.",
            "title": "Platform",
            "type": "string"
          },
          "sha256": {
            "description": "The SHA-256 of the file, 64 hexadecimal digits: shown to buyers to check their download.",
            "title": "Sha256",
            "type": "string"
          },
          "size": {
            "description": "The size in bytes, at most the server's limit (2 GiB by default).",
            "title": "Size",
            "type": "integer"
          }
        },
        "required": [
          "platform",
          "filename",
          "size",
          "sha256"
        ],
        "title": "FileCreate",
        "type": "object"
      },
      "FileOut": {
        "properties": {
          "content_type": {
            "description": "The file's media type.",
            "title": "Content Type",
            "type": "string"
          },
          "created_at": {
            "description": "When the file was declared.",
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "filename": {
            "description": "The file's name.",
            "title": "Filename",
            "type": "string"
          },
          "id": {
            "description": "The file's id, fil_…",
            "title": "Id",
            "type": "string"
          },
          "platform": {
            "$ref": "#/components/schemas/Platform",
            "description": "The platform: macos-universal, macos-arm64, macos-x64, windows-x64, windows-arm64, linux-x64, linux-arm64 or any."
          },
          "ready_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the file became ready; null while pending.",
            "title": "Ready At"
          },
          "release_id": {
            "description": "The file's release, rel_…",
            "title": "Release Id",
            "type": "string"
          },
          "sha256": {
            "description": "The SHA-256 of the file, shown to buyers to check their download.",
            "title": "Sha256",
            "type": "string"
          },
          "size": {
            "description": "The size in bytes.",
            "title": "Size",
            "type": "integer"
          },
          "status": {
            "$ref": "#/components/schemas/FileStatus",
            "description": "pending until its upload is complete, then ready (served once its release is published)."
          }
        },
        "required": [
          "id",
          "release_id",
          "platform",
          "filename",
          "size",
          "sha256",
          "content_type",
          "status",
          "created_at",
          "ready_at"
        ],
        "title": "FileOut",
        "type": "object"
      },
      "FileStatus": {
        "enum": [
          "pending",
          "ready"
        ],
        "title": "FileStatus",
        "type": "string"
      },
      "GrantKind": {
        "description": "What a sale gave to a licence. `licence_created`: a new licence (a purchase).\n`updates_extended`: its updates extended (a renewal). `period`: a paid period of its\nsubscription (an invoice).",
        "enum": [
          "licence_created",
          "updates_extended",
          "period"
        ],
        "title": "GrantKind",
        "type": "string"
      },
      "GrantOut": {
        "properties": {
          "id": {
            "description": "The grant's id.",
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "kind": {
            "$ref": "#/components/schemas/GrantKind",
            "description": "What the sale gave: licence_created, updates_extended or period."
          },
          "licence_id": {
            "description": "The licence it gave to, lic_…",
            "title": "Licence Id",
            "type": "string"
          },
          "months": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "The months of updates given; null for none.",
            "title": "Months"
          },
          "paid_at": {
            "description": "When the sale was paid.",
            "format": "date-time",
            "title": "Paid At",
            "type": "string"
          },
          "period_end": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The end of the paid period given; null for none.",
            "title": "Period End"
          },
          "period_start": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The start of the paid period given; null for none.",
            "title": "Period Start"
          },
          "undone_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When a refund or a lost dispute took the grant back; null while it stands.",
            "title": "Undone At"
          },
          "undone_reason": {
            "description": "Why it was taken back: refund or dispute_lost; empty while it stands.",
            "title": "Undone Reason",
            "type": "string"
          },
          "updates_until_after": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The licence's updates_until after the grant.",
            "title": "Updates Until After"
          },
          "updates_until_before": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The licence's updates_until before the grant.",
            "title": "Updates Until Before"
          }
        },
        "required": [
          "id",
          "kind",
          "licence_id",
          "months",
          "updates_until_before",
          "updates_until_after",
          "period_start",
          "period_end",
          "paid_at",
          "undone_at",
          "undone_reason"
        ],
        "title": "GrantOut",
        "type": "object"
      },
      "ImportDetail": {
        "properties": {
          "ended_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When its last run ended; null while queued or running.",
            "title": "Ended At"
          },
          "id": {
            "description": "The import's id, imp_…",
            "title": "Id",
            "type": "string"
          },
          "key_hint": {
            "description": "The last 4 characters of the Lemon Squeezy key: never more.",
            "title": "Key Hint",
            "type": "string"
          },
          "last_error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "After a failure, a short code: ls_key_invalid, ls_store_not_found, ls_network, ls_server, ls_rate_limited, ls_http_<status>, ls_bad_response, ls_too_many_pages, import_error, vault_error, no_key, lease_expired; null otherwise.",
            "title": "Last Error"
          },
          "report": {
            "additionalProperties": true,
            "description": "The report: counts per type, the objects skipped with their reason, the actions left to the publisher; once finished, unlinked_subscriptions and, if a run was under way, interrupted.",
            "title": "Report",
            "type": "object"
          },
          "requested_at": {
            "description": "When the import was asked for.",
            "format": "date-time",
            "title": "Requested At",
            "type": "string"
          },
          "started_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When its current or last run started; null while queued.",
            "title": "Started At"
          },
          "status": {
            "$ref": "#/components/schemas/LsImportStatus",
            "description": "queued, running, done, failed or finished."
          },
          "store_id": {
            "description": "The Lemon Squeezy store's id.",
            "title": "Store Id",
            "type": "string"
          }
        },
        "required": [
          "id",
          "store_id",
          "status",
          "key_hint",
          "requested_at",
          "started_at",
          "ended_at",
          "last_error",
          "report"
        ],
        "title": "ImportDetail",
        "type": "object"
      },
      "ImportOut": {
        "properties": {
          "ended_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When its last run ended; null while queued or running.",
            "title": "Ended At"
          },
          "id": {
            "description": "The import's id, imp_…",
            "title": "Id",
            "type": "string"
          },
          "key_hint": {
            "description": "The last 4 characters of the Lemon Squeezy key: never more.",
            "title": "Key Hint",
            "type": "string"
          },
          "last_error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "After a failure, a short code: ls_key_invalid, ls_store_not_found, ls_network, ls_server, ls_rate_limited, ls_http_<status>, ls_bad_response, ls_too_many_pages, import_error, vault_error, no_key, lease_expired; null otherwise.",
            "title": "Last Error"
          },
          "requested_at": {
            "description": "When the import was asked for.",
            "format": "date-time",
            "title": "Requested At",
            "type": "string"
          },
          "started_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When its current or last run started; null while queued.",
            "title": "Started At"
          },
          "status": {
            "$ref": "#/components/schemas/LsImportStatus",
            "description": "queued, running, done, failed or finished."
          },
          "store_id": {
            "description": "The Lemon Squeezy store's id.",
            "title": "Store Id",
            "type": "string"
          }
        },
        "required": [
          "id",
          "store_id",
          "status",
          "key_hint",
          "requested_at",
          "started_at",
          "ended_at",
          "last_error"
        ],
        "title": "ImportOut",
        "type": "object"
      },
      "ImportStart": {
        "additionalProperties": false,
        "properties": {
          "api_key": {
            "description": "The Lemon Squeezy API key that sees the store: checked at Lemon Squeezy, sealed for the time of the import, never returned, erased when the import is finished.",
            "maxLength": 8192,
            "minLength": 1,
            "title": "Api Key",
            "type": "string"
          },
          "store_id": {
            "description": "The Lemon Squeezy store's id, a number or a string (7 or \"7\").",
            "title": "Store Id"
          }
        },
        "required": [
          "api_key",
          "store_id"
        ],
        "title": "ImportStart",
        "type": "object"
      },
      "ImportsResponse": {
        "properties": {
          "imports": {
            "description": "The imports of the environment, the most recent first, without their report.",
            "items": {
              "$ref": "#/components/schemas/ImportOut"
            },
            "title": "Imports",
            "type": "array"
          }
        },
        "required": [
          "imports"
        ],
        "title": "ImportsResponse",
        "type": "object"
      },
      "InvitationAccept": {
        "additionalProperties": false,
        "properties": {
          "token": {
            "description": "The token of the invitation's link (after # in /app/invitations#<token>): never echoed.",
            "maxLength": 128,
            "minLength": 1,
            "pattern": "^[^\\x00-\\x1f\\x7f]*$",
            "title": "Token",
            "type": "string"
          }
        },
        "required": [
          "token"
        ],
        "title": "InvitationAccept",
        "type": "object"
      },
      "InvitationAccepted": {
        "properties": {
          "organization": {
            "$ref": "#/components/schemas/InvitedOrganization",
            "description": "The organization joined."
          },
          "role": {
            "$ref": "#/components/schemas/Role",
            "description": "The person's role in it."
          }
        },
        "required": [
          "organization",
          "role"
        ],
        "title": "InvitationAccepted",
        "type": "object"
      },
      "InvitationCreate": {
        "additionalProperties": false,
        "properties": {
          "email": {
            "description": "The address invited: a plain address, put in lower case. The person signs in with the primary address currently verified by Clerk, which must match this one.",
            "maxLength": 320,
            "minLength": 1,
            "pattern": "^[^\\x00-\\x1f\\x7f]*$",
            "title": "Email",
            "type": "string"
          },
          "locale": {
            "default": "fr",
            "description": "The language of the mail: fr (the default) or en.",
            "enum": [
              "fr",
              "en"
            ],
            "title": "Locale",
            "type": "string"
          },
          "role": {
            "description": "The role given on acceptance: member or admin (inviting an admin is for an owner in person).",
            "enum": [
              "member",
              "admin"
            ],
            "title": "Role",
            "type": "string"
          }
        },
        "required": [
          "email",
          "role"
        ],
        "title": "InvitationCreate",
        "type": "object"
      },
      "InvitationOut": {
        "properties": {
          "email": {
            "description": "The address invited.",
            "title": "Email",
            "type": "string"
          },
          "expires_at": {
            "description": "When the invitation's link stops working (7 days after it was made).",
            "format": "date-time",
            "title": "Expires At",
            "type": "string"
          },
          "id": {
            "description": "The invitation's id, inv_…",
            "title": "Id",
            "type": "string"
          },
          "mail_error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The code of the mail's failure; null for none.",
            "title": "Mail Error"
          },
          "mail_status": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/EmailStatus"
              },
              {
                "type": "null"
              }
            ],
            "description": "How the invitation's mail went: queued, sending, sent, delivered, bounced, complained, failed or expired; null when Keyseal has no trace of it."
          },
          "role": {
            "$ref": "#/components/schemas/Role",
            "description": "The role given on acceptance."
          }
        },
        "required": [
          "id",
          "email",
          "role",
          "expires_at",
          "mail_status",
          "mail_error"
        ],
        "title": "InvitationOut",
        "type": "object"
      },
      "InvitationsResponse": {
        "properties": {
          "invitations": {
            "description": "The open invitations, the most recent first.",
            "items": {
              "$ref": "#/components/schemas/InvitationOut"
            },
            "title": "Invitations",
            "type": "array"
          }
        },
        "required": [
          "invitations"
        ],
        "title": "InvitationsResponse",
        "type": "object"
      },
      "InvitedOrganization": {
        "properties": {
          "name": {
            "description": "The organization's name.",
            "title": "Name",
            "type": "string"
          },
          "slug": {
            "description": "The organization's slug: the value of the Keyseal-Organization header.",
            "title": "Slug",
            "type": "string"
          }
        },
        "required": [
          "slug",
          "name"
        ],
        "title": "InvitedOrganization",
        "type": "object"
      },
      "KeySent": {
        "properties": {
          "email_id": {
            "description": "The id of the mail queued; emails.list shows how it went.",
            "format": "uuid",
            "title": "Email Id",
            "type": "string"
          }
        },
        "required": [
          "email_id"
        ],
        "title": "KeySent",
        "type": "object"
      },
      "LicenceChanged": {
        "description": "The licence after a revoke, a suspend or a reinstate. ``changed`` is false when it was\nalready in the target state: nothing was written, no mail was queued.",
        "properties": {
          "activations": {
            "description": "The licence's active machines.",
            "items": {
              "$ref": "#/components/schemas/ActivationOut"
            },
            "title": "Activations",
            "type": "array"
          },
          "changed": {
            "description": "False when the licence was already in the state asked for: nothing was written, no mail was queued.",
            "title": "Changed",
            "type": "boolean"
          },
          "created_at": {
            "description": "When the licence was made.",
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "customer": {
            "$ref": "#/components/schemas/CustomerRef",
            "description": "The licence's holder."
          },
          "id": {
            "description": "The licence's id, lic_…",
            "title": "Id",
            "type": "string"
          },
          "key_last4": {
            "description": "The last 4 characters of the licence key: never the key.",
            "title": "Key Last4",
            "type": "string"
          },
          "open_dispute": {
            "description": "True while an order of the licence is under an open Stripe dispute: reinstating it is then refused.",
            "title": "Open Dispute",
            "type": "boolean"
          },
          "origin": {
            "$ref": "#/components/schemas/Origin",
            "description": "How this licence was issued."
          },
          "plan_id": {
            "description": "The plan the licence was sold or given by.",
            "format": "uuid",
            "title": "Plan Id",
            "type": "string"
          },
          "product_id": {
            "description": "The licence's product.",
            "format": "uuid",
            "title": "Product Id",
            "type": "string"
          },
          "seats": {
            "description": "The machines the licence may activate at once.",
            "title": "Seats",
            "type": "integer"
          },
          "state": {
            "$ref": "#/components/schemas/LicenceState",
            "description": "What the licence is at the time of the request: revoked, else suspended, else expired (status expired, or valid_until passed), else active."
          },
          "status": {
            "$ref": "#/components/schemas/LicenceStatus",
            "description": "The stored status: active, suspended, revoked or expired (Keyseal writes expired only for licences imported from Lemon Squeezy)."
          },
          "status_before_suspension": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The status the licence had before its last suspension (active, expired...); null when Keyseal never suspended it.",
            "title": "Status Before Suspension"
          },
          "subscription": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LicenceSubscription"
              },
              {
                "type": "null"
              }
            ],
            "description": "The Stripe subscription that pays for the licence; null when none does. Revoking or suspending the licence does not stop it."
          },
          "updates_until": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The last build date the licence covers (a version released after it is not covered); null: every version.",
            "title": "Updates Until"
          },
          "valid_until": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the licence ends (the end of a subscription's paid period, or of a fixed term); null: no end.",
            "title": "Valid Until"
          }
        },
        "required": [
          "id",
          "key_last4",
          "status",
          "state",
          "product_id",
          "plan_id",
          "customer",
          "seats",
          "updates_until",
          "valid_until",
          "created_at",
          "origin",
          "activations",
          "subscription",
          "open_dispute",
          "status_before_suspension",
          "changed"
        ],
        "title": "LicenceChanged",
        "type": "object"
      },
      "LicenceDetail": {
        "properties": {
          "activations": {
            "description": "The licence's active machines.",
            "items": {
              "$ref": "#/components/schemas/ActivationOut"
            },
            "title": "Activations",
            "type": "array"
          },
          "created_at": {
            "description": "When the licence was made.",
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "customer": {
            "$ref": "#/components/schemas/CustomerRef",
            "description": "The licence's holder."
          },
          "id": {
            "description": "The licence's id, lic_…",
            "title": "Id",
            "type": "string"
          },
          "key_last4": {
            "description": "The last 4 characters of the licence key: never the key.",
            "title": "Key Last4",
            "type": "string"
          },
          "open_dispute": {
            "description": "True while an order of the licence is under an open Stripe dispute: reinstating it is then refused.",
            "title": "Open Dispute",
            "type": "boolean"
          },
          "origin": {
            "$ref": "#/components/schemas/Origin",
            "description": "How this licence was issued."
          },
          "plan_id": {
            "description": "The plan the licence was sold or given by.",
            "format": "uuid",
            "title": "Plan Id",
            "type": "string"
          },
          "product_id": {
            "description": "The licence's product.",
            "format": "uuid",
            "title": "Product Id",
            "type": "string"
          },
          "seats": {
            "description": "The machines the licence may activate at once.",
            "title": "Seats",
            "type": "integer"
          },
          "state": {
            "$ref": "#/components/schemas/LicenceState",
            "description": "What the licence is at the time of the request: revoked, else suspended, else expired (status expired, or valid_until passed), else active."
          },
          "status": {
            "$ref": "#/components/schemas/LicenceStatus",
            "description": "The stored status: active, suspended, revoked or expired (Keyseal writes expired only for licences imported from Lemon Squeezy)."
          },
          "status_before_suspension": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The status the licence had before its last suspension (active, expired...); null when Keyseal never suspended it.",
            "title": "Status Before Suspension"
          },
          "subscription": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LicenceSubscription"
              },
              {
                "type": "null"
              }
            ],
            "description": "The Stripe subscription that pays for the licence; null when none does. Revoking or suspending the licence does not stop it."
          },
          "updates_until": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The last build date the licence covers (a version released after it is not covered); null: every version.",
            "title": "Updates Until"
          },
          "valid_until": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the licence ends (the end of a subscription's paid period, or of a fixed term); null: no end.",
            "title": "Valid Until"
          }
        },
        "required": [
          "id",
          "key_last4",
          "status",
          "state",
          "product_id",
          "plan_id",
          "customer",
          "seats",
          "updates_until",
          "valid_until",
          "created_at",
          "origin",
          "activations",
          "subscription",
          "open_dispute",
          "status_before_suspension"
        ],
        "title": "LicenceDetail",
        "type": "object"
      },
      "LicenceOut": {
        "properties": {
          "created_at": {
            "description": "When the licence was made.",
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "customer": {
            "$ref": "#/components/schemas/CustomerRef",
            "description": "The licence's holder."
          },
          "id": {
            "description": "The licence's id, lic_…",
            "title": "Id",
            "type": "string"
          },
          "key_last4": {
            "description": "The last 4 characters of the licence key: never the key.",
            "title": "Key Last4",
            "type": "string"
          },
          "plan_id": {
            "description": "The plan the licence was sold or given by.",
            "format": "uuid",
            "title": "Plan Id",
            "type": "string"
          },
          "product_id": {
            "description": "The licence's product.",
            "format": "uuid",
            "title": "Product Id",
            "type": "string"
          },
          "seats": {
            "description": "The machines the licence may activate at once.",
            "title": "Seats",
            "type": "integer"
          },
          "state": {
            "$ref": "#/components/schemas/LicenceState",
            "description": "What the licence is at the time of the request: revoked, else suspended, else expired (status expired, or valid_until passed), else active."
          },
          "status": {
            "$ref": "#/components/schemas/LicenceStatus",
            "description": "The stored status: active, suspended, revoked or expired (Keyseal writes expired only for licences imported from Lemon Squeezy)."
          },
          "updates_until": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The last build date the licence covers (a version released after it is not covered); null: every version.",
            "title": "Updates Until"
          },
          "valid_until": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the licence ends (the end of a subscription's paid period, or of a fixed term); null: no end.",
            "title": "Valid Until"
          }
        },
        "required": [
          "id",
          "key_last4",
          "status",
          "state",
          "product_id",
          "plan_id",
          "customer",
          "seats",
          "updates_until",
          "valid_until",
          "created_at"
        ],
        "title": "LicenceOut",
        "type": "object"
      },
      "LicenceState": {
        "description": "What a licence is at the time of the request, by the rule of the public API: revoked, else\nsuspended, else expired (its status, or its valid_until passed), else active.",
        "enum": [
          "active",
          "expired",
          "suspended",
          "revoked"
        ],
        "title": "LicenceState",
        "type": "string"
      },
      "LicenceStatus": {
        "enum": [
          "active",
          "suspended",
          "revoked",
          "expired"
        ],
        "title": "LicenceStatus",
        "type": "string"
      },
      "LicenceSubscription": {
        "description": "The Stripe subscription that pays for the licence, as Stripe last told Keyseal. Revoking\nor suspending the licence does not stop it: the publisher cancels it in Stripe.",
        "properties": {
          "cancel_at_period_end": {
            "description": "True when the subscription ends at the end of its current period.",
            "title": "Cancel At Period End",
            "type": "boolean"
          },
          "current_period_end": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The end of the current paid period; null if Stripe did not say.",
            "title": "Current Period End"
          },
          "status": {
            "description": "The subscription's status at Stripe: active, past_due, canceled…",
            "title": "Status",
            "type": "string"
          },
          "stripe_dashboard_url": {
            "description": "The subscription in the Stripe Dashboard of the environment (/test/ in test).",
            "title": "Stripe Dashboard Url",
            "type": "string"
          }
        },
        "required": [
          "status",
          "cancel_at_period_end",
          "current_period_end",
          "stripe_dashboard_url"
        ],
        "title": "LicenceSubscription",
        "type": "object"
      },
      "LicencesResponse": {
        "properties": {
          "licences": {
            "description": "The licences of the page, newest first.",
            "items": {
              "$ref": "#/components/schemas/LicenceOut"
            },
            "title": "Licences",
            "type": "array"
          },
          "next_cursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The cursor of the next page, to pass as cursor; null on the last page.",
            "title": "Next Cursor"
          }
        },
        "required": [
          "licences",
          "next_cursor"
        ],
        "title": "LicencesResponse",
        "type": "object"
      },
      "LsImportStatus": {
        "description": "Where an import from Lemon Squeezy is. `queued`: waiting for the worker. `running`: a run\nunder way. `done`: the run ended; it can be replayed, and its subscriptions matched.\n`failed`: the run stopped (`last_error` says why); it can be replayed. `finished`: ended for\ngood, its Lemon Squeezy key erased; never replayed.",
        "enum": [
          "queued",
          "running",
          "done",
          "failed",
          "finished"
        ],
        "title": "LsImportStatus",
        "type": "string"
      },
      "MatchConfirm": {
        "additionalProperties": false,
        "properties": {
          "match_ids": {
            "description": "The match_id of the pairs to link, 1 to 50, linked each on its own in this order.",
            "items": {
              "maxLength": 1024,
              "minLength": 1,
              "type": "string"
            },
            "maxItems": 50,
            "minItems": 1,
            "title": "Match Ids",
            "type": "array"
          }
        },
        "required": [
          "match_ids"
        ],
        "title": "MatchConfirm",
        "type": "object"
      },
      "MatchLicenceOut": {
        "properties": {
          "id": {
            "description": "The imported licence, lic_…",
            "title": "Id",
            "type": "string"
          },
          "plan_id": {
            "description": "The plan it was imported with from Lemon Squeezy.",
            "title": "Plan Id",
            "type": "string"
          },
          "product_id": {
            "description": "Its product.",
            "title": "Product Id",
            "type": "string"
          },
          "status": {
            "description": "Its status: active, expired or suspended.",
            "title": "Status",
            "type": "string"
          }
        },
        "required": [
          "id",
          "status",
          "product_id",
          "plan_id"
        ],
        "title": "MatchLicenceOut",
        "type": "object"
      },
      "MatchOut": {
        "properties": {
          "confirmable": {
            "description": "False when the pair cannot be linked (a price of no Keyseal plan).",
            "title": "Confirmable",
            "type": "boolean"
          },
          "licence": {
            "$ref": "#/components/schemas/MatchLicenceOut",
            "description": "The imported licence proposed."
          },
          "match_id": {
            "description": "The pair, signed by Keyseal: give it back to imports.matches.confirm. It carries no address.",
            "title": "Match Id",
            "type": "string"
          },
          "plan": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/MatchPlanOut"
              },
              {
                "type": "null"
              }
            ],
            "description": "The plan the subscription's price bills for; null when Keyseal has none."
          },
          "reason": {
            "description": "same_email_same_product; expired_at_ls (Lemon Squeezy ended the licence once its subscription left: linking makes it active again); price_without_plan.",
            "title": "Reason",
            "type": "string"
          },
          "subscription": {
            "$ref": "#/components/schemas/MatchSubscriptionOut",
            "description": "The Stripe subscription proposed."
          }
        },
        "required": [
          "match_id",
          "confirmable",
          "reason",
          "subscription",
          "licence",
          "plan"
        ],
        "title": "MatchOut",
        "type": "object"
      },
      "MatchPlanOut": {
        "properties": {
          "id": {
            "description": "The Keyseal plan the subscription's price bills for.",
            "title": "Id",
            "type": "string"
          },
          "slug": {
            "description": "That plan's slug.",
            "title": "Slug",
            "type": "string"
          }
        },
        "required": [
          "id",
          "slug"
        ],
        "title": "MatchPlanOut",
        "type": "object"
      },
      "MatchSubscriptionOut": {
        "properties": {
          "current_period_end": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The end of its current period; null if Stripe gave none.",
            "title": "Current Period End"
          },
          "customer": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Its Stripe customer, cus_…; null if Stripe gave none.",
            "title": "Customer"
          },
          "id": {
            "description": "The Stripe subscription, sub_…",
            "title": "Id",
            "type": "string"
          },
          "price": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The Stripe price of its one item, price_…; null if Stripe gave none.",
            "title": "Price"
          },
          "status": {
            "description": "Its status at Stripe.",
            "title": "Status",
            "type": "string"
          }
        },
        "required": [
          "id",
          "customer",
          "price",
          "status",
          "current_period_end"
        ],
        "title": "MatchSubscriptionOut",
        "type": "object"
      },
      "MatchesResponse": {
        "properties": {
          "matches": {
            "description": "The pairs proposed: nothing is linked until confirmed.",
            "items": {
              "$ref": "#/components/schemas/MatchOut"
            },
            "title": "Matches",
            "type": "array"
          },
          "truncated": {
            "description": "True when Stripe has more than 10,000 active subscriptions: the rest is not read, nor proposed.",
            "title": "Truncated",
            "type": "boolean"
          }
        },
        "required": [
          "matches",
          "truncated"
        ],
        "title": "MatchesResponse",
        "type": "object"
      },
      "MeResponse": {
        "properties": {
          "is_platform_operator": {
            "description": "Whether this person's Clerk identity is listed as a platform operator.",
            "title": "Is Platform Operator",
            "type": "boolean"
          },
          "organizations": {
            "description": "Every organization the person is a member of, with their role.",
            "items": {
              "$ref": "#/components/schemas/MembershipOut"
            },
            "title": "Organizations",
            "type": "array"
          },
          "user": {
            "$ref": "#/components/schemas/UserOut",
            "description": "The signed-in person."
          }
        },
        "required": [
          "user",
          "is_platform_operator",
          "organizations"
        ],
        "title": "MeResponse",
        "type": "object"
      },
      "MemberOut": {
        "properties": {
          "email": {
            "description": "The member's address.",
            "title": "Email",
            "type": "string"
          },
          "name": {
            "description": "The member's name.",
            "title": "Name",
            "type": "string"
          },
          "role": {
            "$ref": "#/components/schemas/Role",
            "description": "The member's role: member, admin or owner, the same in both environments."
          },
          "user_id": {
            "description": "The member's user id.",
            "format": "uuid",
            "title": "User Id",
            "type": "string"
          }
        },
        "required": [
          "user_id",
          "email",
          "name",
          "role"
        ],
        "title": "MemberOut",
        "type": "object"
      },
      "MemberUpdate": {
        "properties": {
          "role": {
            "$ref": "#/components/schemas/Role",
            "description": "The new role: member, admin or owner."
          }
        },
        "required": [
          "role"
        ],
        "title": "MemberUpdate",
        "type": "object"
      },
      "MembersResponse": {
        "properties": {
          "members": {
            "description": "The members of the organization, sorted by address.",
            "items": {
              "$ref": "#/components/schemas/MemberOut"
            },
            "title": "Members",
            "type": "array"
          }
        },
        "required": [
          "members"
        ],
        "title": "MembersResponse",
        "type": "object"
      },
      "MembershipOut": {
        "properties": {
          "id": {
            "description": "The organization's id.",
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "name": {
            "description": "The organization's name.",
            "title": "Name",
            "type": "string"
          },
          "role": {
            "$ref": "#/components/schemas/Role",
            "description": "The person's role in the organization, the same in both environments."
          },
          "slug": {
            "description": "The organization's slug: the value of the Keyseal-Organization header.",
            "title": "Slug",
            "type": "string"
          }
        },
        "required": [
          "id",
          "slug",
          "name",
          "role"
        ],
        "title": "MembershipOut",
        "type": "object"
      },
      "MessageIn": {
        "additionalProperties": false,
        "description": "The publisher's message: a subject on one line and a text, both plain (HTML is shown as\ntyped). ``locale`` is the language of Keyseal's own words around it; the customer's by\ndefault.",
        "properties": {
          "body": {
            "description": "The text, 1 to 5000 characters of plain text: a blank line separates paragraphs, HTML is shown as typed.",
            "maxLength": 5000,
            "minLength": 1,
            "title": "Body",
            "type": "string"
          },
          "locale": {
            "anyOf": [
              {
                "enum": [
                  "fr",
                  "en"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "fr or en: the language of Keyseal's words around the text; the customer's by default.",
            "title": "Locale"
          },
          "subject": {
            "description": "The subject, 1 to 150 characters on one line (line breaks become spaces); bidirectional and zero-width characters are refused.",
            "maxLength": 150,
            "minLength": 1,
            "title": "Subject",
            "type": "string"
          }
        },
        "required": [
          "subject",
          "body"
        ],
        "title": "MessageIn",
        "type": "object"
      },
      "MessageQueued": {
        "properties": {
          "email_id": {
            "description": "The id of the mail queued; emails.list shows how it went.",
            "format": "uuid",
            "title": "Email Id",
            "type": "string"
          }
        },
        "required": [
          "email_id"
        ],
        "title": "MessageQueued",
        "type": "object"
      },
      "MonthlyAmount": {
        "properties": {
          "amount": {
            "description": "Known tax-exclusive monthly amount, rounded once per currency.",
            "title": "Amount",
            "type": "integer"
          },
          "currency": {
            "description": "Lowercase ISO currency code.",
            "title": "Currency",
            "type": "string"
          }
        },
        "required": [
          "currency",
          "amount"
        ],
        "title": "MonthlyAmount",
        "type": "object"
      },
      "NamedRef": {
        "properties": {
          "id": {
            "description": "Its id.",
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "name": {
            "description": "Its name.",
            "title": "Name",
            "type": "string"
          }
        },
        "required": [
          "id",
          "name"
        ],
        "title": "NamedRef",
        "type": "object"
      },
      "OfflinePolicy": {
        "enum": [
          "open",
          "closed"
        ],
        "title": "OfflinePolicy",
        "type": "string"
      },
      "OrderDetail": {
        "properties": {
          "amount_total": {
            "description": "The amount paid, in minor units, as Stripe sent it.",
            "title": "Amount Total",
            "type": "integer"
          },
          "created_at": {
            "description": "When Keyseal recorded the sale: what since and until bound, and the order of the list.",
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "currency": {
            "description": "The currency, three letters.",
            "title": "Currency",
            "type": "string"
          },
          "customer": {
            "$ref": "#/components/schemas/CustomerRef",
            "description": "The buyer."
          },
          "discount": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/OrderDiscount"
              },
              {
                "type": "null"
              }
            ],
            "description": "The discount code made in Keyseal that this purchase used; null for none, for a code made in Stripe, and for the later invoices of a discounted subscription."
          },
          "grants": {
            "description": "What the sale gave.",
            "items": {
              "$ref": "#/components/schemas/GrantOut"
            },
            "title": "Grants",
            "type": "array"
          },
          "id": {
            "description": "The sale's id.",
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "kind": {
            "$ref": "#/components/schemas/OrderKind",
            "description": "checkout (paid through a Stripe Checkout session) or invoice (a subscription invoice)."
          },
          "licence_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The licence the sale gave to, lic_…; null for none.",
            "title": "Licence Id"
          },
          "plan": {
            "$ref": "#/components/schemas/NamedRef",
            "description": "The plan sold."
          },
          "product": {
            "$ref": "#/components/schemas/NamedRef",
            "description": "The product sold."
          },
          "refundable_amount": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "What orders.refund may still refund, in minor units: the amount paid for a paid sale; for a partially_refunded one, the amount paid less what Stripe reported refunded (the amount paid when Keyseal recorded no amount, an upper bound Stripe checks). null when the sale cannot be refunded: refunded, disputed, dispute_lost, 0, or no Stripe payment.",
            "title": "Refundable Amount"
          },
          "status": {
            "$ref": "#/components/schemas/OrderStatus",
            "description": "paid, partially_refunded, refunded, disputed or dispute_lost."
          },
          "stripe_dashboard_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The payment in the Stripe Dashboard of the environment (/test/ in test); the invoice for a subscription's sale; null for a sale known by its checkout session only.",
            "title": "Stripe Dashboard Url"
          },
          "subscription": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SubscriptionOut"
              },
              {
                "type": "null"
              }
            ],
            "description": "The sale's subscription; null for none."
          }
        },
        "required": [
          "id",
          "created_at",
          "status",
          "amount_total",
          "currency",
          "customer",
          "product",
          "plan",
          "licence_id",
          "kind",
          "discount",
          "grants",
          "subscription",
          "stripe_dashboard_url",
          "refundable_amount"
        ],
        "title": "OrderDetail",
        "type": "object"
      },
      "OrderDiscount": {
        "properties": {
          "amount": {
            "description": "The amount taken off, in minor units of the sale's currency.",
            "title": "Amount",
            "type": "integer"
          },
          "code_id": {
            "description": "The code's id, dco_…; the code's text is never here.",
            "title": "Code Id",
            "type": "string"
          },
          "id": {
            "description": "The discount's id, dsc_….",
            "title": "Id",
            "type": "string"
          },
          "name": {
            "description": "The discount's name.",
            "title": "Name",
            "type": "string"
          }
        },
        "required": [
          "id",
          "code_id",
          "name",
          "amount"
        ],
        "title": "OrderDiscount",
        "type": "object"
      },
      "OrderKind": {
        "enum": [
          "checkout",
          "invoice"
        ],
        "title": "OrderKind",
        "type": "string"
      },
      "OrderOut": {
        "properties": {
          "amount_total": {
            "description": "The amount paid, in minor units, as Stripe sent it.",
            "title": "Amount Total",
            "type": "integer"
          },
          "created_at": {
            "description": "When Keyseal recorded the sale: what since and until bound, and the order of the list.",
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "currency": {
            "description": "The currency, three letters.",
            "title": "Currency",
            "type": "string"
          },
          "customer": {
            "$ref": "#/components/schemas/CustomerRef",
            "description": "The buyer."
          },
          "id": {
            "description": "The sale's id.",
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "kind": {
            "$ref": "#/components/schemas/OrderKind",
            "description": "checkout (paid through a Stripe Checkout session) or invoice (a subscription invoice)."
          },
          "licence_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The licence the sale gave to, lic_…; null for none.",
            "title": "Licence Id"
          },
          "plan": {
            "$ref": "#/components/schemas/NamedRef",
            "description": "The plan sold."
          },
          "product": {
            "$ref": "#/components/schemas/NamedRef",
            "description": "The product sold."
          },
          "status": {
            "$ref": "#/components/schemas/OrderStatus",
            "description": "paid, partially_refunded, refunded, disputed or dispute_lost."
          }
        },
        "required": [
          "id",
          "created_at",
          "status",
          "amount_total",
          "currency",
          "customer",
          "product",
          "plan",
          "licence_id",
          "kind"
        ],
        "title": "OrderOut",
        "type": "object"
      },
      "OrderStatus": {
        "enum": [
          "paid",
          "partially_refunded",
          "refunded",
          "disputed",
          "dispute_lost"
        ],
        "title": "OrderStatus",
        "type": "string"
      },
      "OrdersResponse": {
        "properties": {
          "next_cursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The cursor of the next page, to pass as cursor; null on the last page.",
            "title": "Next Cursor"
          },
          "orders": {
            "description": "The sales of the page, newest first.",
            "items": {
              "$ref": "#/components/schemas/OrderOut"
            },
            "title": "Orders",
            "type": "array"
          }
        },
        "required": [
          "orders",
          "next_cursor"
        ],
        "title": "OrdersResponse",
        "type": "object"
      },
      "OrganizationCreate": {
        "properties": {
          "name": {
            "description": "The organization's name, 1 to 200 characters.",
            "maxLength": 200,
            "minLength": 1,
            "pattern": "^[^\\x00-\\x1f\\x7f]*$",
            "title": "Name",
            "type": "string"
          },
          "slug": {
            "description": "The organization's slug, 2 to 63 characters [a-z0-9-] starting with a letter or a digit; it names the organization in the Keyseal-Organization header. api, app, assets, invitations, me and organizations are reserved.",
            "maxLength": 63,
            "minLength": 1,
            "pattern": "^[^\\x00-\\x1f\\x7f]*$",
            "title": "Slug",
            "type": "string"
          }
        },
        "required": [
          "slug",
          "name"
        ],
        "title": "OrganizationCreate",
        "type": "object"
      },
      "OrganizationLogoIn": {
        "additionalProperties": false,
        "properties": {
          "content_base64": {
            "description": "Base64-encoded still PNG, JPEG or WebP, at most 512 KiB and 8 million pixels.",
            "maxLength": 699052,
            "minLength": 1,
            "title": "Content Base64",
            "type": "string"
          }
        },
        "required": [
          "content_base64"
        ],
        "title": "OrganizationLogoIn",
        "type": "object"
      },
      "OrganizationLogoOut": {
        "properties": {
          "logo_url": {
            "description": "The Keyseal URL of the organization's hosted logo, for both environments.",
            "title": "Logo Url",
            "type": "string"
          }
        },
        "required": [
          "logo_url"
        ],
        "title": "OrganizationLogoOut",
        "type": "object"
      },
      "OrganizationUpdate": {
        "additionalProperties": false,
        "properties": {
          "brand_color": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "A colour #RRGGBB, six hexadecimal digits; null clears it.",
            "title": "Brand Color"
          },
          "logo_url": {
            "anyOf": [
              {
                "format": "uri",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "HTTPS logo URL, up to 500 characters. Keyseal static images and the uploaded logo appear inline. Other hosts are offered through an external link. A new URL, or null, withdraws the uploaded logo; null clears it.",
            "title": "Logo Url"
          },
          "name": {
            "description": "The new name, 1 to 200 characters; never null.",
            "maxLength": 200,
            "minLength": 1,
            "pattern": "^[^\\x00-\\x1f\\x7f]*$",
            "title": "Name",
            "type": "string"
          },
          "sale_alerts": {
            "description": "true to mail each owner about each sale paid through the checkout page, false to stop; never null.",
            "title": "Sale Alerts",
            "type": "boolean"
          },
          "support_email": {
            "anyOf": [
              {
                "maxLength": 320,
                "pattern": "^[^\\x00-\\x1f\\x7f]*$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The Reply-To address of the mails to buyers: a plain address, without a display name; null clears it.",
            "title": "Support Email"
          }
        },
        "title": "OrganizationUpdate",
        "type": "object"
      },
      "Origin": {
        "enum": [
          "stripe",
          "manual",
          "imported",
          "free"
        ],
        "title": "Origin",
        "type": "string"
      },
      "PendingCheckout": {
        "properties": {
          "edition": {
            "$ref": "#/components/schemas/BillingEdition",
            "description": "Terms selected when checkout opened, including withdrawn editions."
          },
          "edition_id": {
            "description": "Edition selected for the pending checkout.",
            "format": "uuid",
            "title": "Edition Id",
            "type": "string"
          },
          "expires_at": {
            "description": "Scheduled checkout expiry, in UTC.",
            "format": "date-time",
            "title": "Expires At",
            "type": "string"
          }
        },
        "required": [
          "edition_id",
          "edition",
          "expires_at"
        ],
        "title": "PendingCheckout",
        "type": "object"
      },
      "PlanCreate": {
        "additionalProperties": false,
        "properties": {
          "features": {
            "description": "The features a licence of the plan unlocks: 50 at most, 200 characters each.",
            "items": {
              "maxLength": 200,
              "minLength": 1,
              "pattern": "^[^\\x00-\\x1f\\x7f]*$",
              "type": "string"
            },
            "maxItems": 50,
            "title": "Features",
            "type": "array"
          },
          "free": {
            "default": false,
            "description": "True: a free plan, whose buy link gives a licence against a confirmed e-mail address, without Stripe. Only perpetual or perpetual_with_updates, and without a price (422 free_plan_not_allowed).",
            "title": "Free",
            "type": "boolean"
          },
          "kind": {
            "$ref": "#/components/schemas/PlanKind",
            "description": "perpetual, perpetual_with_updates, renewal or subscription. It never changes."
          },
          "name": {
            "description": "The plan's name, 1 to 200 characters.",
            "maxLength": 200,
            "minLength": 1,
            "pattern": "^[^\\x00-\\x1f\\x7f]*$",
            "title": "Name",
            "type": "string"
          },
          "price": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PriceIn"
              },
              {
                "type": "null"
              }
            ],
            "description": "The price the plan is sold at; none: the plan is not sold (it serves the licences given by hand), unless it is free."
          },
          "product_id": {
            "description": "The product the plan sells.",
            "format": "uuid",
            "title": "Product Id",
            "type": "string"
          },
          "public": {
            "default": true,
            "description": "False: the plan is not sold through its buy link.",
            "title": "Public",
            "type": "boolean"
          },
          "seats": {
            "default": 3,
            "description": "The machines a licence of the plan may activate, 1 to 1,000,000 (3 by default).",
            "maximum": 1000000.0,
            "title": "Seats",
            "type": "integer"
          },
          "slug": {
            "description": "The plan's slug, [a-z0-9-], unique in the environment: the address of its buy link, /b/{org}/{slug}. It never changes.",
            "maxLength": 64,
            "minLength": 1,
            "pattern": "^[^\\x00-\\x1f\\x7f]*$",
            "title": "Slug",
            "type": "string"
          },
          "update_major": {
            "anyOf": [
              {
                "maximum": 999999999.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Major covered by a perpetual licence. A different major requires a new plan.",
            "title": "Update Major"
          },
          "update_months": {
            "anyOf": [
              {
                "maximum": 1200.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "The months of updates, 1 to 1200: required for perpetual_with_updates and renewal.",
            "title": "Update Months"
          },
          "usage_terms": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UsageTerms"
              },
              {
                "type": "null"
              }
            ],
            "description": "Bilingual contractual rights for software without device activation."
          }
        },
        "required": [
          "product_id",
          "slug",
          "name",
          "kind"
        ],
        "title": "PlanCreate",
        "type": "object"
      },
      "PlanKind": {
        "description": "How a plan sells its product. `perpetual`: a licence with no end, covering every\nversion. `perpetual_with_updates`: a licence with no end, covering the versions released\nduring `update_months` from the purchase; a `renewal` plan extends them. `renewal`: creates\nno licence; each payment, through a renewal link, extends by `update_months` the updates of a\n`perpetual_with_updates` licence of the same product, on the same key. `subscription`: billed\nevery `month` or `year` at Stripe; the licence holds until the end of the paid period, and\ncovers the versions released until then.",
        "enum": [
          "perpetual",
          "perpetual_with_updates",
          "renewal",
          "subscription"
        ],
        "title": "PlanKind",
        "type": "string"
      },
      "PlanLimits": {
        "additionalProperties": false,
        "description": "Null is an explicit, unmetered allowance. Usage observations continue in every profile.",
        "properties": {
          "active_licences": {
            "anyOf": [
              {
                "maximum": 9.223372036854776e+18,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Maximum active licences, or null for unlimited.",
            "title": "Active Licences"
          },
          "api_calls": {
            "anyOf": [
              {
                "maximum": 9.223372036854776e+18,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Maximum authenticated API calls per UTC calendar month, or null for unlimited.",
            "title": "Api Calls"
          },
          "members": {
            "anyOf": [
              {
                "maximum": 9.223372036854776e+18,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Maximum members across the organization, or null for unlimited.",
            "title": "Members"
          },
          "products": {
            "anyOf": [
              {
                "maximum": 9.223372036854776e+18,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Maximum products, or null for unlimited.",
            "title": "Products"
          },
          "storage_bytes": {
            "anyOf": [
              {
                "maximum": 9.223372036854776e+18,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Maximum stored and reserved bytes, or null for unlimited.",
            "title": "Storage Bytes"
          },
          "webhook_attempts": {
            "anyOf": [
              {
                "maximum": 9.223372036854776e+18,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Maximum outgoing attempts each UTC month. Null means unlimited.",
            "title": "Webhook Attempts"
          },
          "webhook_endpoints": {
            "anyOf": [
              {
                "maximum": 9.223372036854776e+18,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Maximum registered webhook endpoints, or null for unlimited.",
            "title": "Webhook Endpoints"
          },
          "webhook_retention_days": {
            "description": "Number of days of webhook delivery history retained.",
            "maximum": 9.223372036854776e+18,
            "minimum": 1.0,
            "title": "Webhook Retention Days",
            "type": "integer"
          }
        },
        "required": [
          "active_licences",
          "products",
          "members",
          "storage_bytes",
          "api_calls",
          "webhook_attempts",
          "webhook_endpoints",
          "webhook_retention_days"
        ],
        "title": "PlanLimits",
        "type": "object"
      },
      "PlanOut": {
        "properties": {
          "features": {
            "description": "The features a licence of the plan unlocks.",
            "items": {
              "type": "string"
            },
            "title": "Features",
            "type": "array"
          },
          "free": {
            "description": "True: a free plan, a licence against a confirmed e-mail address; never at Stripe.",
            "title": "Free",
            "type": "boolean"
          },
          "id": {
            "description": "The plan's id.",
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "kind": {
            "$ref": "#/components/schemas/PlanKind",
            "description": "perpetual, perpetual_with_updates, renewal or subscription."
          },
          "name": {
            "description": "The plan's name.",
            "title": "Name",
            "type": "string"
          },
          "price": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PriceOut"
              },
              {
                "type": "null"
              }
            ],
            "description": "The current price; null for a plan without one, which is not sold, or a free plan."
          },
          "product_id": {
            "description": "The product the plan sells.",
            "format": "uuid",
            "title": "Product Id",
            "type": "string"
          },
          "public": {
            "description": "False: the plan is not sold through its buy link.",
            "title": "Public",
            "type": "boolean"
          },
          "seats": {
            "description": "The machines a licence of the plan may activate.",
            "title": "Seats",
            "type": "integer"
          },
          "slug": {
            "description": "The plan's slug: the address of its buy link, /b/{org}/{slug}.",
            "title": "Slug",
            "type": "string"
          },
          "stripe": {
            "$ref": "#/components/schemas/StripeStatus",
            "description": "Whether the object is at Stripe as it is in Keyseal, and if not, why; a free plan, never sent to Stripe, is always synced."
          },
          "update_major": {
            "anyOf": [
              {
                "maximum": 999999999.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Major covered by a perpetual licence. A different major requires a new plan.",
            "title": "Update Major"
          },
          "update_months": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "The months of updates; null for a plan without.",
            "title": "Update Months"
          },
          "usage_terms": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UsageTerms"
              },
              {
                "type": "null"
              }
            ],
            "description": "Bilingual contractual rights for software without device activation."
          }
        },
        "required": [
          "id",
          "product_id",
          "slug",
          "name",
          "kind",
          "seats",
          "features",
          "update_months",
          "public",
          "free",
          "price",
          "stripe"
        ],
        "title": "PlanOut",
        "type": "object"
      },
      "PlanTotals": {
        "properties": {
          "coverage": {
            "$ref": "#/components/schemas/Coverage",
            "description": "Current reconciliation coverage of contributing orders."
          },
          "plan_id": {
            "description": "Plan of the original sale.",
            "format": "uuid",
            "title": "Plan Id",
            "type": "string"
          },
          "plan_name": {
            "description": "Current display name of the plan of the original sale.",
            "title": "Plan Name",
            "type": "string"
          },
          "sales": {
            "description": "Sale amounts by original buyer currency.",
            "items": {
              "$ref": "#/components/schemas/SalesAmounts"
            },
            "title": "Sales",
            "type": "array"
          },
          "sales_count": {
            "description": "Number of orders paid, including zero-amount sales.",
            "title": "Sales Count",
            "type": "integer"
          },
          "settlement": {
            "description": "Balance amounts by observed settlement currency. Unknown currencies are omitted. Partial amounts include only evidenced movements.",
            "items": {
              "$ref": "#/components/schemas/SettlementAmounts"
            },
            "title": "Settlement",
            "type": "array"
          },
          "subscription_renewals": {
            "description": "Subsequent paid subscription periods.",
            "title": "Subscription Renewals",
            "type": "integer"
          },
          "updates_extended": {
            "description": "Paid extensions of the update entitlement.",
            "title": "Updates Extended",
            "type": "integer"
          }
        },
        "required": [
          "sales_count",
          "sales",
          "settlement",
          "coverage",
          "updates_extended",
          "subscription_renewals",
          "plan_id",
          "plan_name"
        ],
        "title": "PlanTotals",
        "type": "object"
      },
      "PlanUpdate": {
        "additionalProperties": false,
        "properties": {
          "features": {
            "anyOf": [
              {
                "items": {
                  "maxLength": 200,
                  "minLength": 1,
                  "pattern": "^[^\\x00-\\x1f\\x7f]*$",
                  "type": "string"
                },
                "maxItems": 50,
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "The features, 50 at most, 200 characters each.",
            "title": "Features"
          },
          "free": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "description": "True: the plan becomes free (perpetual or perpetual_with_updates, and without a price: else 422 free_plan_not_allowed); false: it no longer is.",
            "title": "Free"
          },
          "name": {
            "anyOf": [
              {
                "maxLength": 200,
                "pattern": "^[^\\x00-\\x1f\\x7f]*$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The new name, 1 to 200 characters.",
            "title": "Name"
          },
          "price": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PriceIn"
              },
              {
                "type": "null"
              }
            ],
            "description": "A new price, which replaces the current one (at Stripe, a new Price; the old one deactivated). Never null: a price is replaced, never removed. Refused for a free plan (422 plan_is_free)."
          },
          "public": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "description": "False: the plan is not sold through its buy link.",
            "title": "Public"
          },
          "seats": {
            "anyOf": [
              {
                "maximum": 1000000.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "The machines a licence may activate, 1 to 1,000,000.",
            "title": "Seats"
          },
          "update_major": {
            "anyOf": [
              {
                "maximum": 999999999.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Major covered by a perpetual licence. A different major requires a new plan.",
            "title": "Update Major"
          },
          "update_months": {
            "anyOf": [
              {
                "maximum": 1200.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "The months of updates, 1 to 1200.",
            "title": "Update Months"
          },
          "usage_terms": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UsageTerms"
              },
              {
                "type": "null"
              }
            ],
            "description": "Bilingual contractual rights for software without device activation."
          }
        },
        "title": "PlanUpdate",
        "type": "object"
      },
      "PlansResponse": {
        "properties": {
          "plans": {
            "description": "The plans of the environment, oldest first.",
            "items": {
              "$ref": "#/components/schemas/PlanOut"
            },
            "title": "Plans",
            "type": "array"
          }
        },
        "required": [
          "plans"
        ],
        "title": "PlansResponse",
        "type": "object"
      },
      "Platform": {
        "enum": [
          "macos-universal",
          "macos-arm64",
          "macos-x64",
          "windows-x64",
          "windows-arm64",
          "linux-x64",
          "linux-arm64",
          "any"
        ],
        "title": "Platform",
        "type": "string"
      },
      "PrepaidChange": {
        "properties": {
          "edition": {
            "$ref": "#/components/schemas/BillingEdition",
            "description": "Edition already paid for a future period."
          },
          "starts_at": {
            "description": "Inclusive start of that paid period, in UTC.",
            "format": "date-time",
            "title": "Starts At",
            "type": "string"
          }
        },
        "required": [
          "edition",
          "starts_at"
        ],
        "title": "PrepaidChange",
        "type": "object"
      },
      "PreviewIn": {
        "additionalProperties": false,
        "properties": {
          "intro": {
            "default": "",
            "description": "The introduction, 2000 characters at most once cleaned, paragraphs apart by a blank line; blank: Keyseal's.",
            "maxLength": 8000,
            "title": "Intro",
            "type": "string"
          },
          "locale": {
            "description": "The language of the mail: fr or en.",
            "enum": [
              "fr",
              "en"
            ],
            "title": "Locale",
            "type": "string"
          },
          "outro": {
            "default": "",
            "description": "The conclusion, 2000 characters at most once cleaned, paragraphs apart by a blank line; blank: Keyseal's.",
            "maxLength": 8000,
            "title": "Outro",
            "type": "string"
          },
          "subject": {
            "default": "",
            "description": "The subject, 150 characters at most once cleaned, on one line; blank: Keyseal's. It may name the kind's variables between {{ and }}.",
            "maxLength": 600,
            "title": "Subject",
            "type": "string"
          }
        },
        "required": [
          "locale"
        ],
        "title": "PreviewIn",
        "type": "object"
      },
      "PreviewOut": {
        "properties": {
          "html": {
            "description": "The mail's HTML body.",
            "title": "Html",
            "type": "string"
          },
          "subject": {
            "description": "The mail's subject ([TEST] in front in test).",
            "title": "Subject",
            "type": "string"
          },
          "text": {
            "description": "The mail's plain-text body.",
            "title": "Text",
            "type": "string"
          }
        },
        "required": [
          "subject",
          "html",
          "text"
        ],
        "title": "PreviewOut",
        "type": "object"
      },
      "PriceIn": {
        "additionalProperties": false,
        "properties": {
          "amount": {
            "description": "The price in minor units (cents), 1 to 99,999,999.",
            "exclusiveMinimum": 0.0,
            "maximum": 99999999.0,
            "title": "Amount",
            "type": "integer"
          },
          "currency": {
            "description": "The currency, three letters (eur, usd...).",
            "pattern": "^[A-Za-z]{3}$",
            "title": "Currency",
            "type": "string"
          },
          "interval": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/BillingInterval"
              },
              {
                "type": "null"
              }
            ],
            "description": "month or year: for a subscription plan, and only for one."
          },
          "tax_behavior": {
            "$ref": "#/components/schemas/TaxBehavior",
            "default": "inclusive",
            "description": "inclusive (taxes included, the default) or exclusive."
          }
        },
        "required": [
          "amount",
          "currency"
        ],
        "title": "PriceIn",
        "type": "object"
      },
      "PriceOut": {
        "properties": {
          "amount": {
            "description": "The price in minor units (cents).",
            "title": "Amount",
            "type": "integer"
          },
          "currency": {
            "description": "The currency, three letters.",
            "title": "Currency",
            "type": "string"
          },
          "interval": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/BillingInterval"
              },
              {
                "type": "null"
              }
            ],
            "description": "month or year for a subscription; null otherwise."
          },
          "stripe_price_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The price at Stripe (price_…); null until it is pushed.",
            "title": "Stripe Price Id"
          },
          "tax_behavior": {
            "$ref": "#/components/schemas/TaxBehavior",
            "description": "inclusive or exclusive."
          }
        },
        "required": [
          "amount",
          "currency",
          "interval",
          "tax_behavior",
          "stripe_price_id"
        ],
        "title": "PriceOut",
        "type": "object"
      },
      "ProductCreate": {
        "additionalProperties": false,
        "properties": {
          "description": {
            "default": "",
            "description": "A description, 5000 characters at most.",
            "maxLength": 5000,
            "title": "Description",
            "type": "string"
          },
          "image_url": {
            "anyOf": [
              {
                "maxLength": 500,
                "pattern": "^[^\\x00-\\x1f\\x7f]*$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "HTTPS image URL, up to 500 characters. Keyseal static images appear inline and in social previews. Other hosts are offered through an external link.",
            "title": "Image Url"
          },
          "key_prefix": {
            "description": "Three capital letters A-Z, the start of the product's licence keys (DSM-…), unique in the environment; it never changes.",
            "maxLength": 3,
            "minLength": 1,
            "pattern": "^[^\\x00-\\x1f\\x7f]*$",
            "title": "Key Prefix",
            "type": "string"
          },
          "lease_days": {
            "default": 30,
            "description": "The lease of the licences' certificates, 1 to 3650 days (30 by default).",
            "maximum": 3650.0,
            "title": "Lease Days",
            "type": "integer"
          },
          "name": {
            "description": "The product's name, 1 to 200 characters.",
            "maxLength": 200,
            "minLength": 1,
            "pattern": "^[^\\x00-\\x1f\\x7f]*$",
            "title": "Name",
            "type": "string"
          },
          "offline_policy": {
            "$ref": "#/components/schemas/OfflinePolicy",
            "default": "open",
            "description": "open (the default): a lease run out without reaching Keyseal blocks nothing; closed: it blocks like an invalid licence until Keyseal is reached again."
          },
          "page_enabled": {
            "default": false,
            "description": "True: the product has a hosted page, /p/{org}/{product slug}, listed in the organization's shop /p/{org}; false (the default): no page, 404.",
            "title": "Page Enabled",
            "type": "boolean"
          },
          "privacy_url": {
            "anyOf": [
              {
                "maxLength": 500,
                "pattern": "^[^\\x00-\\x1f\\x7f]*$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Publisher’s HTTPS privacy notice, linked on the public product page.",
            "title": "Privacy Url"
          },
          "slug": {
            "description": "The product's slug, [a-z0-9-] starting with a letter or a digit, 64 characters at most, unique in the environment; it never changes.",
            "maxLength": 64,
            "minLength": 1,
            "pattern": "^[^\\x00-\\x1f\\x7f]*$",
            "title": "Slug",
            "type": "string"
          },
          "tax_code": {
            "default": "txcd_10202000",
            "description": "A Stripe tax code eligible for Managed Payments (catalog.tax_codes.list); txcd_10202000 by default.",
            "maxLength": 32,
            "pattern": "^[^\\x00-\\x1f\\x7f]*$",
            "title": "Tax Code",
            "type": "string"
          },
          "terms_url": {
            "anyOf": [
              {
                "maxLength": 500,
                "pattern": "^[^\\x00-\\x1f\\x7f]*$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Publisher’s HTTPS software terms, linked on the public product page.",
            "title": "Terms Url"
          },
          "website_url": {
            "anyOf": [
              {
                "maxLength": 500,
                "pattern": "^[^\\x00-\\x1f\\x7f]*$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The product's site, http:// or https://, 500 characters at most; also where a buyer who cancels the payment comes back to.",
            "title": "Website Url"
          }
        },
        "required": [
          "slug",
          "name",
          "key_prefix"
        ],
        "title": "ProductCreate",
        "type": "object"
      },
      "ProductImageIn": {
        "additionalProperties": false,
        "properties": {
          "content_base64": {
            "description": "Base64-encoded still PNG, JPEG or WebP, at most 512 KiB and 8 million pixels.",
            "maxLength": 699052,
            "minLength": 1,
            "title": "Content Base64",
            "type": "string"
          }
        },
        "required": [
          "content_base64"
        ],
        "title": "ProductImageIn",
        "type": "object"
      },
      "ProductImageOut": {
        "properties": {
          "image_url": {
            "description": "The Keyseal URL of the currently selected catalogue image.",
            "title": "Image Url",
            "type": "string"
          }
        },
        "required": [
          "image_url"
        ],
        "title": "ProductImageOut",
        "type": "object"
      },
      "ProductImagePreview": {
        "properties": {
          "content_base64": {
            "description": "Standard base64 of the sanitized WebP thumbnail.",
            "title": "Content Base64",
            "type": "string"
          },
          "image_url": {
            "description": "The Keyseal URL of the currently selected catalogue image.",
            "title": "Image Url",
            "type": "string"
          }
        },
        "required": [
          "image_url",
          "content_base64"
        ],
        "title": "ProductImagePreview",
        "type": "object"
      },
      "ProductOut": {
        "properties": {
          "description": {
            "description": "The product's description.",
            "title": "Description",
            "type": "string"
          },
          "id": {
            "description": "The product's id.",
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "image_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The image of the product's page; null for none.",
            "title": "Image Url"
          },
          "key_prefix": {
            "description": "The start of the product's licence keys (DSM-…); it never changes.",
            "title": "Key Prefix",
            "type": "string"
          },
          "lease_days": {
            "description": "The lease of the licences' certificates, in days.",
            "title": "Lease Days",
            "type": "integer"
          },
          "ls_compat": {
            "description": "True: the product's new licences get a key in Lemon Squeezy's format (a UUID).",
            "title": "Ls Compat",
            "type": "boolean"
          },
          "name": {
            "description": "The product's name.",
            "title": "Name",
            "type": "string"
          },
          "offline_policy": {
            "$ref": "#/components/schemas/OfflinePolicy",
            "description": "open: a lease run out without reaching Keyseal blocks nothing; closed: it blocks until Keyseal is reached again."
          },
          "page_enabled": {
            "description": "True: the product has a hosted page, /p/{org}/{product slug}.",
            "title": "Page Enabled",
            "type": "boolean"
          },
          "privacy_url": {
            "anyOf": [
              {
                "maxLength": 500,
                "pattern": "^[^\\x00-\\x1f\\x7f]*$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Publisher’s HTTPS privacy notice, linked on the public product page.",
            "title": "Privacy Url"
          },
          "slug": {
            "description": "The product's slug, unique in the environment; it never changes.",
            "title": "Slug",
            "type": "string"
          },
          "stripe": {
            "$ref": "#/components/schemas/StripeStatus",
            "description": "Whether the object is at Stripe as it is in Keyseal, and if not, why."
          },
          "stripe_product_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The product at Stripe (prod_…); null until it is pushed.",
            "title": "Stripe Product Id"
          },
          "tax_code": {
            "description": "The product's Stripe tax code.",
            "title": "Tax Code",
            "type": "string"
          },
          "terms_url": {
            "anyOf": [
              {
                "maxLength": 500,
                "pattern": "^[^\\x00-\\x1f\\x7f]*$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Publisher’s HTTPS software terms, linked on the public product page.",
            "title": "Terms Url"
          },
          "website_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The product's site; null for none.",
            "title": "Website Url"
          }
        },
        "required": [
          "id",
          "slug",
          "name",
          "key_prefix",
          "lease_days",
          "offline_policy",
          "description",
          "website_url",
          "tax_code",
          "ls_compat",
          "page_enabled",
          "image_url",
          "stripe_product_id",
          "stripe"
        ],
        "title": "ProductOut",
        "type": "object"
      },
      "ProductUpdate": {
        "additionalProperties": false,
        "properties": {
          "description": {
            "anyOf": [
              {
                "maxLength": 5000,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The new description, 5000 characters at most.",
            "title": "Description"
          },
          "image_url": {
            "anyOf": [
              {
                "maxLength": 500,
                "pattern": "^[^\\x00-\\x1f\\x7f]*$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The image of the product's page, https:// only; null clears it.",
            "title": "Image Url"
          },
          "lease_days": {
            "anyOf": [
              {
                "maximum": 3650.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "The new lease of the certificates, 1 to 3650 days.",
            "title": "Lease Days"
          },
          "ls_compat": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "description": "True: the product's new licences get a key in Lemon Squeezy's format (a UUID) instead of PFX-…; the keys already issued never change.",
            "title": "Ls Compat"
          },
          "name": {
            "anyOf": [
              {
                "maxLength": 200,
                "pattern": "^[^\\x00-\\x1f\\x7f]*$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The new name, 1 to 200 characters.",
            "title": "Name"
          },
          "offline_policy": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/OfflinePolicy"
              },
              {
                "type": "null"
              }
            ],
            "description": "open or closed."
          },
          "page_enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "description": "True: the product has a hosted page, /p/{org}/{product slug}; false: none.",
            "title": "Page Enabled"
          },
          "privacy_url": {
            "anyOf": [
              {
                "maxLength": 500,
                "pattern": "^[^\\x00-\\x1f\\x7f]*$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Publisher’s HTTPS privacy notice, linked on the public product page.",
            "title": "Privacy Url"
          },
          "tax_code": {
            "anyOf": [
              {
                "maxLength": 32,
                "pattern": "^[^\\x00-\\x1f\\x7f]*$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "A Stripe tax code eligible for Managed Payments (catalog.tax_codes.list).",
            "title": "Tax Code"
          },
          "terms_url": {
            "anyOf": [
              {
                "maxLength": 500,
                "pattern": "^[^\\x00-\\x1f\\x7f]*$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Publisher’s HTTPS software terms, linked on the public product page.",
            "title": "Terms Url"
          },
          "website_url": {
            "anyOf": [
              {
                "maxLength": 500,
                "pattern": "^[^\\x00-\\x1f\\x7f]*$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The new site, http:// or https://, 500 characters at most; null clears it.",
            "title": "Website Url"
          }
        },
        "title": "ProductUpdate",
        "type": "object"
      },
      "ProductsResponse": {
        "properties": {
          "products": {
            "description": "The products of the environment, oldest first.",
            "items": {
              "$ref": "#/components/schemas/ProductOut"
            },
            "title": "Products",
            "type": "array"
          }
        },
        "required": [
          "products"
        ],
        "title": "ProductsResponse",
        "type": "object"
      },
      "RecurringReport": {
        "properties": {
          "as_of": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Period-end observation instant, null before a future period.",
            "title": "As Of"
          },
          "cancellations": {
            "description": "Distinct subscriptions that ended during the date range.",
            "title": "Cancellations",
            "type": "integer"
          },
          "missing_subscriptions": {
            "description": "Subscriptions with unknown state or active rate at as_of.",
            "title": "Missing Subscriptions",
            "type": "integer"
          },
          "mrr": {
            "description": "Known active monthly recurring revenue by currency.",
            "items": {
              "$ref": "#/components/schemas/MonthlyAmount"
            },
            "title": "Mrr",
            "type": "array"
          },
          "scheduled_cancellations": {
            "description": "Subscriptions with a known future cancellation at as_of.",
            "title": "Scheduled Cancellations",
            "type": "integer"
          }
        },
        "required": [
          "as_of",
          "mrr",
          "missing_subscriptions",
          "scheduled_cancellations",
          "cancellations"
        ],
        "title": "RecurringReport",
        "type": "object"
      },
      "RefundCreate": {
        "additionalProperties": false,
        "properties": {
          "amount": {
            "anyOf": [
              {
                "maximum": 99999999.0,
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "The amount to refund, in minor units of the sale's currency, at most the sale's refundable_amount. Absent: all that remains refundable.",
            "title": "Amount"
          },
          "reason": {
            "anyOf": [
              {
                "enum": [
                  "requested_by_customer",
                  "duplicate",
                  "fraudulent"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Stripe's reason for the refund; optional.",
            "title": "Reason"
          }
        },
        "title": "RefundCreate",
        "type": "object"
      },
      "RefundOut": {
        "properties": {
          "amount": {
            "description": "The amount refunded, in minor units.",
            "title": "Amount",
            "type": "integer"
          },
          "currency": {
            "description": "The currency, three letters.",
            "title": "Currency",
            "type": "string"
          },
          "id": {
            "description": "The refund's id at Stripe, re_….",
            "title": "Id",
            "type": "string"
          },
          "status": {
            "description": "The refund's status at Stripe: succeeded, pending, requires_action, failed or canceled.",
            "title": "Status",
            "type": "string"
          }
        },
        "required": [
          "id",
          "amount",
          "currency",
          "status"
        ],
        "title": "RefundOut",
        "type": "object"
      },
      "Reinstatement": {
        "additionalProperties": false,
        "properties": {
          "notify": {
            "default": false,
            "description": "True: the holder is told by mail, if the status changes and the licence is usable. False by default.",
            "title": "Notify",
            "type": "boolean"
          }
        },
        "title": "Reinstatement",
        "type": "object"
      },
      "ReleaseCreate": {
        "additionalProperties": false,
        "properties": {
          "notes": {
            "default": "",
            "description": "The release notes, Markdown kept as text.",
            "title": "Notes",
            "type": "string"
          },
          "public": {
            "default": false,
            "description": "True: anyone may download this release without a licence. False by default.",
            "title": "Public",
            "type": "boolean"
          },
          "released_on": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The day of the release, YYYY-MM-DD; none: publishing sets the day, in UTC.",
            "title": "Released On"
          },
          "update_major": {
            "anyOf": [
              {
                "maximum": 999999999.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Major for download coverage, inferred for numeric versions.",
            "title": "Update Major"
          },
          "version": {
            "description": "The version number, at most 64 characters among 0-9 A-Z a-z . + -, unique per product; it never changes.",
            "title": "Version",
            "type": "string"
          }
        },
        "required": [
          "version"
        ],
        "title": "ReleaseCreate",
        "type": "object"
      },
      "ReleaseOut": {
        "properties": {
          "created_at": {
            "description": "When the release was made.",
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "files": {
            "description": "The release's files, by platform.",
            "items": {
              "$ref": "#/components/schemas/FileOut"
            },
            "title": "Files",
            "type": "array"
          },
          "id": {
            "description": "The release's id, rel_…",
            "title": "Id",
            "type": "string"
          },
          "notes": {
            "description": "The release notes, Markdown kept as text.",
            "title": "Notes",
            "type": "string"
          },
          "product_id": {
            "description": "The release's product.",
            "format": "uuid",
            "title": "Product Id",
            "type": "string"
          },
          "public": {
            "description": "True: anyone may download this release without a licence.",
            "title": "Public",
            "type": "boolean"
          },
          "published_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the release was published; null for a draft.",
            "title": "Published At"
          },
          "released_on": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The day of the release; null for a draft without one.",
            "title": "Released On"
          },
          "status": {
            "$ref": "#/components/schemas/ReleaseStatus",
            "description": "draft or published."
          },
          "update_major": {
            "anyOf": [
              {
                "maximum": 999999999.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Major for download coverage, inferred for numeric versions.",
            "title": "Update Major"
          },
          "version": {
            "description": "The version number, unique per product; it never changes.",
            "title": "Version",
            "type": "string"
          }
        },
        "required": [
          "id",
          "product_id",
          "version",
          "notes",
          "status",
          "public",
          "released_on",
          "published_at",
          "created_at",
          "files"
        ],
        "title": "ReleaseOut",
        "type": "object"
      },
      "ReleaseStatus": {
        "enum": [
          "draft",
          "published"
        ],
        "title": "ReleaseStatus",
        "type": "string"
      },
      "ReleaseUpdate": {
        "additionalProperties": false,
        "properties": {
          "notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The new release notes, Markdown kept as text.",
            "title": "Notes"
          },
          "public": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "description": "True: anyone may download this release without a licence.",
            "title": "Public"
          },
          "released_on": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The new day, YYYY-MM-DD; null only for a draft.",
            "title": "Released On"
          },
          "update_major": {
            "anyOf": [
              {
                "maximum": 999999999.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Major for download coverage, inferred for numeric versions.",
            "title": "Update Major"
          }
        },
        "title": "ReleaseUpdate",
        "type": "object"
      },
      "ReleasesResponse": {
        "properties": {
          "releases": {
            "description": "The releases, the most recent first.",
            "items": {
              "$ref": "#/components/schemas/ReleaseOut"
            },
            "title": "Releases",
            "type": "array"
          }
        },
        "required": [
          "releases"
        ],
        "title": "ReleasesResponse",
        "type": "object"
      },
      "RenewalLinkCreate": {
        "additionalProperties": false,
        "properties": {
          "plan_id": {
            "description": "A renewal plan of the licence's product.",
            "format": "uuid",
            "title": "Plan Id",
            "type": "string"
          },
          "send": {
            "default": false,
            "description": "True: the link also goes by mail to the customer (renewal_link). False by default.",
            "title": "Send",
            "type": "boolean"
          }
        },
        "required": [
          "plan_id"
        ],
        "title": "RenewalLinkCreate",
        "type": "object"
      },
      "RenewalLinkOut": {
        "properties": {
          "email_id": {
            "anyOf": [
              {
                "format": "uuid",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The id of the mail queued, with send only (left out otherwise).",
            "title": "Email Id"
          },
          "expires_at": {
            "description": "When the link stops working.",
            "format": "date-time",
            "title": "Expires At",
            "type": "string"
          },
          "url": {
            "description": "The renewal link: valid 30 days, as many times as wanted. A capability: never kept in a cache.",
            "title": "Url",
            "type": "string"
          }
        },
        "required": [
          "url",
          "expires_at"
        ],
        "title": "RenewalLinkOut",
        "type": "object"
      },
      "Role": {
        "enum": [
          "owner",
          "admin",
          "member"
        ],
        "title": "Role",
        "type": "string"
      },
      "SalesAmounts": {
        "properties": {
          "currency": {
            "description": "Lowercase ISO currency code.",
            "title": "Currency",
            "type": "string"
          },
          "gross": {
            "description": "Gross paid, including tax, in sale-currency minor units.",
            "title": "Gross",
            "type": "integer"
          },
          "missing_refunds": {
            "description": "Orders in this sale currency with incomplete evidence of buyer refunds.",
            "title": "Missing Refunds",
            "type": "integer"
          },
          "refunds": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Positive buyer refunds dated in this period, in sale-currency minor units. Null when unavailable. Check missing_refunds for partial coverage.",
            "title": "Refunds"
          },
          "subscription_revenue": {
            "description": "Gross subscription payments in minor units.",
            "title": "Subscription Revenue",
            "type": "integer"
          }
        },
        "required": [
          "currency",
          "gross",
          "subscription_revenue",
          "refunds",
          "missing_refunds"
        ],
        "title": "SalesAmounts",
        "type": "object"
      },
      "SettlementAmounts": {
        "properties": {
          "currency": {
            "description": "Lowercase ISO currency code.",
            "title": "Currency",
            "type": "string"
          },
          "fees": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Fees charged, excluding withheld tax, in minor units.",
            "title": "Fees"
          },
          "net": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Signed credits and debits on the settlement balance in minor units. Tax and fees already included. Check coverage for partial amounts.",
            "title": "Net"
          },
          "tax": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Actual tax withheld, less tax returned, in settlement-currency minor units.",
            "title": "Tax"
          }
        },
        "required": [
          "currency",
          "tax",
          "fees",
          "net"
        ],
        "title": "SettlementAmounts",
        "type": "object"
      },
      "StatusAction": {
        "additionalProperties": false,
        "description": "`revoke` and `suspend`: why (kept in the journal), and whether to tell the holder.",
        "properties": {
          "notify": {
            "default": false,
            "description": "True: the holder is told by mail, if the status changes. False by default.",
            "title": "Notify",
            "type": "boolean"
          },
          "reason": {
            "description": "Why, 1 to 200 characters on one line: kept in the licence's journal (data.reason of its status_changed event).",
            "maxLength": 200,
            "minLength": 1,
            "title": "Reason",
            "type": "string"
          }
        },
        "required": [
          "reason"
        ],
        "title": "StatusAction",
        "type": "object"
      },
      "StripeConnect": {
        "properties": {
          "restricted_key": {
            "description": "A Stripe restricted key, rk_test_… in test or rk_live_… in live; a secret sk_… key is refused. Never returned.",
            "maxLength": 255,
            "minLength": 1,
            "title": "Restricted Key",
            "type": "string"
          }
        },
        "required": [
          "restricted_key"
        ],
        "title": "StripeConnect",
        "type": "object"
      },
      "StripeConnectedOut": {
        "properties": {
          "catalog": {
            "$ref": "#/components/schemas/CatalogSyncOut",
            "description": "The report of the push of the catalogue that follows the connection; its failure never undoes the connection."
          },
          "checked_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the key was last checked at Stripe; null when not connected.",
            "title": "Checked At"
          },
          "connected": {
            "description": "True when Stripe is connected in the environment of the request.",
            "title": "Connected",
            "type": "boolean"
          },
          "key_hint": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The last 4 characters of the restricted key; null when not connected.",
            "title": "Key Hint"
          },
          "webhook_endpoint": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The webhook endpoint Keyseal made at Stripe (we_…); null without one.",
            "title": "Webhook Endpoint"
          }
        },
        "required": [
          "connected",
          "key_hint",
          "webhook_endpoint",
          "checked_at",
          "catalog"
        ],
        "title": "StripeConnectedOut",
        "type": "object"
      },
      "StripeConnectionOut": {
        "properties": {
          "checked_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the key was last checked at Stripe; null when not connected.",
            "title": "Checked At"
          },
          "connected": {
            "description": "True when Stripe is connected in the environment of the request.",
            "title": "Connected",
            "type": "boolean"
          },
          "key_hint": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The last 4 characters of the restricted key; null when not connected.",
            "title": "Key Hint"
          },
          "webhook_endpoint": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The webhook endpoint Keyseal made at Stripe (we_…); null without one.",
            "title": "Webhook Endpoint"
          }
        },
        "required": [
          "connected",
          "key_hint",
          "webhook_endpoint",
          "checked_at"
        ],
        "title": "StripeConnectionOut",
        "type": "object"
      },
      "StripeDisconnectedOut": {
        "properties": {
          "codes_still_active": {
            "description": "The discount codes made in Keyseal that may still be active at Stripe, to deactivate by hand in its Dashboard; empty when all were deactivated (always, without force).",
            "items": {
              "type": "string"
            },
            "title": "Codes Still Active",
            "type": "array"
          },
          "disconnected": {
            "description": "True: Stripe is disconnected.",
            "title": "Disconnected",
            "type": "boolean"
          }
        },
        "required": [
          "disconnected",
          "codes_still_active"
        ],
        "title": "StripeDisconnectedOut",
        "type": "object"
      },
      "StripeStatus": {
        "description": "Whether the object is at Stripe as it is here, and if not, why (on a write, the push's\nfailure; else ``stripe_not_connected``, or null while a push is due).",
        "properties": {
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Why not: stripe_unavailable, stripe_refused or stripe_not_connected; null while a push is due.",
            "title": "Error"
          },
          "synced": {
            "description": "True when the object is at Stripe as it is in Keyseal.",
            "title": "Synced",
            "type": "boolean"
          }
        },
        "required": [
          "synced",
          "error"
        ],
        "title": "StripeStatus",
        "type": "object"
      },
      "SubscriptionOut": {
        "properties": {
          "cancel_at_period_end": {
            "description": "True when the subscription ends at the end of its current period.",
            "title": "Cancel At Period End",
            "type": "boolean"
          },
          "current_period_end": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The end of the current paid period; null if Stripe did not say.",
            "title": "Current Period End"
          },
          "ended_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the subscription ended; null while it runs.",
            "title": "Ended At"
          },
          "id": {
            "description": "The subscription's id in Keyseal.",
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "licence_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The licence the subscription pays for, lic_…; null for none.",
            "title": "Licence Id"
          },
          "status": {
            "description": "The subscription's status at Stripe: active, past_due, canceled…",
            "title": "Status",
            "type": "string"
          }
        },
        "required": [
          "id",
          "status",
          "licence_id",
          "current_period_end",
          "cancel_at_period_end",
          "ended_at"
        ],
        "title": "SubscriptionOut",
        "type": "object"
      },
      "SyncFailureOut": {
        "properties": {
          "id": {
            "description": "Keyseal's id of the product, or of the plan's price.",
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "kind": {
            "description": "What Stripe refused: product or price.",
            "enum": [
              "product",
              "price"
            ],
            "title": "Kind",
            "type": "string"
          },
          "param": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The parameter Stripe named, never its words; null if it named none.",
            "title": "Param"
          },
          "plan_id": {
            "anyOf": [
              {
                "format": "uuid",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The plan whose price Stripe refused; null for a product.",
            "title": "Plan Id"
          }
        },
        "required": [
          "kind",
          "id",
          "plan_id",
          "param"
        ],
        "title": "SyncFailureOut",
        "type": "object"
      },
      "TaxBehavior": {
        "enum": [
          "inclusive",
          "exclusive"
        ],
        "title": "TaxBehavior",
        "type": "string"
      },
      "TaxCodeOut": {
        "properties": {
          "code": {
            "description": "The Stripe tax code (txcd_…).",
            "title": "Code",
            "type": "string"
          },
          "default": {
            "description": "True for the code a product carries when created without tax_code.",
            "title": "Default",
            "type": "boolean"
          },
          "name": {
            "description": "Its name at Stripe.",
            "title": "Name",
            "type": "string"
          }
        },
        "required": [
          "code",
          "name",
          "default"
        ],
        "title": "TaxCodeOut",
        "type": "object"
      },
      "TaxCodesResponse": {
        "properties": {
          "tax_codes": {
            "description": "The tax codes a product may carry.",
            "items": {
              "$ref": "#/components/schemas/TaxCodeOut"
            },
            "title": "Tax Codes",
            "type": "array"
          }
        },
        "required": [
          "tax_codes"
        ],
        "title": "TaxCodesResponse",
        "type": "object"
      },
      "TemplateOut": {
        "properties": {
          "custom": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CustomOut"
              },
              {
                "type": "null"
              }
            ],
            "description": "The publisher's text as written; null: Keyseal's text throughout."
          },
          "default": {
            "$ref": "#/components/schemas/TextsOut",
            "description": "Keyseal's text, as the buyer would read it with the sample data of the preview: what a blank zone keeps. To read, not to save back."
          },
          "kind": {
            "$ref": "#/components/schemas/EmailKind",
            "description": "The kind of mail: licence_issued, renewal_confirmed, renewal_link, payment_failed, licence_revoked, licence_suspended or licence_reinstated."
          },
          "locale": {
            "description": "The language: fr or en.",
            "title": "Locale",
            "type": "string"
          },
          "variables": {
            "description": "The names a zone may use between {{ and }}.",
            "items": {
              "type": "string"
            },
            "title": "Variables",
            "type": "array"
          }
        },
        "required": [
          "kind",
          "locale",
          "variables",
          "default",
          "custom"
        ],
        "title": "TemplateOut",
        "type": "object"
      },
      "TemplatesResponse": {
        "properties": {
          "templates": {
            "description": "One template per editable kind and language, always in the same order.",
            "items": {
              "$ref": "#/components/schemas/TemplateOut"
            },
            "title": "Templates",
            "type": "array"
          }
        },
        "required": [
          "templates"
        ],
        "title": "TemplatesResponse",
        "type": "object"
      },
      "TextsIn": {
        "additionalProperties": false,
        "description": "The three zones; one left out or blank keeps Keyseal's text.",
        "properties": {
          "intro": {
            "default": "",
            "description": "The introduction, 2000 characters at most once cleaned, paragraphs apart by a blank line; blank: Keyseal's.",
            "maxLength": 8000,
            "title": "Intro",
            "type": "string"
          },
          "outro": {
            "default": "",
            "description": "The conclusion, 2000 characters at most once cleaned, paragraphs apart by a blank line; blank: Keyseal's.",
            "maxLength": 8000,
            "title": "Outro",
            "type": "string"
          },
          "subject": {
            "default": "",
            "description": "The subject, 150 characters at most once cleaned, on one line; blank: Keyseal's. It may name the kind's variables between {{ and }}.",
            "maxLength": 600,
            "title": "Subject",
            "type": "string"
          }
        },
        "title": "TextsIn",
        "type": "object"
      },
      "TextsOut": {
        "properties": {
          "intro": {
            "description": "The introduction, paragraphs apart by a blank line.",
            "title": "Intro",
            "type": "string"
          },
          "outro": {
            "description": "The conclusion, paragraphs apart by a blank line.",
            "title": "Outro",
            "type": "string"
          },
          "subject": {
            "description": "The subject.",
            "title": "Subject",
            "type": "string"
          }
        },
        "required": [
          "subject",
          "intro",
          "outro"
        ],
        "title": "TextsOut",
        "type": "object"
      },
      "Totals": {
        "properties": {
          "coverage": {
            "$ref": "#/components/schemas/Coverage",
            "description": "Current reconciliation coverage of contributing orders."
          },
          "sales": {
            "description": "Sale amounts by original buyer currency.",
            "items": {
              "$ref": "#/components/schemas/SalesAmounts"
            },
            "title": "Sales",
            "type": "array"
          },
          "sales_count": {
            "description": "Number of orders paid, including zero-amount sales.",
            "title": "Sales Count",
            "type": "integer"
          },
          "settlement": {
            "description": "Balance amounts by observed settlement currency. Unknown currencies are omitted. Partial amounts include only evidenced movements.",
            "items": {
              "$ref": "#/components/schemas/SettlementAmounts"
            },
            "title": "Settlement",
            "type": "array"
          },
          "subscription_renewals": {
            "description": "Subsequent paid subscription periods.",
            "title": "Subscription Renewals",
            "type": "integer"
          },
          "updates_extended": {
            "description": "Paid extensions of the update entitlement.",
            "title": "Updates Extended",
            "type": "integer"
          }
        },
        "required": [
          "sales_count",
          "sales",
          "settlement",
          "coverage",
          "updates_extended",
          "subscription_renewals"
        ],
        "title": "Totals",
        "type": "object"
      },
      "UploadStarted": {
        "properties": {
          "file": {
            "$ref": "#/components/schemas/FileOut",
            "description": "The file declared, pending."
          },
          "upload_expires_at": {
            "description": "When upload_url stops working.",
            "format": "date-time",
            "title": "Upload Expires At",
            "type": "string"
          },
          "upload_url": {
            "description": "The address to PUT the file's bytes to, valid 15 minutes: the body of the PUT is the file.",
            "title": "Upload Url",
            "type": "string"
          }
        },
        "required": [
          "file",
          "upload_url",
          "upload_expires_at"
        ],
        "title": "UploadStarted",
        "type": "object"
      },
      "UsageDayReport": {
        "properties": {
          "activations": {
            "description": "New activations and successful reactivations on this day.",
            "title": "Activations",
            "type": "integer"
          },
          "active_licences": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Usable licences at the sample.",
            "title": "Active Licences"
          },
          "active_machines": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Occupied seats on usable licences at the sample.",
            "title": "Active Machines"
          },
          "api_calls": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Scoped authenticated management API calls. Null before tracking.",
            "title": "Api Calls"
          },
          "day": {
            "description": "UTC calendar day.",
            "format": "date",
            "title": "Day",
            "type": "string"
          },
          "members": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Organization-wide members at the sample.",
            "title": "Members"
          },
          "observed_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "UTC gauge sample, null for a gap.",
            "title": "Observed At"
          },
          "products": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Products in the environment at the sample.",
            "title": "Products"
          },
          "storage_bytes": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Ready file bytes at the sample.",
            "title": "Storage Bytes"
          },
          "webhook_attempts": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Outgoing webhook attempts. Null before tracking.",
            "title": "Webhook Attempts"
          }
        },
        "required": [
          "day",
          "observed_at",
          "active_licences",
          "active_machines",
          "storage_bytes",
          "products",
          "members",
          "activations",
          "api_calls",
          "webhook_attempts"
        ],
        "title": "UsageDayReport",
        "type": "object"
      },
      "UsageReport": {
        "properties": {
          "current": {
            "$ref": "#/components/schemas/CurrentUsage",
            "description": "Live gauges at request time, independent of the requested dates."
          },
          "daily": {
            "description": "Observed UTC days and local daily flows. A missing gauge is null.",
            "items": {
              "$ref": "#/components/schemas/UsageDayReport"
            },
            "title": "Daily",
            "type": "array"
          },
          "from": {
            "description": "Requested first UTC date, inclusive.",
            "format": "date",
            "title": "From",
            "type": "string"
          },
          "member_scope": {
            "const": "organization",
            "description": "Membership covers both environments.",
            "title": "Member Scope",
            "type": "string"
          },
          "observed_at": {
            "description": "UTC instant of observation.",
            "format": "date-time",
            "title": "Observed At",
            "type": "string"
          },
          "to": {
            "description": "Requested last UTC date, inclusive.",
            "format": "date",
            "title": "To",
            "type": "string"
          }
        },
        "required": [
          "from",
          "to",
          "observed_at",
          "member_scope",
          "current",
          "daily"
        ],
        "title": "UsageReport",
        "type": "object"
      },
      "UsageTerms": {
        "additionalProperties": false,
        "properties": {
          "en": {
            "description": "The offer's usage terms in English.",
            "maxLength": 400,
            "minLength": 1,
            "pattern": "^[^\\x00-\\x1f\\x7f]*$",
            "title": "En",
            "type": "string"
          },
          "fr": {
            "description": "The offer's usage terms in French.",
            "maxLength": 400,
            "minLength": 1,
            "pattern": "^[^\\x00-\\x1f\\x7f]*$",
            "title": "Fr",
            "type": "string"
          }
        },
        "required": [
          "fr",
          "en"
        ],
        "title": "UsageTerms",
        "type": "object"
      },
      "UserOut": {
        "properties": {
          "email": {
            "description": "The last verified primary email for this Clerk user ID. Reading the profile refreshes it when Clerk is available.",
            "title": "Email",
            "type": "string"
          },
          "id": {
            "description": "The user's id in Keyseal.",
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "name": {
            "description": "The user's latest display name obtained from Clerk.",
            "title": "Name",
            "type": "string"
          }
        },
        "required": [
          "id",
          "email",
          "name"
        ],
        "title": "UserOut",
        "type": "object"
      },
      "WebhookDeliveriesResponse": {
        "properties": {
          "deliveries": {
            "description": "The deliveries of the page, newest first.",
            "items": {
              "$ref": "#/components/schemas/WebhookDeliveryOut"
            },
            "title": "Deliveries",
            "type": "array"
          },
          "next_cursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The cursor of the next page, to pass as cursor; null on the last page.",
            "title": "Next Cursor"
          }
        },
        "required": [
          "deliveries",
          "next_cursor"
        ],
        "title": "WebhookDeliveriesResponse",
        "type": "object"
      },
      "WebhookDeliveryDetail": {
        "properties": {
          "attempts": {
            "description": "The attempts made, 9 at most.",
            "title": "Attempts",
            "type": "integer"
          },
          "created_at": {
            "description": "When the event was queued for this endpoint.",
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "delivered_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the endpoint answered 2xx; null otherwise.",
            "title": "Delivered At"
          },
          "endpoint_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The endpoint, whe_…; null once the endpoint is deleted.",
            "title": "Endpoint Id"
          },
          "event_id": {
            "description": "The event's id, evt_…: the same in every delivery of the event, to deduplicate.",
            "title": "Event Id",
            "type": "string"
          },
          "event_type": {
            "description": "The event's type: order.created, ping…",
            "title": "Event Type",
            "type": "string"
          },
          "id": {
            "description": "The delivery's id, whd_…",
            "title": "Id",
            "type": "string"
          },
          "last_error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Why the last attempt did not succeed, a short code: http_<status>, timeout, blocked_address, dns_error, connect_error, tls_error, request_error, send_error, invalid_url, vault_error, lease_expired, endpoint_deleted, endpoint_disabled, event_not_selected or event_missing; null otherwise.",
            "title": "Last Error"
          },
          "last_status_code": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "The HTTP status the endpoint answered to the last attempt; null when none answered.",
            "title": "Last Status Code"
          },
          "next_attempt_at": {
            "description": "When it is tried next, while pending; the last time it was due otherwise.",
            "format": "date-time",
            "title": "Next Attempt At",
            "type": "string"
          },
          "payload": {
            "additionalProperties": true,
            "description": "The body sent: {id, type, created, environment, data}, data the object as the management API shows it (never a licence key nor a secret).",
            "title": "Payload",
            "type": "object"
          },
          "response_excerpt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The first 1024 bytes of the endpoint's last answer, as text; null when none answered.",
            "title": "Response Excerpt"
          },
          "status": {
            "$ref": "#/components/schemas/WebhookDeliveryStatus",
            "description": "pending (waiting for its next attempt), sending (a worker sends it now), succeeded (the endpoint answered 2xx) or failed (given up; last_error says why)."
          }
        },
        "required": [
          "id",
          "event_id",
          "event_type",
          "endpoint_id",
          "status",
          "attempts",
          "next_attempt_at",
          "last_status_code",
          "last_error",
          "delivered_at",
          "created_at",
          "payload",
          "response_excerpt"
        ],
        "title": "WebhookDeliveryDetail",
        "type": "object"
      },
      "WebhookDeliveryOut": {
        "properties": {
          "attempts": {
            "description": "The attempts made, 9 at most.",
            "title": "Attempts",
            "type": "integer"
          },
          "created_at": {
            "description": "When the event was queued for this endpoint.",
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "delivered_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the endpoint answered 2xx; null otherwise.",
            "title": "Delivered At"
          },
          "endpoint_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The endpoint, whe_…; null once the endpoint is deleted.",
            "title": "Endpoint Id"
          },
          "event_id": {
            "description": "The event's id, evt_…: the same in every delivery of the event, to deduplicate.",
            "title": "Event Id",
            "type": "string"
          },
          "event_type": {
            "description": "The event's type: order.created, ping…",
            "title": "Event Type",
            "type": "string"
          },
          "id": {
            "description": "The delivery's id, whd_…",
            "title": "Id",
            "type": "string"
          },
          "last_error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Why the last attempt did not succeed, a short code: http_<status>, timeout, blocked_address, dns_error, connect_error, tls_error, request_error, send_error, invalid_url, vault_error, lease_expired, endpoint_deleted, endpoint_disabled, event_not_selected or event_missing; null otherwise.",
            "title": "Last Error"
          },
          "last_status_code": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "The HTTP status the endpoint answered to the last attempt; null when none answered.",
            "title": "Last Status Code"
          },
          "next_attempt_at": {
            "description": "When it is tried next, while pending; the last time it was due otherwise.",
            "format": "date-time",
            "title": "Next Attempt At",
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/WebhookDeliveryStatus",
            "description": "pending (waiting for its next attempt), sending (a worker sends it now), succeeded (the endpoint answered 2xx) or failed (given up; last_error says why)."
          }
        },
        "required": [
          "id",
          "event_id",
          "event_type",
          "endpoint_id",
          "status",
          "attempts",
          "next_attempt_at",
          "last_status_code",
          "last_error",
          "delivered_at",
          "created_at"
        ],
        "title": "WebhookDeliveryOut",
        "type": "object"
      },
      "WebhookDeliveryStatus": {
        "description": "Where a webhook delivery is. `pending`: waiting for its next attempt. `sending`: taken\nby a worker, for its lease. `succeeded`: the endpoint answered 2xx. `failed`: given up\n(9 attempts without a 2xx, or its endpoint deleted); `last_error` says why.",
        "enum": [
          "pending",
          "sending",
          "succeeded",
          "failed"
        ],
        "title": "WebhookDeliveryStatus",
        "type": "string"
      },
      "WebhookEndpointCreate": {
        "additionalProperties": false,
        "properties": {
          "active": {
            "default": true,
            "description": "False: nothing is sent to it until it is made active. True by default.",
            "title": "Active",
            "type": "boolean"
          },
          "description": {
            "default": "",
            "description": "A note for the publisher's team, 500 characters at most; empty by default.",
            "maxLength": 500,
            "title": "Description",
            "type": "string"
          },
          "events": {
            "description": "The events sent to it: one or more of webhooks.event_types.list, or [\"*\"] alone for every event, those added later included. Anything else is 422 invalid_webhook_events.",
            "items": {
              "type": "string"
            },
            "title": "Events",
            "type": "array"
          },
          "url": {
            "description": "The address the events are POSTed to: https:// only, 2048 characters at most, no credentials, a public host name (not localhost, not an internal IP address). Anything else is 422 invalid_webhook_url.",
            "title": "Url",
            "type": "string"
          }
        },
        "required": [
          "url",
          "events"
        ],
        "title": "WebhookEndpointCreate",
        "type": "object"
      },
      "WebhookEndpointOut": {
        "properties": {
          "active": {
            "description": "False: nothing is sent to it.",
            "title": "Active",
            "type": "boolean"
          },
          "created_at": {
            "description": "When the endpoint was made.",
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "description": {
            "description": "The publisher's note; empty when none.",
            "title": "Description",
            "type": "string"
          },
          "events": {
            "description": "The events sent to it, or [\"*\"] for every event.",
            "items": {
              "type": "string"
            },
            "title": "Events",
            "type": "array"
          },
          "id": {
            "description": "The endpoint's id, whe_…",
            "title": "Id",
            "type": "string"
          },
          "updated_at": {
            "description": "When it was last changed.",
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          },
          "url": {
            "description": "The address the events are POSTed to.",
            "title": "Url",
            "type": "string"
          }
        },
        "required": [
          "id",
          "url",
          "description",
          "events",
          "active",
          "created_at",
          "updated_at"
        ],
        "title": "WebhookEndpointOut",
        "type": "object"
      },
      "WebhookEndpointUpdate": {
        "additionalProperties": false,
        "properties": {
          "active": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "description": "False: nothing more is sent to it (the deliveries due meanwhile fail with endpoint_disabled); true: sent to again.",
            "title": "Active"
          },
          "description": {
            "anyOf": [
              {
                "maxLength": 500,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "A note for the publisher's team, 500 characters at most.",
            "title": "Description"
          },
          "events": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "The events sent to it: one or more of webhooks.event_types.list, or [\"*\"] alone for every event, those added later included. Anything else is 422 invalid_webhook_events.",
            "title": "Events"
          },
          "url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The address the events are POSTed to: https:// only, 2048 characters at most, no credentials, a public host name (not localhost, not an internal IP address). Anything else is 422 invalid_webhook_url.",
            "title": "Url"
          }
        },
        "title": "WebhookEndpointUpdate",
        "type": "object"
      },
      "WebhookEndpointWithSecret": {
        "properties": {
          "active": {
            "description": "False: nothing is sent to it.",
            "title": "Active",
            "type": "boolean"
          },
          "created_at": {
            "description": "When the endpoint was made.",
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "description": {
            "description": "The publisher's note; empty when none.",
            "title": "Description",
            "type": "string"
          },
          "events": {
            "description": "The events sent to it, or [\"*\"] for every event.",
            "items": {
              "type": "string"
            },
            "title": "Events",
            "type": "array"
          },
          "id": {
            "description": "The endpoint's id, whe_…",
            "title": "Id",
            "type": "string"
          },
          "secret": {
            "description": "The signing secret, kswhsec_…, THE ONLY TIME IT IS SHOWN: the receiver checks the Keyseal-Signature header of each delivery with it. Keyseal never shows it again; a lost secret is replaced by webhooks.endpoints.rotate_secret.",
            "title": "Secret",
            "type": "string"
          },
          "updated_at": {
            "description": "When it was last changed.",
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          },
          "url": {
            "description": "The address the events are POSTed to.",
            "title": "Url",
            "type": "string"
          }
        },
        "required": [
          "id",
          "url",
          "description",
          "events",
          "active",
          "created_at",
          "updated_at",
          "secret"
        ],
        "title": "WebhookEndpointWithSecret",
        "type": "object"
      },
      "WebhookEndpointsResponse": {
        "properties": {
          "endpoints": {
            "description": "The endpoints, oldest first.",
            "items": {
              "$ref": "#/components/schemas/WebhookEndpointOut"
            },
            "title": "Endpoints",
            "type": "array"
          }
        },
        "required": [
          "endpoints"
        ],
        "title": "WebhookEndpointsResponse",
        "type": "object"
      },
      "WebhookEventTypesResponse": {
        "properties": {
          "event_types": {
            "description": "The events an endpoint may choose; [\"*\"] chooses them all.",
            "items": {
              "type": "string"
            },
            "title": "Event Types",
            "type": "array"
          }
        },
        "required": [
          "event_types"
        ],
        "title": "WebhookEventTypesResponse",
        "type": "object"
      }
    },
    "securitySchemes": {
      "bearer": {
        "description": "An API key `ksk_live_…` or `ksk_test_…` (made by `POST /api-keys`, shown once; it carries its organization and its environment, so the `Keyseal-Organization` and `Keyseal-Environment` headers are optional and, given, must be its own), or the session token of a person signed in with Clerk (both headers required, but on `GET /me`, `POST /organizations` and `POST /invitations/accept`).",
        "scheme": "bearer",
        "type": "http"
      }
    }
  },
  "info": {
    "description": "The management API of Keyseal, under `/api/v1`: a publisher's organization, its members and API keys, its Stripe connection, its catalogue (products and plans), its licences, customers, sales and mails, its discount codes, its releases and their files, its imports from Lemon Squeezy, and its outgoing webhooks, analytics and usage.\n\n## Credentials\n\nEvery request carries `Authorization: Bearer <credential>` (the `bearer` scheme): an API key (`ksk_live_…` or `ksk_test_…`), which carries its organization and its environment, or the session token of a person signed in with Clerk. A missing, unknown, revoked or malformed credential is `401 unauthenticated`.\n\n## Organization and environment\n\nAn organization works in two sealed environments, `test` and `live`: every product, plan, customer, licence, mail, release, import and API key belongs to one of them. Two headers name the scope of a request:\n\n- `Keyseal-Organization`: the slug of the organization;\n- `Keyseal-Environment`: `test` or `live`.\n\nWith a Clerk session token both are **required** (missing or malformed: `422 invalid_request`, `fields` naming the header). With an API key both are **optional**: given, each must be the key's own (`403 scope_mismatch` otherwise). `GET /me`, `POST /organizations` and `POST /invitations/accept` name no organization and take neither.\n\n## Rights\n\nA person has a role in each organization, the same in both environments: `member` < `admin` < `owner`. An API key has rights: `read`, `licences`, `catalog`, `files`, `customers`, `admin`; `admin` implies all the others. A key never has a role: what only a role grants is refused to it (`403 forbidden`). The description of each operation says who may call it.\n\nAnother organization's object, or one of the other environment, is `404 not_found`, never `403`: nothing tells that it exists.\n\n## Errors\n\nEvery error answers `{\"error\": {\"code\", \"message\"}}` (with `fields` for `invalid_request`), and each operation lists the codes it may answer, with their message (`/llms-full.txt` lists them all).\n\n## Retries\n\nEvery write (`POST`, `PUT`, `PATCH`, `DELETE`) takes an optional `Idempotency-Key` header, 1 to 255 visible ASCII characters: send a new one (a UUID) with each write, and the same one when retrying it. Within 24 hours, the same key from the same caller (person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: the first answer (a success or a 4xx refusal) comes back, with `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered (it still runs, or it stopped without its answer being kept): check the state, then use a new key. Not kept, so that the retry runs the write: a 5xx, a 429, `409 stripe_connection_busy`, an answer over 256 KiB, as long as the write changed nothing (after its change, such a failure leaves the key `409 idempotency_key_in_progress` for 24 hours: never a second effect). A `503` carries `Retry-After` only for a provider that did not answer, never for a service not configured. `api_keys.create`, `webhooks.endpoints.create`, `webhooks.endpoints.rotate_secret`, `billing.checkout`, `billing.change`, `account.organizations.create` and `account.invitations.accept` refuse the header\n(`400 idempotency_not_supported`); `emails.templates.preview`, which only reads, ignores it.\n\n## Lists and limits\n\nThe lists of licences, events, mails, customers, sales and webhook deliveries run newest first and page with `limit` (1 to 100, 50 by default) and `cursor`, the `next_cursor` of the previous page (`null` on the last one). Each credential may make 120 requests a minute, and each address 600 whatever its credentials: beyond, `429 rate_limited`. A shared counter outage returns\n`503 limits_unavailable`. Bodies larger than the configured limit (1 MiB by default) return\n`413 payload_too_large`. Upload file contents with the signed storage URL.\n\nIn a commercial environment a plan ceiling returns `429 billing_limit_reached`, with the\naffected `dimension`. Authenticated calls (including refusals) count toward the UTC calendar\nmonth. Billing, the reads needed to release resources, and operations that free capacity remain\navailable. Existing buyer licences, activations, downloads and paid orders keep their rights.\n",
    "title": "Keyseal",
    "version": "0.1.0"
  },
  "openapi": "3.1.0",
  "paths": {
    "/api/v1/analytics": {
      "get": {
        "description": "Aggregate paid sales and buyer refunds by their effective UTC dates and sale currencies. Settlement entries use their own date and currency. Withheld tax, fees and net are local evidenced amounts. Coverage counts distinct affected orders. An undated cumulative refund marks each possible day from payment through its observation with missing_refunds in the original sale currency. Amounts are integer minor units. MRR uses discounted tax-exclusive rates at period end or the observation instant and rounds once per currency. Dates are inclusive UTC calendar dates, at most 366 days apart including both ends. The default is the 30 days ending today. Future dates are accepted and the daily series stops at the observation time. A reversed or excessive range is 422 invalid_request. When product_id is given, an unknown product or a product outside the caller's environment is 404 not_found.\n\n**Who may call:** Any member of the organization; an API key with the right `read` (or `admin`, which implies every right).",
        "operationId": "analytics.summary",
        "parameters": [
          {
            "description": "Restrict the entire report to this product UUID.",
            "in": "query",
            "name": "product_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "uuid",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Restrict the entire report to this product UUID.",
              "title": "Product Id"
            }
          },
          {
            "description": "First UTC date (YYYY-MM-DD), inclusive. Defaults to 29 days before to.",
            "in": "query",
            "name": "from",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "First UTC date (YYYY-MM-DD), inclusive. Defaults to 29 days before to.",
              "title": "From"
            }
          },
          {
            "description": "Last UTC date (YYYY-MM-DD), inclusive. Defaults to today.",
            "in": "query",
            "name": "to",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Last UTC date (YYYY-MM-DD), inclusive. Defaults to today.",
              "title": "To"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnalyticsReport"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Read publisher analytics",
        "tags": [
          "analytics"
        ]
      }
    },
    "/api/v1/analytics/export": {
      "get": {
        "description": "Download the same aggregate figures as analytics.summary in UTF-8 CSV. Each row names the dimension, key, label, day, metric, currency, unit, value and availability. Missing values are empty and marked unavailable. Dates are inclusive UTC calendar dates, at most 366 days apart including both ends. The default is the 30 days ending today. Future dates are accepted and the daily series stops at the observation time. A reversed or excessive range is 422 invalid_request. When product_id is given, an unknown product or a product outside the caller's environment is 404 not_found.\n\n**Who may call:** Any member of the organization; an API key with the right `read` (or `admin`, which implies every right).",
        "operationId": "analytics.export",
        "parameters": [
          {
            "description": "Restrict the entire report to this product UUID.",
            "in": "query",
            "name": "product_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "uuid",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Restrict the entire report to this product UUID.",
              "title": "Product Id"
            }
          },
          {
            "description": "First UTC date (YYYY-MM-DD), inclusive. Defaults to 29 days before to.",
            "in": "query",
            "name": "from",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "First UTC date (YYYY-MM-DD), inclusive. Defaults to 29 days before to.",
              "title": "From"
            }
          },
          {
            "description": "Last UTC date (YYYY-MM-DD), inclusive. Defaults to today.",
            "in": "query",
            "name": "to",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Last UTC date (YYYY-MM-DD), inclusive. Defaults to today.",
              "title": "To"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "text/csv": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "UTF-8 CSV attachment of aggregate report rows."
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Export publisher analytics as CSV",
        "tags": [
          "analytics"
        ]
      }
    },
    "/api/v1/api-keys": {
      "get": {
        "description": "The API keys of the organization in the environment of the request (never the other environment's), revoked ones included, oldest first. `hint` (the prefix and the first characters) recognises a key: the key itself is never returned. `created_by` is the person the key belongs to (`null` for a key made by the command line).\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `admin`.",
        "operationId": "api_keys.list",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiKeysResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1.0,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1.0,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "List the API keys",
        "tags": [
          "api_keys"
        ]
      },
      "post": {
        "description": "Create a key of the organization and of the environment of the request (`ksk_test_…` or `ksk_live_…`), with at least one right among `read`, `licences`, `catalog`, `files`, `customers` and `admin`. The key belongs to the caller (a key made by a key, to that key's person): it is revoked when that person leaves the organization or becomes a `member`. Returns `201` with the key in `key`, **the only time it is shown**: keep it at once (`Cache-Control: no-store`).\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `admin`.\n\n**Idempotency:** not supported: a request with `Idempotency-Key` is refused (`400 idempotency_not_supported`). The answer carries the new key in clear, which Keyseal never keeps, even sealed: if it was lost, find the key in `api_keys.list`, revoke it and make another.",
        "operationId": "api_keys.create",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApiKeyCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiKeyCreated"
                }
              }
            },
            "description": "Successful Response"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_not_supported": {
                    "summary": "idempotency_not_supported",
                    "value": {
                      "error": {
                        "code": "idempotency_not_supported",
                        "message": "This operation does not take an Idempotency-Key: send it without the header."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_not_supported"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1.0,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1.0,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Create an API key",
        "tags": [
          "api_keys"
        ]
      }
    },
    "/api/v1/api-keys/{key_id}": {
      "delete": {
        "description": "Revoke a key of the environment of the request at once, and withdraw the open invitations it sent. A key already revoked changes nothing more. Returns `204`.\n\n**Irreversible:** a revoked key never works again: make a new one.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `admin`.",
        "operationId": "api_keys.revoke",
        "parameters": [
          {
            "description": "The API key's id (a UUID), as api_keys.list gives it.",
            "in": "path",
            "name": "key_id",
            "required": true,
            "schema": {
              "description": "The API key's id (a UUID), as api_keys.list gives it.",
              "format": "uuid",
              "title": "Key Id",
              "type": "string"
            }
          },
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_in_progress, operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Revoke an API key",
        "tags": [
          "api_keys"
        ]
      }
    },
    "/api/v1/billing": {
      "get": {
        "description": "The plan and purchased period belong to the entire organization. Usage and reservations are measured in the selected environment. Monthly counters reset at period_end (exclusive, UTC). Divide the integer price by 10 raised to amount_exponent for display. A null limit is unmetered. A pending checkout or plan change grants no rights. operator_access identifies a complimentary edition included for an operator-owned organization. subscription_plan and status describe its ordinary subscription.\n\n**Who may call:** Any member of the organization; an API key with the right `read` (or `admin`, which implies every right).",
        "operationId": "billing.get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingOverview"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1.0,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1.0,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Read the organization's subscription, offers and quotas",
        "tags": [
          "billing"
        ]
      }
    },
    "/api/v1/billing/checkout": {
      "post": {
        "description": "Opens a private checkout for the selected edition on the platform seller's account. Use test for the sandbox profile and live for the commercial profile. Beta is free. Only verified payment events establish paid rights. Never log or share the temporary URL. For billing_outcome_unknown, a timeout, or a lost response, retry with the same request_id. billing_provider_refused closes this attempt.\n\n**Who may call:** A signed-in administrator or owner of the named organization. API keys are refused (403 forbidden).\n\n**Idempotency:** not supported: Idempotency-Key is refused (400 idempotency_not_supported). Use the body request_id for a safe retry. The private checkout URL is never saved for replay.",
        "operationId": "billing.checkout",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BillingStart"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutLocation"
                }
              }
            },
            "description": "Successful Response"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_not_supported": {
                    "summary": "idempotency_not_supported",
                    "value": {
                      "error": {
                        "code": "idempotency_not_supported",
                        "message": "This operation does not take an Idempotency-Key: send it without the header."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_not_supported"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_conflict": {
                    "summary": "billing_conflict",
                    "value": {
                      "error": {
                        "code": "billing_conflict",
                        "message": "The requested billing action is unavailable in the current state."
                      }
                    }
                  },
                  "billing_provider_refused": {
                    "summary": "billing_provider_refused",
                    "value": {
                      "error": {
                        "code": "billing_provider_refused",
                        "message": "The billing request was definitively refused."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_conflict, billing_provider_refused, operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1.0,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_outcome_unknown": {
                    "summary": "billing_outcome_unknown",
                    "value": {
                      "error": {
                        "code": "billing_outcome_unknown",
                        "message": "The provider outcome is unconfirmed. Retry the same action with its original request_id."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  },
                  "stripe_unavailable": {
                    "summary": "stripe_unavailable",
                    "value": {
                      "error": {
                        "code": "stripe_unavailable",
                        "message": "Stripe is unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_outcome_unknown, billing_unavailable, limits_unavailable, stripe_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1.0,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Open a subscription checkout for this organization",
        "tags": [
          "billing"
        ]
      }
    },
    "/api/v1/billing/subscription": {
      "post": {
        "description": "Submit a new edition or change automatic renewal. A 202 accepts the request. Check billing.get for signed confirmation. Paid access continues through its acquired period. Reuse the same request_id after billing_outcome_unknown, a timeout, or a lost response. billing_provider_refused closes this attempt.\n\n**Who may call:** A signed-in administrator or owner of the named organization. API keys are refused (403 forbidden).\n\n**Idempotency:** not supported: Idempotency-Key is refused (400 idempotency_not_supported). Use the same body request_id for an exact retry. The billing workflow tracks the change until the provider confirms its outcome.",
        "operationId": "billing.change",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BillingChangeRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingSubmitted"
                }
              }
            },
            "description": "Successful Response"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_not_supported": {
                    "summary": "idempotency_not_supported",
                    "value": {
                      "error": {
                        "code": "idempotency_not_supported",
                        "message": "This operation does not take an Idempotency-Key: send it without the header."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_not_supported"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_conflict": {
                    "summary": "billing_conflict",
                    "value": {
                      "error": {
                        "code": "billing_conflict",
                        "message": "The requested billing action is unavailable in the current state."
                      }
                    }
                  },
                  "billing_provider_refused": {
                    "summary": "billing_provider_refused",
                    "value": {
                      "error": {
                        "code": "billing_provider_refused",
                        "message": "The billing request was definitively refused."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_conflict, billing_provider_refused, operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1.0,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_outcome_unknown": {
                    "summary": "billing_outcome_unknown",
                    "value": {
                      "error": {
                        "code": "billing_outcome_unknown",
                        "message": "The provider outcome is unconfirmed. Retry the same action with its original request_id."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  },
                  "stripe_unavailable": {
                    "summary": "stripe_unavailable",
                    "value": {
                      "error": {
                        "code": "stripe_unavailable",
                        "message": "Stripe is unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_outcome_unknown, billing_unavailable, limits_unavailable, stripe_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1.0,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Change a subscription or its renewal",
        "tags": [
          "billing"
        ]
      }
    },
    "/api/v1/catalog/tax-codes": {
      "get": {
        "description": "The Stripe tax codes a product may carry: the software and services eligible for Stripe's Managed Payments, the same for every organization. `default` flags the code of a product created without `tax_code`.\n\n**Who may call:** Any member of the organization; an API key with the right `read` or `catalog` (or `admin`, which implies every right).",
        "operationId": "catalog.tax_codes.list",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaxCodesResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1.0,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1.0,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "List the tax codes a product may carry",
        "tags": [
          "catalog"
        ]
      }
    },
    "/api/v1/customers": {
      "get": {
        "description": "The customers of the environment of the request, newest first, by pages. `q` (1 to 200 characters, any case) finds the start of an address or a part of a name; a `q` with `@` looks at the start of the address only. `%` and `_` are plain text; a blank `q` is `422 invalid_request`. Each customer comes with `licences_count`, all their licences, revoked ones included.\n\n**Who may call:** Any member of the organization; an API key with the right `read` or `customers` (or `admin`, which implies every right).",
        "operationId": "customers.list",
        "parameters": [
          {
            "description": "The start of an address, or a part of a name, any case; with @, the start of the address only. Not blank.",
            "in": "query",
            "name": "q",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "minLength": 1,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "The start of an address, or a part of a name, any case; with @, the start of the address only. Not blank.",
              "title": "Q"
            }
          },
          {
            "description": "The page size, 1 to 100; 50 by default.",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "description": "The page size, 1 to 100; 50 by default.",
              "maximum": 100,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "description": "The next_cursor of the previous page; left out for the first page.",
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "The next_cursor of the previous page; left out for the first page.",
              "title": "Cursor"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomersResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "List and search the customers",
        "tags": [
          "customers"
        ]
      }
    },
    "/api/v1/customers/{customer_id}": {
      "get": {
        "description": "One customer (a UUID) with their latest 100 licences (`licences_truncated` when they have more, `licences_count` the total), their latest 20 sales (`orders_count` the total) and their latest 20 mails (`emails_count` the total). Never a licence key, nor a mail's address or text.\n\n**Who may call:** Any member of the organization; an API key with the right `read` or `customers` (or `admin`, which implies every right).",
        "operationId": "customers.get",
        "parameters": [
          {
            "description": "The customer's id (a UUID).",
            "in": "path",
            "name": "customer_id",
            "required": true,
            "schema": {
              "description": "The customer's id (a UUID).",
              "format": "uuid",
              "title": "Customer Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerDetail"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Read a customer",
        "tags": [
          "customers"
        ]
      }
    },
    "/api/v1/customers/{customer_id}/messages": {
      "post": {
        "description": "Queue a free message from the publisher to one customer of the environment: the answer to a question, a commercial gesture; not a campaign tool. `subject`: 1 to 150 characters on one line (line breaks become spaces; bidirectional and zero-width characters are refused); `body`: 1 to 5000 characters of plain text (a blank line separates paragraphs; HTML is shown as typed, never evaluated); `locale` (`fr` or `en`): the language of Keyseal's words around it, the customer's by default. The mail carries the publisher's brand, and answering it writes to `support_email`. At most 50 messages per 24 hours in the scope, and 50 per person across all their organizations, the person being the one who writes or who made the API key that writes (`429 message_limit_reached`). A processing restriction gives `403 forbidden`. A customer without an address is `409 customer_has_no_email`; without a mail provider configured, nothing is queued (`503 mail_unavailable`). Returns `202` with `email_id`; `emails.list` shows the message's subject and length, never its text.\n\n**Sends a mail:** the `publisher_message` mail to the customer, once per call.\n\n**Who may call:** Any member of the organization; an API key with the right `customers` (or `admin`, which implies every right).",
        "operationId": "customers.messages.send",
        "parameters": [
          {
            "description": "The customer's id (a UUID).",
            "in": "path",
            "name": "customer_id",
            "required": true,
            "schema": {
              "description": "The customer's id (a UUID).",
              "format": "uuid",
              "title": "Customer Id",
              "type": "string"
            }
          },
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MessageIn"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageQueued"
                }
              }
            },
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "customer_has_no_email": {
                    "summary": "customer_has_no_email",
                    "value": {
                      "error": {
                        "code": "customer_has_no_email",
                        "message": "This customer has no e-mail address to send to."
                      }
                    }
                  },
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "customer_has_no_email, idempotency_key_in_progress, operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "message_limit_reached": {
                    "summary": "message_limit_reached",
                    "value": {
                      "error": {
                        "code": "message_limit_reached",
                        "message": "This organization, or you across your organizations, sent 50 messages in the last 24 hours: try again later."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, message_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  },
                  "mail_unavailable": {
                    "summary": "mail_unavailable",
                    "value": {
                      "error": {
                        "code": "mail_unavailable",
                        "message": "No mail can be sent now: the mail service is not configured."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable, mail_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Write to one customer",
        "tags": [
          "customers"
        ]
      }
    },
    "/api/v1/discounts": {
      "get": {
        "description": "The discounts of the environment of the request made in Keyseal, newest first: their terms, how many codes they have and can be used now, and their uses. Coupons made in the Stripe Dashboard are not listed. `discounts.get` gives the codes.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `admin`.",
        "operationId": "discounts.list",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DiscountsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "List the discounts",
        "tags": [
          "discounts"
        ]
      },
      "post": {
        "description": "Create a discount, a coupon on the publisher's Stripe account: a percentage (`percent_off`, 1 to 100) or an amount (`amount_off` in minor units, with `currency`), on some products (`product_ids`, at least one, each already at Stripe: `409 discount_product_not_on_stripe` otherwise), for subscriptions during `duration` (`once`, `repeating` with `duration_months`, `forever`). A value out of these rules is `422 invalid_discount`. It has no code yet: `discounts.codes.create` makes them. Nothing is kept when Stripe does not confirm the coupon (`503 stripe_unavailable`). A suspended publisher makes none (`403 publisher_suspended`). The restricted key needs `Coupons: write` and `Promotion Codes: write`, which the connection does not require: without them, `422 stripe_permissions_missing` names them in `missing`. Returns `201` with the discount.\n\n**Irreversible:** its reduction, products and duration never change, and a discount is never deleted: only its name can be changed, and its codes deactivated.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `admin`.",
        "operationId": "discounts.create",
        "parameters": [
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DiscountCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DiscountOut"
                }
              }
            },
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "publisher_suspended": {
                    "summary": "publisher_suspended",
                    "value": {
                      "error": {
                        "code": "publisher_suspended",
                        "message": "Sales and new discounts are suspended for this publisher."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, publisher_suspended, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "discount_product_not_on_stripe": {
                    "summary": "discount_product_not_on_stripe",
                    "value": {
                      "error": {
                        "code": "discount_product_not_on_stripe",
                        "message": "A product chosen is not at Stripe yet: push the catalogue first."
                      }
                    }
                  },
                  "discount_unavailable": {
                    "summary": "discount_unavailable",
                    "value": {
                      "error": {
                        "code": "discount_unavailable",
                        "message": "This discount or code can no longer be used this way."
                      }
                    }
                  },
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  },
                  "stripe_not_connected": {
                    "summary": "stripe_not_connected",
                    "value": {
                      "error": {
                        "code": "stripe_not_connected",
                        "message": "Stripe is not connected in this environment."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "discount_product_not_on_stripe, discount_unavailable, idempotency_key_in_progress, operator_busy, stripe_not_connected"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_discount": {
                    "summary": "invalid_discount",
                    "value": {
                      "error": {
                        "code": "invalid_discount",
                        "message": "These values cannot make a discount or a code."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  },
                  "stripe_permissions_missing": {
                    "summary": "stripe_permissions_missing",
                    "value": {
                      "error": {
                        "code": "stripe_permissions_missing",
                        "message": "The restricted key lacks permissions Keyseal needs."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_discount, invalid_request, stripe_permissions_missing"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  },
                  "stripe_unavailable": {
                    "summary": "stripe_unavailable",
                    "value": {
                      "error": {
                        "code": "stripe_unavailable",
                        "message": "Stripe is unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable, stripe_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Create a discount",
        "tags": [
          "discounts"
        ]
      }
    },
    "/api/v1/discounts/codes/{code_id}": {
      "get": {
        "description": "One code (`dco_…`), checked at Stripe first: a code left `pending` (its creation not confirmed) is looked for there, never made (activating it with `discounts.codes.update` makes it), and whether it is still active is read. A pending code found active though deactivated in Keyseal, or one found after it became `unavailable`, is deactivated at Stripe. When Stripe cannot be asked (unreachable, disconnected, a right missing), the state Keyseal keeps is answered all the same, with `stripe_checked` `false` and why in `stripe_error`. Its uses (`redemptions`), newest first, by pages: when, the amount taken off, the sale, the licence and the buyer.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `admin`.",
        "operationId": "discounts.codes.get",
        "parameters": [
          {
            "description": "The discount code's id, `dco_…`.",
            "in": "path",
            "name": "code_id",
            "required": true,
            "schema": {
              "description": "The discount code's id, `dco_…`.",
              "title": "Code Id",
              "type": "string"
            }
          },
          {
            "description": "The page size, 1 to 100; 50 by default.",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "description": "The page size, 1 to 100; 50 by default.",
              "maximum": 100,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "description": "The next_cursor of the previous page; left out for the first page.",
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "The next_cursor of the previous page; left out for the first page.",
              "title": "Cursor"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DiscountCodeDetail"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "discount_code_not_found": {
                    "summary": "discount_code_not_found",
                    "value": {
                      "error": {
                        "code": "discount_code_not_found",
                        "message": "No such discount code in this organization and environment."
                      }
                    }
                  },
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "discount_code_not_found, not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Read a code and its uses",
        "tags": [
          "discounts"
        ]
      },
      "patch": {
        "description": "Activate or deactivate a code (`active`), at Stripe and in Keyseal, and change its `note` (null or empty removes it); a field left out stays as it is. A code that is expired, used up or `unavailable` cannot be activated (`409 discount_unavailable`; an unavailable one still takes a note), nor one whose text is active elsewhere on the Stripe account (`409 discount_code_taken`). A suspended publisher activates none (`403 publisher_suspended`). The restricted key needs `Coupons: write` and `Promotion Codes: write`, which the connection does not require: without them, `422 stripe_permissions_missing` names them in `missing`. Returns the code.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `admin`.",
        "operationId": "discounts.codes.update",
        "parameters": [
          {
            "description": "The discount code's id, `dco_…`.",
            "in": "path",
            "name": "code_id",
            "required": true,
            "schema": {
              "description": "The discount code's id, `dco_…`.",
              "title": "Code Id",
              "type": "string"
            }
          },
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DiscountCodeUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DiscountCodeOut"
                }
              }
            },
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "publisher_suspended": {
                    "summary": "publisher_suspended",
                    "value": {
                      "error": {
                        "code": "publisher_suspended",
                        "message": "Sales and new discounts are suspended for this publisher."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, publisher_suspended, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "discount_code_not_found": {
                    "summary": "discount_code_not_found",
                    "value": {
                      "error": {
                        "code": "discount_code_not_found",
                        "message": "No such discount code in this organization and environment."
                      }
                    }
                  },
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "discount_code_not_found, not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "discount_code_taken": {
                    "summary": "discount_code_taken",
                    "value": {
                      "error": {
                        "code": "discount_code_taken",
                        "message": "A code with this text already exists on the Stripe account."
                      }
                    }
                  },
                  "discount_unavailable": {
                    "summary": "discount_unavailable",
                    "value": {
                      "error": {
                        "code": "discount_unavailable",
                        "message": "This discount or code can no longer be used this way."
                      }
                    }
                  },
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  },
                  "stripe_not_connected": {
                    "summary": "stripe_not_connected",
                    "value": {
                      "error": {
                        "code": "stripe_not_connected",
                        "message": "Stripe is not connected in this environment."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "discount_code_taken, discount_unavailable, idempotency_key_in_progress, operator_busy, stripe_not_connected"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_discount": {
                    "summary": "invalid_discount",
                    "value": {
                      "error": {
                        "code": "invalid_discount",
                        "message": "These values cannot make a discount or a code."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  },
                  "stripe_permissions_missing": {
                    "summary": "stripe_permissions_missing",
                    "value": {
                      "error": {
                        "code": "stripe_permissions_missing",
                        "message": "The restricted key lacks permissions Keyseal needs."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_discount, invalid_request, stripe_permissions_missing"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  },
                  "stripe_unavailable": {
                    "summary": "stripe_unavailable",
                    "value": {
                      "error": {
                        "code": "stripe_unavailable",
                        "message": "Stripe is unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable, stripe_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Activate, deactivate or annotate a code",
        "tags": [
          "discounts"
        ]
      }
    },
    "/api/v1/discounts/{discount_id}": {
      "get": {
        "description": "One discount (`dsc_…`) with its codes, oldest first: their text, note, limits, `status` and number of uses, as Keyseal keeps them (`discounts.codes.get` checks one code at Stripe and lists its uses).\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `admin`.",
        "operationId": "discounts.get",
        "parameters": [
          {
            "description": "The discount's id, `dsc_…`.",
            "in": "path",
            "name": "discount_id",
            "required": true,
            "schema": {
              "description": "The discount's id, `dsc_…`.",
              "title": "Discount Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DiscountDetail"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "discount_not_found": {
                    "summary": "discount_not_found",
                    "value": {
                      "error": {
                        "code": "discount_not_found",
                        "message": "No such discount in this organization and environment."
                      }
                    }
                  },
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "discount_not_found, not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Read a discount and its codes",
        "tags": [
          "discounts"
        ]
      },
      "patch": {
        "description": "Change the name of a discount, at Stripe (which shows it to buyers) and in Keyseal; nothing else of a discount can change. A discount that is `unavailable` is `409 discount_unavailable`. The restricted key needs `Coupons: write` and `Promotion Codes: write`, which the connection does not require: without them, `422 stripe_permissions_missing` names them in `missing`. Returns the discount.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `admin`.",
        "operationId": "discounts.update",
        "parameters": [
          {
            "description": "The discount's id, `dsc_…`.",
            "in": "path",
            "name": "discount_id",
            "required": true,
            "schema": {
              "description": "The discount's id, `dsc_…`.",
              "title": "Discount Id",
              "type": "string"
            }
          },
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DiscountUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DiscountOut"
                }
              }
            },
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "discount_not_found": {
                    "summary": "discount_not_found",
                    "value": {
                      "error": {
                        "code": "discount_not_found",
                        "message": "No such discount in this organization and environment."
                      }
                    }
                  },
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "discount_not_found, not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "discount_product_not_on_stripe": {
                    "summary": "discount_product_not_on_stripe",
                    "value": {
                      "error": {
                        "code": "discount_product_not_on_stripe",
                        "message": "A product chosen is not at Stripe yet: push the catalogue first."
                      }
                    }
                  },
                  "discount_unavailable": {
                    "summary": "discount_unavailable",
                    "value": {
                      "error": {
                        "code": "discount_unavailable",
                        "message": "This discount or code can no longer be used this way."
                      }
                    }
                  },
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  },
                  "stripe_not_connected": {
                    "summary": "stripe_not_connected",
                    "value": {
                      "error": {
                        "code": "stripe_not_connected",
                        "message": "Stripe is not connected in this environment."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "discount_product_not_on_stripe, discount_unavailable, idempotency_key_in_progress, operator_busy, stripe_not_connected"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_discount": {
                    "summary": "invalid_discount",
                    "value": {
                      "error": {
                        "code": "invalid_discount",
                        "message": "These values cannot make a discount or a code."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  },
                  "stripe_permissions_missing": {
                    "summary": "stripe_permissions_missing",
                    "value": {
                      "error": {
                        "code": "stripe_permissions_missing",
                        "message": "The restricted key lacks permissions Keyseal needs."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_discount, invalid_request, stripe_permissions_missing"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  },
                  "stripe_unavailable": {
                    "summary": "stripe_unavailable",
                    "value": {
                      "error": {
                        "code": "stripe_unavailable",
                        "message": "Stripe is unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable, stripe_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Rename a discount",
        "tags": [
          "discounts"
        ]
      }
    },
    "/api/v1/discounts/{discount_id}/codes": {
      "post": {
        "description": "Make either one chosen code (`code`, kept in upper case) or a series of `count` (1 to 50) single-use codes `series_prefix-XXXXXXXX`, as promotion codes on the publisher's Stripe account. A chosen code already active on that account (which other applications may share) or already kept by Keyseal is `409 discount_code_taken`. `max_redemptions`, `expires_at` (in the future), `note` and `active` are optional. When some codes are made and the rest is stopped (Stripe unreachable, a lost answer), the answer is `201` with the codes made in `created` and why in `failed`: ask again for the rest, as a new request (the same `Idempotency-Key` answers the same partial result again). A refusal with nothing made is an error. A suspended publisher makes none (`403 publisher_suspended`). The restricted key needs `Coupons: write` and `Promotion Codes: write`, which the connection does not require: without them, `422 stripe_permissions_missing` names them in `missing`.\n\n**Irreversible:** a code's text, end date and number of uses never change, and a code is never deleted: it can only be deactivated.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `admin`.",
        "operationId": "discounts.codes.create",
        "parameters": [
          {
            "description": "The discount's id, `dsc_…`.",
            "in": "path",
            "name": "discount_id",
            "required": true,
            "schema": {
              "description": "The discount's id, `dsc_…`.",
              "title": "Discount Id",
              "type": "string"
            }
          },
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DiscountCodesCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DiscountCodesCreated"
                }
              }
            },
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "publisher_suspended": {
                    "summary": "publisher_suspended",
                    "value": {
                      "error": {
                        "code": "publisher_suspended",
                        "message": "Sales and new discounts are suspended for this publisher."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, publisher_suspended, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "discount_not_found": {
                    "summary": "discount_not_found",
                    "value": {
                      "error": {
                        "code": "discount_not_found",
                        "message": "No such discount in this organization and environment."
                      }
                    }
                  },
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "discount_not_found, not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "discount_code_taken": {
                    "summary": "discount_code_taken",
                    "value": {
                      "error": {
                        "code": "discount_code_taken",
                        "message": "A code with this text already exists on the Stripe account."
                      }
                    }
                  },
                  "discount_product_not_on_stripe": {
                    "summary": "discount_product_not_on_stripe",
                    "value": {
                      "error": {
                        "code": "discount_product_not_on_stripe",
                        "message": "A product chosen is not at Stripe yet: push the catalogue first."
                      }
                    }
                  },
                  "discount_unavailable": {
                    "summary": "discount_unavailable",
                    "value": {
                      "error": {
                        "code": "discount_unavailable",
                        "message": "This discount or code can no longer be used this way."
                      }
                    }
                  },
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  },
                  "stripe_not_connected": {
                    "summary": "stripe_not_connected",
                    "value": {
                      "error": {
                        "code": "stripe_not_connected",
                        "message": "Stripe is not connected in this environment."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "discount_code_taken, discount_product_not_on_stripe, discount_unavailable, idempotency_key_in_progress, operator_busy, stripe_not_connected"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_discount": {
                    "summary": "invalid_discount",
                    "value": {
                      "error": {
                        "code": "invalid_discount",
                        "message": "These values cannot make a discount or a code."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  },
                  "stripe_permissions_missing": {
                    "summary": "stripe_permissions_missing",
                    "value": {
                      "error": {
                        "code": "stripe_permissions_missing",
                        "message": "The restricted key lacks permissions Keyseal needs."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_discount, invalid_request, stripe_permissions_missing"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  },
                  "stripe_unavailable": {
                    "summary": "stripe_unavailable",
                    "value": {
                      "error": {
                        "code": "stripe_unavailable",
                        "message": "Stripe is unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable, stripe_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Create codes of a discount",
        "tags": [
          "discounts"
        ]
      }
    },
    "/api/v1/email-templates": {
      "get": {
        "description": "The publisher's words (subject, introduction, conclusion) in every editable kind of mail to buyers (`licence_issued`, `renewal_confirmed`, `renewal_link`, `payment_failed`, `licence_revoked`, `licence_suspended`, `licence_reinstated`), in both languages, always in the same order, for the environment of the request (a text is tried in `test` without touching `live`). Each comes with its `variables` (the names allowed between `{{` and `}}`), Keyseal's own text in `default` as the buyer would read it with sample data (to read, not to save back), and the publisher's in `custom` (`null` for none). A text holds for every cause of its kind: the `licence_revoked` text also goes out for a Stripe refund or a lost dispute, the `licence_suspended` one for an opened dispute.\n\n**Who may call:** Any member of the organization; an API key with the right `read` (or `admin`, which implies every right).",
        "operationId": "emails.templates.list",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TemplatesResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1.0,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1.0,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "List the texts of the mails to buyers",
        "tags": [
          "emails"
        ]
      }
    },
    "/api/v1/email-templates/{kind}/preview": {
      "post": {
        "description": "Render a mail of one editable kind with the zones of the body (`locale` required; a zone left out or blank: Keyseal's text; the saved texts are not read), the brand of the scope and sample data: a made-up buyer, product and plan, the dummy key `DEMO-XXXXX-XXXXX-XXXXX-XXXXX`, links that all lead to the customer area. Never a real licence nor a link carrying a token; in `test` the subject carries `[TEST]`, as the real mail does. Nothing is written and nothing is sent. Returns `subject`, `html` and `text`.\n\n**Who may call:** Any member of the organization; an API key with the right `read` (or `admin`, which implies every right).\n\n**Idempotency:** this POST only reads, it changes nothing: retrying it is safe, and an `Idempotency-Key` is ignored (nothing is kept, no answer replayed).",
        "operationId": "emails.templates.preview",
        "parameters": [
          {
            "description": "An editable kind of mail: `licence_issued`, `renewal_confirmed`, `renewal_link`, `payment_failed`, `licence_revoked`, `licence_suspended` or `licence_reinstated`. The fixed `updates_ending` notice and other non-editable kinds return `404 not_found`.",
            "in": "path",
            "name": "kind",
            "required": true,
            "schema": {
              "description": "An editable kind of mail: `licence_issued`, `renewal_confirmed`, `renewal_link`, `payment_failed`, `licence_revoked`, `licence_suspended` or `licence_reinstated`. The fixed `updates_ending` notice and other non-editable kinds return `404 not_found`.",
              "title": "Kind",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PreviewIn"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PreviewOut"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  },
                  "invalid_template": {
                    "summary": "invalid_template",
                    "value": {
                      "error": {
                        "code": "invalid_template",
                        "message": "This text names something that is not a variable of this mail ({{ name }} with a name from its list)."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request, invalid_template"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Preview a mail with given texts",
        "tags": [
          "emails"
        ]
      }
    },
    "/api/v1/email-templates/{kind}/{locale}": {
      "delete": {
        "description": "Delete the publisher's text of one kind and language: the mails of that kind carry Keyseal's text again. Nothing to delete is not an error. Returns `204`.\n\n**Irreversible:** the publisher's text is deleted: to have it back, write it again.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `admin`.",
        "operationId": "emails.templates.reset",
        "parameters": [
          {
            "description": "An editable kind of mail: `licence_issued`, `renewal_confirmed`, `renewal_link`, `payment_failed`, `licence_revoked`, `licence_suspended` or `licence_reinstated`. The fixed `updates_ending` notice and other non-editable kinds return `404 not_found`.",
            "in": "path",
            "name": "kind",
            "required": true,
            "schema": {
              "description": "An editable kind of mail: `licence_issued`, `renewal_confirmed`, `renewal_link`, `payment_failed`, `licence_revoked`, `licence_suspended` or `licence_reinstated`. The fixed `updates_ending` notice and other non-editable kinds return `404 not_found`.",
              "title": "Kind",
              "type": "string"
            }
          },
          {
            "description": "The language of the text: `fr` or `en` (any other is `404 not_found`).",
            "in": "path",
            "name": "locale",
            "required": true,
            "schema": {
              "description": "The language of the text: `fr` or `en` (any other is `404 not_found`).",
              "title": "Locale",
              "type": "string"
            }
          },
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_in_progress, operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Put back Keyseal's text of a kind of mail",
        "tags": [
          "emails"
        ]
      },
      "put": {
        "description": "Write the publisher's three zones of one editable kind (`{kind}`) and language (`{locale}`: `fr` or `en`) at once: `subject` (150 characters at most, on one line), `intro` and `outro` (2000 characters at most each, paragraphs apart by a blank line). A zone left out or blank keeps Keyseal's text, and three blank zones are Keyseal's text again (as `emails.templates.reset`). A zone naming between `{{` and `}}` what is not a variable of its kind is `422 invalid_template` (`zone` and `variable` say which). Non-editable kinds (including `updates_ending`) and unknown languages return `404 not_found`. Returns the template, as `emails.templates.list` gives it.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `admin`.",
        "operationId": "emails.templates.save",
        "parameters": [
          {
            "description": "An editable kind of mail: `licence_issued`, `renewal_confirmed`, `renewal_link`, `payment_failed`, `licence_revoked`, `licence_suspended` or `licence_reinstated`. The fixed `updates_ending` notice and other non-editable kinds return `404 not_found`.",
            "in": "path",
            "name": "kind",
            "required": true,
            "schema": {
              "description": "An editable kind of mail: `licence_issued`, `renewal_confirmed`, `renewal_link`, `payment_failed`, `licence_revoked`, `licence_suspended` or `licence_reinstated`. The fixed `updates_ending` notice and other non-editable kinds return `404 not_found`.",
              "title": "Kind",
              "type": "string"
            }
          },
          {
            "description": "The language of the text: `fr` or `en` (any other is `404 not_found`).",
            "in": "path",
            "name": "locale",
            "required": true,
            "schema": {
              "description": "The language of the text: `fr` or `en` (any other is `404 not_found`).",
              "title": "Locale",
              "type": "string"
            }
          },
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TextsIn"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TemplateOut"
                }
              }
            },
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_in_progress, operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  },
                  "invalid_template": {
                    "summary": "invalid_template",
                    "value": {
                      "error": {
                        "code": "invalid_template",
                        "message": "This text names something that is not a variable of this mail ({{ name }} with a name from its list)."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_request, invalid_template"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Write the texts of a kind of mail",
        "tags": [
          "emails"
        ]
      }
    },
    "/api/v1/emails": {
      "get": {
        "description": "The mails to buyers of the environment of the request, newest first, by pages, filtered by `licence_id` (`lic_…`) and `customer_id`: their kind, their status (`queued`, `sending`, `sent`, `delivered`, `bounced`, `complained`, `failed`, `expired`), when they were made and sent, their last error. Never the address (`recipient_ref` is a digest of it) nor the text; a free message (`publisher_message`) shows its `subject` and `body_length`. The invitations of members are not here (`members.invitations.list`).\n\n**Who may call:** Any member of the organization; an API key with the right `read` or `licences` (or `admin`, which implies every right).",
        "operationId": "emails.list",
        "parameters": [
          {
            "description": "The mails about this licence, lic_…",
            "in": "query",
            "name": "licence_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 40,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "The mails about this licence, lic_…",
              "title": "Licence Id"
            }
          },
          {
            "description": "The mails to this customer.",
            "in": "query",
            "name": "customer_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "uuid",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "The mails to this customer.",
              "title": "Customer Id"
            }
          },
          {
            "description": "The page size, 1 to 100; 50 by default.",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "description": "The page size, 1 to 100; 50 by default.",
              "maximum": 100,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "description": "The next_cursor of the previous page; left out for the first page.",
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "The next_cursor of the previous page; left out for the first page.",
              "title": "Cursor"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Read the journal of the mails to buyers",
        "tags": [
          "emails"
        ]
      }
    },
    "/api/v1/events": {
      "get": {
        "description": "The journal of every licence of the environment of the request, newest first, by pages, filtered by `kind` (`issued`, `activated`, `status_changed`, `subscription_linked`…) and `licence_id` (`lic_…`). Each event as `licences.events.list` gives it.\n\n**Who may call:** Any member of the organization; an API key with the right `read` or `licences` (or `admin`, which implies every right).",
        "operationId": "events.list",
        "parameters": [
          {
            "description": "The events of this kind: issued, activated, status_changed...",
            "in": "query",
            "name": "kind",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "minLength": 1,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "The events of this kind: issued, activated, status_changed...",
              "title": "Kind"
            }
          },
          {
            "description": "The events of this licence, lic_…",
            "in": "query",
            "name": "licence_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 40,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "The events of this licence, lic_…",
              "title": "Licence Id"
            }
          },
          {
            "description": "The page size, 1 to 100; 50 by default.",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "description": "The page size, 1 to 100; 50 by default.",
              "maximum": 100,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "description": "The next_cursor of the previous page; left out for the first page.",
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "The next_cursor of the previous page; left out for the first page.",
              "title": "Cursor"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Read the journal of every licence",
        "tags": [
          "events"
        ]
      }
    },
    "/api/v1/files/{file_id}": {
      "delete": {
        "description": "Delete a file (`fil_…`), its object erased from the store once the deletion is committed. The last `ready` file of a published release is not deleted (`409 release_has_no_ready_file`): unpublish the release first, or delete it. Returns `204`.\n\n**Irreversible:** the file and its object are deleted for good.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `files` (or `admin`, which implies every right).",
        "operationId": "releases.files.delete",
        "parameters": [
          {
            "description": "The file's id, `fil_…`.",
            "in": "path",
            "name": "file_id",
            "required": true,
            "schema": {
              "description": "The file's id, `fil_…`.",
              "title": "File Id",
              "type": "string"
            }
          },
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  },
                  "release_has_no_ready_file": {
                    "summary": "release_has_no_ready_file",
                    "value": {
                      "error": {
                        "code": "release_has_no_ready_file",
                        "message": "A published release keeps at least one uploaded file."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_in_progress, operator_busy, release_has_no_ready_file"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  },
                  "storage_unavailable": {
                    "summary": "storage_unavailable",
                    "value": {
                      "error": {
                        "code": "storage_unavailable",
                        "message": "File storage is unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable, storage_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Delete a file of a release",
        "tags": [
          "releases"
        ]
      }
    },
    "/api/v1/files/{file_id}/complete": {
      "post": {
        "description": "Step 3 of sending a file (`fil_…`): Keyseal reads the object in the store; present and of the declared size, the file becomes `ready`, served to buyers once its release is published. Otherwise `409 file_upload_incomplete`, and the file stays `pending`, never served. Returns the file.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `files` (or `admin`, which implies every right).",
        "operationId": "releases.files.complete_upload",
        "parameters": [
          {
            "description": "The file's id, `fil_…`.",
            "in": "path",
            "name": "file_id",
            "required": true,
            "schema": {
              "description": "The file's id, `fil_…`.",
              "title": "File Id",
              "type": "string"
            }
          },
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileOut"
                }
              }
            },
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "file_upload_incomplete": {
                    "summary": "file_upload_incomplete",
                    "value": {
                      "error": {
                        "code": "file_upload_incomplete",
                        "message": "The file is not in storage yet, or its size is not the size declared."
                      }
                    }
                  },
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "file_upload_incomplete, idempotency_key_in_progress, operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  },
                  "storage_unavailable": {
                    "summary": "storage_unavailable",
                    "value": {
                      "error": {
                        "code": "storage_unavailable",
                        "message": "File storage is unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable, storage_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Complete the upload of a file",
        "tags": [
          "releases"
        ]
      }
    },
    "/api/v1/imports": {
      "get": {
        "description": "The imports of the environment of the request, the most recent first, without their report. `status`: `queued`, `running`, `done`, `failed` (`last_error` says why: `ls_key_invalid`, `ls_store_not_found`, `ls_network`, `ls_rate_limited`…) or `finished`.\n\n**Who may call:** Any member of the organization; an API key with the right `read` (or `admin`, which implies every right).",
        "operationId": "imports.list",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImportsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1.0,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1.0,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "List the imports",
        "tags": [
          "imports"
        ]
      }
    },
    "/api/v1/imports/lemonsqueezy": {
      "post": {
        "description": "Import a Lemon Squeezy store into the environment of the request: its products, variants, customers, orders, licence keys and instances. Body: the store's Lemon Squeezy `api_key` and its `store_id` (a number or a string). Keyseal asks Lemon Squeezy for the store before writing anything (`422 ls_key_invalid`, `422 ls_store_not_found`, `503 ls_unavailable`), then queues the import: the worker runs it, and it can be replayed until it is finished. An environment has one unfinished import at a time (`409 import_running`). The key is sealed for the time of the import, never returned (only `key_hint`, its last 4 characters), and erased by `imports.finish`. Returns `202` with the import, `queued`: follow it with `imports.get`.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `admin`.",
        "operationId": "imports.start",
        "parameters": [
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImportStart"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImportDetail"
                }
              }
            },
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "import_running": {
                    "summary": "import_running",
                    "value": {
                      "error": {
                        "code": "import_running",
                        "message": "An import of this environment is not finished yet: replay it or finish it first."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_in_progress, import_running, operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  },
                  "ls_key_invalid": {
                    "summary": "ls_key_invalid",
                    "value": {
                      "error": {
                        "code": "ls_key_invalid",
                        "message": "Lemon Squeezy refuses this API key, or this is not one."
                      }
                    }
                  },
                  "ls_store_not_found": {
                    "summary": "ls_store_not_found",
                    "value": {
                      "error": {
                        "code": "ls_store_not_found",
                        "message": "Lemon Squeezy shows no store with this id to this API key."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_request, ls_key_invalid, ls_store_not_found"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  },
                  "ls_unavailable": {
                    "summary": "ls_unavailable",
                    "value": {
                      "error": {
                        "code": "ls_unavailable",
                        "message": "Lemon Squeezy is unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable, ls_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Start the import of a Lemon Squeezy store",
        "tags": [
          "imports"
        ]
      }
    },
    "/api/v1/imports/{import_id}": {
      "get": {
        "description": "One import (`imp_…`) with its `report`: the counts per type, the objects skipped with their reason (`key_exists`, `key_exists_other_environment`…) and the actions left to the publisher. Once finished, the report also has `unlinked_subscriptions` and, if a run was under way, `interrupted: true`.\n\n**Who may call:** Any member of the organization; an API key with the right `read` (or `admin`, which implies every right).",
        "operationId": "imports.get",
        "parameters": [
          {
            "description": "The import's id, `imp_…`.",
            "in": "path",
            "name": "import_id",
            "required": true,
            "schema": {
              "description": "The import's id, `imp_…`.",
              "title": "Import Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImportDetail"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Read an import and its report",
        "tags": [
          "imports"
        ]
      }
    },
    "/api/v1/imports/{import_id}/finish": {
      "post": {
        "description": "End the import: its sealed Lemon Squeezy key is erased and it is never replayed again; a run under way stops at its next batch. The report stays, with `unlinked_subscriptions` (the imported subscription licences with neither an end nor a linked Stripe subscription: nothing stops them any more) and `interrupted: true` if a run was under way. Already finished: `409 import_finished`. Returns the import, `finished`.\n\n**Irreversible:** a finished import is never replayed, and its Lemon Squeezy key is erased.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `admin`.",
        "operationId": "imports.finish",
        "parameters": [
          {
            "description": "The import's id, `imp_…`.",
            "in": "path",
            "name": "import_id",
            "required": true,
            "schema": {
              "description": "The import's id, `imp_…`.",
              "title": "Import Id",
              "type": "string"
            }
          },
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImportDetail"
                }
              }
            },
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "import_finished": {
                    "summary": "import_finished",
                    "value": {
                      "error": {
                        "code": "import_finished",
                        "message": "This import is finished: start a new one."
                      }
                    }
                  },
                  "import_running": {
                    "summary": "import_running",
                    "value": {
                      "error": {
                        "code": "import_running",
                        "message": "An import of this environment is not finished yet: replay it or finish it first."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_in_progress, import_finished, import_running, operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Finish an import for good",
        "tags": [
          "imports"
        ]
      }
    },
    "/api/v1/imports/{import_id}/replay": {
      "post": {
        "description": "Queue a `done` or `failed` import again: the next run follows what changed at Lemon Squeezy, doubling nothing. It rewrites from Lemon Squeezy the status of the licences it imported (but those linked to their Stripe subscription), so a suspension made by hand may be undone. Queued or running: `409 import_running`; finished: `409 import_finished`. Returns `202` with the import, `queued`, without the `last_error`, `started_at` and `ended_at` of the previous run.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `admin`.",
        "operationId": "imports.replay",
        "parameters": [
          {
            "description": "The import's id, `imp_…`.",
            "in": "path",
            "name": "import_id",
            "required": true,
            "schema": {
              "description": "The import's id, `imp_…`.",
              "title": "Import Id",
              "type": "string"
            }
          },
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImportDetail"
                }
              }
            },
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "import_finished": {
                    "summary": "import_finished",
                    "value": {
                      "error": {
                        "code": "import_finished",
                        "message": "This import is finished: start a new one."
                      }
                    }
                  },
                  "import_running": {
                    "summary": "import_running",
                    "value": {
                      "error": {
                        "code": "import_running",
                        "message": "An import of this environment is not finished yet: replay it or finish it first."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_in_progress, import_finished, import_running, operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Replay an import",
        "tags": [
          "imports"
        ]
      }
    },
    "/api/v1/imports/{import_id}/subscription-matches": {
      "get": {
        "description": "For an import `done` or `finished` (otherwise `409 import_running`): pairs of a subscription that Stripe's migration tool made again on the connected account and an imported subscription licence, matched by the holder's address and by the product of the subscription's price. Stripe is read and nothing is written: nothing is linked until `imports.matches.confirm`. Each pair has a signed `match_id`, `confirmable`, and a `reason`: `same_email_same_product`; `expired_at_ls` (a licence Lemon Squeezy ended once its subscription left, which linking makes `active` again); `price_without_plan` (a price of no Keyseal plan: `plan` is `null`, the pair is not confirmable). `truncated`: more than 10,000 active subscriptions, the rest not read.\n\n**Who may call:** Any member of the organization; an API key with the right `read` (or `admin`, which implies every right).",
        "operationId": "imports.matches.list",
        "parameters": [
          {
            "description": "The import's id, `imp_…`.",
            "in": "path",
            "name": "import_id",
            "required": true,
            "schema": {
              "description": "The import's id, `imp_…`.",
              "title": "Import Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MatchesResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "import_running": {
                    "summary": "import_running",
                    "value": {
                      "error": {
                        "code": "import_running",
                        "message": "An import of this environment is not finished yet: replay it or finish it first."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  },
                  "stripe_not_connected": {
                    "summary": "stripe_not_connected",
                    "value": {
                      "error": {
                        "code": "stripe_not_connected",
                        "message": "Stripe is not connected in this environment."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "import_running, operator_busy, stripe_not_connected"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  },
                  "stripe_key_invalid": {
                    "summary": "stripe_key_invalid",
                    "value": {
                      "error": {
                        "code": "stripe_key_invalid",
                        "message": "This is not a valid Stripe restricted key, or Stripe does not know it."
                      }
                    }
                  },
                  "stripe_permissions_missing": {
                    "summary": "stripe_permissions_missing",
                    "value": {
                      "error": {
                        "code": "stripe_permissions_missing",
                        "message": "The restricted key lacks permissions Keyseal needs."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request, stripe_key_invalid, stripe_permissions_missing"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  },
                  "stripe_unavailable": {
                    "summary": "stripe_unavailable",
                    "value": {
                      "error": {
                        "code": "stripe_unavailable",
                        "message": "Stripe is unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable, stripe_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Propose the Stripe subscriptions to link to imported licences",
        "tags": [
          "imports"
        ]
      }
    },
    "/api/v1/imports/{import_id}/subscription-matches/confirm": {
      "post": {
        "description": "Link the pairs named by `match_ids` (1 to 50, from `imports.matches.list`), each on its own, in the order given. Each pair is read again, in Keyseal then at Stripe, and refused if either side changed since the proposal. A linked licence follows its Stripe subscription from then on: it ends with the subscription's current period (plus 3 days of grace while it runs), an `expired` or `suspended` one becomes `active`, the next invoice extends it; Keyseal then sets its metadata (`app=keyseal`, `keyseal_*`) on the subscription at Stripe. Returns one result per pair: `outcome` `linked`, `already_linked`, `stale` (read the proposals again), `not_confirmable`, or `failed` (Stripe unreachable, its key refused or a permission missing: the following pairs are not tried), with its `code`; `tag_pending: true` when Stripe did not take the metadata yet (confirm the same pair again).\n\n**Irreversible:** no operation of this API unlinks a licence from its subscription.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `admin`.",
        "operationId": "imports.matches.confirm",
        "parameters": [
          {
            "description": "The import's id, `imp_…`.",
            "in": "path",
            "name": "import_id",
            "required": true,
            "schema": {
              "description": "The import's id, `imp_…`.",
              "title": "Import Id",
              "type": "string"
            }
          },
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MatchConfirm"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConfirmResponse"
                }
              }
            },
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "import_running": {
                    "summary": "import_running",
                    "value": {
                      "error": {
                        "code": "import_running",
                        "message": "An import of this environment is not finished yet: replay it or finish it first."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  },
                  "stripe_not_connected": {
                    "summary": "stripe_not_connected",
                    "value": {
                      "error": {
                        "code": "stripe_not_connected",
                        "message": "Stripe is not connected in this environment."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_in_progress, import_running, operator_busy, stripe_not_connected"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Link proposed subscriptions to their licences",
        "tags": [
          "imports"
        ]
      }
    },
    "/api/v1/invitations/accept": {
      "post": {
        "description": "Accept the invitation whose `token` the console read from the link of its mail (`/app/invitations#<token>`). Keyseal reads the current verified primary address from Clerk for the signed-in user ID. It must match the invitation address. A mismatch gives `403 invitation_email_mismatch` and leaves the invitation open. The person joins with the invited role. An existing member keeps their role. A successful acceptance consumes the invitation. Unknown, expired, already accepted or withdrawn: `404 invitation_invalid`, one answer for all. Returns the organization (`slug`, `name`) and the role.\n\n**Who may call:** A person signed in with Clerk, without the organization headers. API keys are refused (`403 forbidden`): this is for a person.\n\n**Idempotency:** not supported: a request with `Idempotency-Key` is refused (`400 idempotency_not_supported`). The invitation's token is good once: a retry answers `404 invitation_invalid`, and `account.me` shows the organization joined.",
        "operationId": "account.invitations.accept",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InvitationAccept"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvitationAccepted"
                }
              }
            },
            "description": "Successful Response"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_not_supported": {
                    "summary": "idempotency_not_supported",
                    "value": {
                      "error": {
                        "code": "idempotency_not_supported",
                        "message": "This operation does not take an Idempotency-Key: send it without the header."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_not_supported"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "email_unverified": {
                    "summary": "email_unverified",
                    "value": {
                      "error": {
                        "code": "email_unverified",
                        "message": "Verify the primary e-mail address of your account, then sign in again."
                      }
                    }
                  },
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "invitation_email_mismatch": {
                    "summary": "invitation_email_mismatch",
                    "value": {
                      "error": {
                        "code": "invitation_email_mismatch",
                        "message": "This invitation is for another e-mail address than the one of your account."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "email_unverified, forbidden, invitation_email_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "invitation_invalid": {
                    "summary": "invitation_invalid",
                    "value": {
                      "error": {
                        "code": "invitation_invalid",
                        "message": "This invitation is not valid: it may have expired or been used."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invitation_invalid"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1.0,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1.0,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Accept an invitation",
        "tags": [
          "account"
        ]
      }
    },
    "/api/v1/licences": {
      "get": {
        "description": "The licences of the environment of the request, newest first, by pages (`limit`, `cursor`). Filters, combined: `email` (the customer's whole address, any case); `product_id`, `plan_id`, `customer_id`; `status`, the stored status (`active`, `suspended`, `revoked`, `expired`); `state`, what the licence is now (`revoked`, else `suspended`, else `expired` when its status is `expired` or its `valid_until` has passed, else `active`): a licence whose paid period ended keeps `status=active` and is `state=expired`; `q`, either a whole licence key (found by its digest, never by a piece of it) or the start of the holder's address, any case (blank: `422 invalid_request`). No answer carries a licence key, only its last 4 characters (`key_last4`).\n\n**Who may call:** Any member of the organization; an API key with the right `read` or `licences` (or `admin`, which implies every right).",
        "operationId": "licences.list",
        "parameters": [
          {
            "description": "The licences of the customer of this whole address, any case.",
            "in": "query",
            "name": "email",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 320,
                  "minLength": 1,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "The licences of the customer of this whole address, any case.",
              "title": "Email"
            }
          },
          {
            "description": "The licences of this product.",
            "in": "query",
            "name": "product_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "uuid",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "The licences of this product.",
              "title": "Product Id"
            }
          },
          {
            "description": "The licences of this plan.",
            "in": "query",
            "name": "plan_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "uuid",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "The licences of this plan.",
              "title": "Plan Id"
            }
          },
          {
            "description": "The licences of this customer.",
            "in": "query",
            "name": "customer_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "uuid",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "The licences of this customer.",
              "title": "Customer Id"
            }
          },
          {
            "description": "The stored status: active, suspended, revoked or expired. A licence whose paid period ended keeps active: filter on state for what it is now.",
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/LicenceStatus"
                },
                {
                  "type": "null"
                }
              ],
              "description": "The stored status: active, suspended, revoked or expired. A licence whose paid period ended keeps active: filter on state for what it is now.",
              "title": "Status"
            }
          },
          {
            "description": "What the licence is now: active, expired (status expired, or valid_until passed), suspended or revoked.",
            "in": "query",
            "name": "state",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/LicenceState"
                },
                {
                  "type": "null"
                }
              ],
              "description": "What the licence is now: active, expired (status expired, or valid_until passed), suspended or revoked.",
              "title": "State"
            }
          },
          {
            "description": "A whole licence key (found by its digest, never by a piece), or the start of the holder's address, any case; not blank.",
            "in": "query",
            "name": "q",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 320,
                  "minLength": 1,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "A whole licence key (found by its digest, never by a piece), or the start of the holder's address, any case; not blank.",
              "title": "Q"
            }
          },
          {
            "description": "The page size, 1 to 100; 50 by default.",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "description": "The page size, 1 to 100; 50 by default.",
              "maximum": 100,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "description": "The next_cursor of the previous page; left out for the first page.",
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "The next_cursor of the previous page; left out for the first page.",
              "title": "Cursor"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LicencesResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "List and search the licences",
        "tags": [
          "licences"
        ]
      }
    },
    "/api/v1/licences/{licence_id}": {
      "get": {
        "description": "One licence (`lic_…`) with its active machines (`activations`), and in `subscription` the Stripe subscription that pays for it as Stripe last told Keyseal (`null` when none does; `stripe_dashboard_url` leads to it). `open_dispute` is `true` while an order of the licence is under an open Stripe dispute (reinstating it is then refused); `status_before_suspension` is the status it had before its last suspension (`null` if Keyseal never suspended it). Never the key: only `key_last4`.\n\n**Who may call:** Any member of the organization; an API key with the right `read` or `licences` (or `admin`, which implies every right).",
        "operationId": "licences.get",
        "parameters": [
          {
            "description": "The licence's id, `lic_…`.",
            "in": "path",
            "name": "licence_id",
            "required": true,
            "schema": {
              "description": "The licence's id, `lic_…`.",
              "title": "Licence Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LicenceDetail"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Read a licence",
        "tags": [
          "licences"
        ]
      }
    },
    "/api/v1/licences/{licence_id}/activations/{activation_id}/release": {
      "post": {
        "description": "Free the seat of one machine (`act_…`) of the licence for another machine; the licence's journal says so (`activation_released`, naming the caller). A machine no longer active (a revoked licence's among them) changes nothing; one of another licence is `404 not_found`. Returns `204`.\n\n**Who may call:** Any member of the organization; an API key with the right `licences` (or `admin`, which implies every right).",
        "operationId": "licences.activations.release",
        "parameters": [
          {
            "description": "The licence's id, `lic_…`.",
            "in": "path",
            "name": "licence_id",
            "required": true,
            "schema": {
              "description": "The licence's id, `lic_…`.",
              "title": "Licence Id",
              "type": "string"
            }
          },
          {
            "description": "The machine's activation id, `act_…`.",
            "in": "path",
            "name": "activation_id",
            "required": true,
            "schema": {
              "description": "The machine's activation id, `act_…`.",
              "title": "Activation Id",
              "type": "string"
            }
          },
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_in_progress, operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Release a machine of a licence",
        "tags": [
          "licences"
        ]
      }
    },
    "/api/v1/licences/{licence_id}/events": {
      "get": {
        "description": "The journal of one licence (`lic_…`), newest first, by pages: what happened (`kind`), when, by whom (`actor`: `user:<id>`, `api_key:<id>`, `stripe:<event>`, `import:imp_…`, `customer:<id>`, `client`, `ls-compat`, `cli`), and `data`, shown through a list of keys per kind: never a licence key, a token or an address.\n\n**Who may call:** Any member of the organization; an API key with the right `read` or `licences` (or `admin`, which implies every right).",
        "operationId": "licences.events.list",
        "parameters": [
          {
            "description": "The licence's id, `lic_…`.",
            "in": "path",
            "name": "licence_id",
            "required": true,
            "schema": {
              "description": "The licence's id, `lic_…`.",
              "title": "Licence Id",
              "type": "string"
            }
          },
          {
            "description": "The page size, 1 to 100; 50 by default.",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "description": "The page size, 1 to 100; 50 by default.",
              "maximum": 100,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "description": "The next_cursor of the previous page; left out for the first page.",
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "The next_cursor of the previous page; left out for the first page.",
              "title": "Cursor"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Read the journal of a licence",
        "tags": [
          "licences"
        ]
      }
    },
    "/api/v1/licences/{licence_id}/reinstate": {
      "post": {
        "description": "Lift the licence's suspension: it gets back the status it had before (`active`, or `expired` for a licence suspended after it expired). The body (`notify`) may be left out. An open Stripe dispute on an order of the licence is `409 licence_dispute_open`; a revoked licence is `409 licence_revoked`; a licence that is not suspended answers `200` with `changed: false`, nothing written or sent. A licence whose paid period ended while it was suspended comes back `active` with its `valid_until` passed, still unusable. Returns the licence as `licences.get` gives it, with `changed`.\n\n**Sends a mail:** only with `notify: true`, if the status changed and the licence is usable now (`active`, its `valid_until` empty or to come): the `licence_reinstated` mail to the holder.\n\n**Who may call:** Any member of the organization; an API key with the right `licences` (or `admin`, which implies every right).",
        "operationId": "licences.reinstate",
        "parameters": [
          {
            "description": "The licence's id, `lic_…`.",
            "in": "path",
            "name": "licence_id",
            "required": true,
            "schema": {
              "description": "The licence's id, `lic_…`.",
              "title": "Licence Id",
              "type": "string"
            }
          },
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/Reinstatement"
                  },
                  {
                    "type": "null"
                  }
                ],
                "title": "Body"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LicenceChanged"
                }
              }
            },
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "licence_dispute_open": {
                    "summary": "licence_dispute_open",
                    "value": {
                      "error": {
                        "code": "licence_dispute_open",
                        "message": "A Stripe dispute on this licence is still open; a dispute won gives the licence back the status it had before the dispute."
                      }
                    }
                  },
                  "licence_revoked": {
                    "summary": "licence_revoked",
                    "value": {
                      "error": {
                        "code": "licence_revoked",
                        "message": "This licence is revoked: nothing changes it any more."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_in_progress, licence_dispute_open, licence_revoked, operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Reinstate a suspended licence",
        "tags": [
          "licences"
        ]
      }
    },
    "/api/v1/licences/{licence_id}/renewal-link": {
      "post": {
        "description": "A link by which the customer renews the licence (`lic_…`) with a `renewal` plan of its product (`plan_id`): valid 30 days, usable as many times as wanted, in the customer's language (with `environment=test` for a licence of test). Nothing is written and Stripe is not called: the payment opens when the link is followed. A plan that does not renew this licence (not a `renewal` plan, another product's, a subscription's licence or one whose plan has no updates, a revoked licence) is `404 not_for_sale`. With `send: true` the link also goes by mail to the customer and the answer carries `email_id`; a customer without an address is `409 customer_has_no_email`, and nothing is queued. Returns `url` and `expires_at`, never cached: the link is a capability.\n\n**Sends a mail:** with `send: true` only: the `renewal_link` mail to the customer, once per call.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `licences` (or `admin`, which implies every right).",
        "operationId": "licences.renewal_links.create",
        "parameters": [
          {
            "description": "The licence's id, `lic_…`.",
            "in": "path",
            "name": "licence_id",
            "required": true,
            "schema": {
              "description": "The licence's id, `lic_…`.",
              "title": "Licence Id",
              "type": "string"
            }
          },
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RenewalLinkCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RenewalLinkOut"
                }
              }
            },
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_for_sale": {
                    "summary": "not_for_sale",
                    "value": {
                      "error": {
                        "code": "not_for_sale",
                        "message": "This plan does not renew this licence."
                      }
                    }
                  },
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_for_sale, not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "customer_has_no_email": {
                    "summary": "customer_has_no_email",
                    "value": {
                      "error": {
                        "code": "customer_has_no_email",
                        "message": "This customer has no e-mail address to send to."
                      }
                    }
                  },
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "customer_has_no_email, idempotency_key_in_progress, operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Make a renewal link for a licence",
        "tags": [
          "licences"
        ]
      }
    },
    "/api/v1/licences/{licence_id}/revoke": {
      "post": {
        "description": "Revoke the licence (`lic_…`) and its active machines, with a `reason` (1 to 200 characters, kept in the licence's journal). It stays possible under an open Stripe dispute. Keyseal does not call Stripe: a subscription that pays for the licence goes on charging the buyer (`subscription` in the answer); cancel it in Stripe, and refund there too. A licence already revoked is `409 licence_revoked`. Returns the licence as `licences.get` gives it, with `changed`.\n\n**Sends a mail:** only with `notify: true`, and only if the status changed: the `licence_revoked` mail to the holder (none to a holder without an address).\n\n**Irreversible:** a revoked licence never comes back, and its machines are revoked with it. Afterwards `licences.revoke`, `licences.suspend` and `licences.reinstate` answer `409 licence_revoked`; `licences.send_key` answers `404 not_found` (its key is dead); `licences.renewal_links.create` answers `404 not_for_sale`; `licences.activations.release` answers `204` and changes nothing (no machine is active any more).\n\n**Who may call:** Any member of the organization; an API key with the right `licences` (or `admin`, which implies every right).",
        "operationId": "licences.revoke",
        "parameters": [
          {
            "description": "The licence's id, `lic_…`.",
            "in": "path",
            "name": "licence_id",
            "required": true,
            "schema": {
              "description": "The licence's id, `lic_…`.",
              "title": "Licence Id",
              "type": "string"
            }
          },
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StatusAction"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LicenceChanged"
                }
              }
            },
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "licence_revoked": {
                    "summary": "licence_revoked",
                    "value": {
                      "error": {
                        "code": "licence_revoked",
                        "message": "This licence is revoked: nothing changes it any more."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_in_progress, licence_revoked, operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Revoke a licence",
        "tags": [
          "licences"
        ]
      }
    },
    "/api/v1/licences/{licence_id}/send-key": {
      "post": {
        "description": "Queue the licence mail again, with the key, to the customer's address: the answer to a buyer who lost their key. Every call sends a mail, even when the purchase mail already went. A revoked licence is `404 not_found` (its key is dead); a customer without an address is `409 customer_has_no_email`. Returns `202` with `email_id`: the mail is queued and the worker sends it (`emails.list` shows how it went).\n\n**Sends a mail:** the `licence_issued` mail, with the licence key, to the customer, on every call.\n\n**Who may call:** Any member of the organization; an API key with the right `licences` (or `admin`, which implies every right).",
        "operationId": "licences.send_key",
        "parameters": [
          {
            "description": "The licence's id, `lic_…`.",
            "in": "path",
            "name": "licence_id",
            "required": true,
            "schema": {
              "description": "The licence's id, `lic_…`.",
              "title": "Licence Id",
              "type": "string"
            }
          },
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeySent"
                }
              }
            },
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "customer_has_no_email": {
                    "summary": "customer_has_no_email",
                    "value": {
                      "error": {
                        "code": "customer_has_no_email",
                        "message": "This customer has no e-mail address to send to."
                      }
                    }
                  },
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "customer_has_no_email, idempotency_key_in_progress, operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Send a licence's key to its customer again",
        "tags": [
          "licences"
        ]
      }
    },
    "/api/v1/licences/{licence_id}/suspend": {
      "post": {
        "description": "Suspend the licence (`lic_…`) with a `reason` (1 to 200 characters, kept in the licence's journal): its machines stay, unusable while it is suspended, and `licences.reinstate` lifts it. A licence already suspended (an open Stripe dispute suspends it too) answers `200` with `changed: false`: nothing written or sent. A revoked licence is `409 licence_revoked`. Keyseal does not call Stripe: a subscription that pays for the licence goes on charging the buyer (`subscription` in the answer); pause or cancel it in Stripe. A licence imported from Lemon Squeezy follows its import until the import is finished: a replay rewrites its status from Lemon Squeezy and may undo the suspension. Returns the licence as `licences.get` gives it, with `changed`.\n\n**Sends a mail:** only with `notify: true`, and only if the status changed: the `licence_suspended` mail to the holder (none to a holder without an address).\n\n**Who may call:** Any member of the organization; an API key with the right `licences` (or `admin`, which implies every right).",
        "operationId": "licences.suspend",
        "parameters": [
          {
            "description": "The licence's id, `lic_…`.",
            "in": "path",
            "name": "licence_id",
            "required": true,
            "schema": {
              "description": "The licence's id, `lic_…`.",
              "title": "Licence Id",
              "type": "string"
            }
          },
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StatusAction"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LicenceChanged"
                }
              }
            },
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "licence_revoked": {
                    "summary": "licence_revoked",
                    "value": {
                      "error": {
                        "code": "licence_revoked",
                        "message": "This licence is revoked: nothing changes it any more."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_in_progress, licence_revoked, operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Suspend a licence",
        "tags": [
          "licences"
        ]
      }
    },
    "/api/v1/me": {
      "get": {
        "description": "The person behind the Clerk session token, and every organization they are a member of with their role in it (its `slug` is the value of the `Keyseal-Organization` header). Keyseal refreshes the name and verified primary email for the same Clerk user ID. A new user is created at first sign-in. An unverified or non-ASCII primary address gives `403 email_unverified`. An established user can read their last verified profile while the Clerk backend is unavailable.\n\n**Who may call:** A person signed in with Clerk, without the organization headers. API keys are refused (`403 forbidden`): this is for a person.",
        "operationId": "account.me",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MeResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "email_unverified": {
                    "summary": "email_unverified",
                    "value": {
                      "error": {
                        "code": "email_unverified",
                        "message": "Verify the primary e-mail address of your account, then sign in again."
                      }
                    }
                  },
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "email_unverified, forbidden"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1.0,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1.0,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Read the signed-in person and their organizations",
        "tags": [
          "account"
        ]
      }
    },
    "/api/v1/orders": {
      "get": {
        "description": "The sales (orders) of the environment of the request, newest first, by pages. Filters, combined: `status` (`paid`, `partially_refunded`, `refunded`, `disputed`, `dispute_lost`), `product_id`, `customer_id`, `licence_id` (the licence's `lic_…` id, a malformed one is `422 invalid_request`; the sales that gave to this licence), `since` (included) and `until` (excluded), dates with a time zone (`2026-03-01T00:00:00Z`) bounding `created_at`, when Keyseal recorded the sale. `product_id` and `customer_id` are the plain UUIDs their objects carry. Amounts are the ones Stripe sent, in minor units. A refund, asked with `orders.refund` or made in Stripe, changes a sale when Stripe confirms it.\n\n**Who may call:** Any member of the organization; an API key with the right `read` or `customers` (or `admin`, which implies every right).",
        "operationId": "sales.list",
        "parameters": [
          {
            "description": "The sales of this status: paid, partially_refunded, refunded, disputed or dispute_lost.",
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/OrderStatus"
                },
                {
                  "type": "null"
                }
              ],
              "description": "The sales of this status: paid, partially_refunded, refunded, disputed or dispute_lost.",
              "title": "Status"
            }
          },
          {
            "description": "The sales of this product.",
            "in": "query",
            "name": "product_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "uuid",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "The sales of this product.",
              "title": "Product Id"
            }
          },
          {
            "description": "The sales of this customer.",
            "in": "query",
            "name": "customer_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "uuid",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "The sales of this customer.",
              "title": "Customer Id"
            }
          },
          {
            "description": "The sales that gave to this licence: the licence's lic_… id.",
            "in": "query",
            "name": "licence_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 40,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "The sales that gave to this licence: the licence's lic_… id.",
              "title": "Licence Id"
            }
          },
          {
            "description": "The sales recorded at or after this instant, with a time zone (2026-03-01T00:00:00Z).",
            "in": "query",
            "name": "since",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date-time",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "The sales recorded at or after this instant, with a time zone (2026-03-01T00:00:00Z).",
              "title": "Since"
            }
          },
          {
            "description": "The sales recorded before this instant, with a time zone.",
            "in": "query",
            "name": "until",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date-time",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "The sales recorded before this instant, with a time zone.",
              "title": "Until"
            }
          },
          {
            "description": "The page size, 1 to 100; 50 by default.",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "description": "The page size, 1 to 100; 50 by default.",
              "maximum": 100,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "description": "The next_cursor of the previous page; left out for the first page.",
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "The next_cursor of the previous page; left out for the first page.",
              "title": "Cursor"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrdersResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "List the sales",
        "tags": [
          "sales"
        ]
      }
    },
    "/api/v1/orders/{order_id}": {
      "get": {
        "description": "One sale (a UUID) with what it granted (`grants`: a licence created, updates extended, a paid period; `undone_at` and `undone_reason` are set when a refund or a lost dispute took it back), its subscription (`null` for none), `discount` (the discount code made in Keyseal that this purchase used: the discount's and the code's ids, the discount's name and the amount taken off; never the code's text; `null` for none, and for the later invoices of a discounted subscription), and `stripe_dashboard_url`: the payment in the Stripe Dashboard of the environment (the invoice for a sale of a subscription; `null` for a sale known by its checkout session only), and `refundable_amount`: what `orders.refund` may still refund, in minor units (`null` when the sale cannot be refunded).\n\n**Who may call:** Any member of the organization; an API key with the right `read` or `customers` (or `admin`, which implies every right).",
        "operationId": "sales.get",
        "parameters": [
          {
            "description": "The sale's id (a UUID).",
            "in": "path",
            "name": "order_id",
            "required": true,
            "schema": {
              "description": "The sale's id (a UUID).",
              "format": "uuid",
              "title": "Order Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderDetail"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Read a sale",
        "tags": [
          "sales"
        ]
      }
    },
    "/api/v1/orders/{order_id}/refund": {
      "post": {
        "description": "Ask the publisher's Stripe to refund a sale (a UUID): `amount` in minor units, 1 to the sale's `refundable_amount` (`sales.get`), or absent for all that remains; `reason` optional (`requested_by_customer`, `duplicate`, `fraudulent`). Refundable: a sale `paid` or `partially_refunded`, of more than 0, with a Stripe payment (a subscription's sale: the payment of its own invoice); otherwise `409 order_not_refundable`. An amount above what remains is `422 refund_amount_too_large`, refused before Stripe. Returns `202` with the refund Stripe made (`id`, `amount`, `currency`, `status`). Keyseal changes nothing itself: when Stripe confirms the refund, the sale becomes `refunded` or `partially_refunded`, as for a refund made in the Stripe Dashboard; a full refund takes back what the sale gave (a licence it created is revoked). A refund never cancels a subscription: cancel it in Stripe. A refusal of Stripe is `409 stripe_refused`, with `missing` naming the permission to add to the restricted key when it lacks one (`charge_write`; `invoice_read` for a subscription's sale); Stripe unreachable is `503 stripe_unavailable`. The `Idempotency-Key` is passed on to Stripe: the same request sent again, even after a lost answer, refunds once.\n\n**Sends a mail:** none from this call; when Stripe confirms a refund that revokes the licence the sale created, Keyseal sends its holder the licence_revoked mail.\n\n**Irreversible:** money refunded is not taken back, and a licence revoked by a full refund never comes back.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `admin`.",
        "operationId": "orders.refund",
        "parameters": [
          {
            "description": "The sale's id (a UUID).",
            "in": "path",
            "name": "order_id",
            "required": true,
            "schema": {
              "description": "The sale's id (a UUID).",
              "format": "uuid",
              "title": "Order Id",
              "type": "string"
            }
          },
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/RefundCreate"
                  },
                  {
                    "type": "null"
                  }
                ],
                "title": "Body"
              }
            }
          }
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RefundOut"
                }
              }
            },
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  },
                  "order_not_refundable": {
                    "summary": "order_not_refundable",
                    "value": {
                      "error": {
                        "code": "order_not_refundable",
                        "message": "This sale cannot be refunded: nothing was paid, it is refunded already, or a dispute is open or lost."
                      }
                    }
                  },
                  "stripe_not_connected": {
                    "summary": "stripe_not_connected",
                    "value": {
                      "error": {
                        "code": "stripe_not_connected",
                        "message": "Stripe is not connected in this environment."
                      }
                    }
                  },
                  "stripe_refused": {
                    "summary": "stripe_refused",
                    "value": {
                      "error": {
                        "code": "stripe_refused",
                        "message": "Stripe refused the request; with missing, add these permissions to the restricted key."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_in_progress, operator_busy, order_not_refundable, stripe_not_connected, stripe_refused"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  },
                  "refund_amount_too_large": {
                    "summary": "refund_amount_too_large",
                    "value": {
                      "error": {
                        "code": "refund_amount_too_large",
                        "message": "This amount is more than what remains refundable of the sale."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_request, refund_amount_too_large"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  },
                  "stripe_unavailable": {
                    "summary": "stripe_unavailable",
                    "value": {
                      "error": {
                        "code": "stripe_unavailable",
                        "message": "Stripe is unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable, stripe_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Refund a sale",
        "tags": [
          "orders"
        ]
      }
    },
    "/api/v1/organization": {
      "get": {
        "description": "The organization and the environment of the request: its name, its support address and its brand (`logo_url`, `brand_color`), as the mails to buyers show them. `reply_to_ok` says whether `support_email` is a plain address, used as the `Reply-To` of those mails. `sale_alerts` says whether each owner gets a mail for each sale paid through the checkout page.\n\n**Who may call:** Any member of the organization; any API key of the organization, whatever its rights.",
        "operationId": "organization.get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CurrentOrganization"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Read the organization",
        "tags": [
          "organization"
        ]
      },
      "patch": {
        "description": "Change the fields sent among `name`, `support_email` (the `Reply-To` of the mails to buyers: a plain address, no display name), `logo_url` (an `https://` address of 500 characters at most, displayed inline for Keyseal static images and the logo uploaded with `organization.upload_logo`, linked for external hosts; a new address, or null, withdraws the uploaded logo), `brand_color` (`#RRGGBB`) and `sale_alerts` (`true` or `false`: a mail to each owner for each sale paid through the checkout page, the purchase of a subscription included, its later invoices not; never null). A null clears any of them but `name` and `sale_alerts`. They hold for both environments. A refusal changes nothing (`422 invalid_logo_url`, `422 invalid_brand_color`, or `422 invalid_request` naming the field). Returns the organization, as `organization.get` does.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key of `live` with the right `admin`. Members are the organization's, in both environments: a key of `test` gets `403 forbidden`.",
        "operationId": "organization.update",
        "parameters": [
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrganizationUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CurrentOrganization"
                }
              }
            },
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_in_progress, operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_brand_color": {
                    "summary": "invalid_brand_color",
                    "value": {
                      "error": {
                        "code": "invalid_brand_color",
                        "message": "The brand colour must be #RRGGBB, six hexadecimal digits."
                      }
                    }
                  },
                  "invalid_logo_url": {
                    "summary": "invalid_logo_url",
                    "value": {
                      "error": {
                        "code": "invalid_logo_url",
                        "message": "The logo must be an https:// address of at most 500 characters."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_brand_color, invalid_logo_url, invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Update the organization's name, support address, brand and sale alerts",
        "tags": [
          "organization"
        ]
      }
    },
    "/api/v1/organization/invitations": {
      "get": {
        "description": "The open invitations of the organization (neither accepted, withdrawn nor expired), the most recent first, all of them (no cursor). `mail_status` says how the invitation's mail went (`queued`, `sending`, `sent`, `delivered`, `bounced`, `complained`, `failed`, `expired`) and `mail_error` the code of a failure: a mail that did not arrive is a reason to invite again. Never the link nor its token.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key of `live` with the right `admin`. Members are the organization's, in both environments: a key of `test` gets `403 forbidden`.",
        "operationId": "members.invitations.list",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvitationsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "List the open invitations",
        "tags": [
          "members"
        ]
      },
      "post": {
        "description": "Invite an address to join the organization, in both environments, with the role `member` or `admin`: a link sent by mail, valid 7 days, good once and only for the person of that address (the address their account was verified with at its first sign-in). `locale` (`fr` by default, or `en`) is the language of the mail. Inviting an address again replaces its open invitation: the old link stops working, and its mail, if not sent yet, is not sent. An address that is already a member's is `409 already_member`. At most 50 invitations per 24 hours per organization, and 50 per person across all their organizations (`429 invitation_limit_reached`). Without a mail provider configured nothing is made (`503 mail_unavailable`). Returns `201` with the invitation (`mail_status: queued`), never its token.\n\n**Sends a mail:** the `member_invitation` mail, with its link, to the address invited, once per call.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key of `live` with the right `admin`. Members are the organization's, in both environments: a key of `test` gets `403 forbidden`. Inviting an `admin` is for an owner in person (`403 forbidden` for an admin or an API key).",
        "operationId": "members.invitations.create",
        "parameters": [
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InvitationCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvitationOut"
                }
              }
            },
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "already_member": {
                    "summary": "already_member",
                    "value": {
                      "error": {
                        "code": "already_member",
                        "message": "This user is already a member of the organization."
                      }
                    }
                  },
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "already_member, idempotency_key_in_progress, operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "invitation_limit_reached": {
                    "summary": "invitation_limit_reached",
                    "value": {
                      "error": {
                        "code": "invitation_limit_reached",
                        "message": "This organization, or you across your organizations, sent 50 invitations in the last 24 hours: try again later."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, invitation_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  },
                  "mail_unavailable": {
                    "summary": "mail_unavailable",
                    "value": {
                      "error": {
                        "code": "mail_unavailable",
                        "message": "No mail can be sent now: the mail service is not configured."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable, mail_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Invite a member by mail",
        "tags": [
          "members"
        ]
      }
    },
    "/api/v1/organization/invitations/{invitation_id}": {
      "delete": {
        "description": "Withdraw an open invitation (`inv_…`): its link stops working. An invitation unknown, of another organization, already accepted, withdrawn or expired is `404 not_found`. Returns `204`.\n\n**Irreversible:** the link of a withdrawn invitation never works again: invite anew.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key of `live` with the right `admin`. Members are the organization's, in both environments: a key of `test` gets `403 forbidden`.",
        "operationId": "members.invitations.revoke",
        "parameters": [
          {
            "description": "The invitation's id, `inv_…`.",
            "in": "path",
            "name": "invitation_id",
            "required": true,
            "schema": {
              "description": "The invitation's id, `inv_…`.",
              "title": "Invitation Id",
              "type": "string"
            }
          },
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_in_progress, operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Withdraw an invitation",
        "tags": [
          "members"
        ]
      }
    },
    "/api/v1/organization/logo": {
      "put": {
        "description": "Replace the organization's logo with a still PNG, JPEG or WebP of at most 512 KiB and eight million pixels. Send standard base64 in `content_base64`. Keyseal strips metadata and returns, as `logo_url`, a same-origin WebP URL, up to 256 pixels per side, which the mails to buyers, the customer area and the public pages show inline. The logo holds for both environments. Replacing the logo, or clearing or changing `logo_url` (`organization.update`), withdraws the previous URL. An invalid image changes nothing (`422 invalid_request` naming `content_base64`).\n\n**Who may call:** A person with the role `admin` or `owner`; an API key of `live` with the right `admin`. Members are the organization's, in both environments: a key of `test` gets `403 forbidden`.",
        "operationId": "organization.upload_logo",
        "parameters": [
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrganizationLogoIn"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationLogoOut"
                }
              }
            },
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_in_progress, operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Upload the organization's logo",
        "tags": [
          "organization"
        ]
      }
    },
    "/api/v1/organization/members": {
      "get": {
        "description": "The members of the organization with their role, sorted by address. A membership holds for both environments. New members are invited (`members.invitations.create`), never added by address.\n\n**Who may call:** Any member of the organization; any API key of the organization, whatever its rights.",
        "operationId": "members.list",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MembersResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1.0,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1.0,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "List the members",
        "tags": [
          "members"
        ]
      }
    },
    "/api/v1/organization/members/{user_id}": {
      "delete": {
        "description": "Remove a member from the organization, in both environments: the API keys they own in it are revoked and the open invitations they sent withdrawn (their keys in other organizations are untouched). The last owner cannot be removed (`409 last_owner`). Someone who is not a member of this organization is `404 not_found`. Returns `204`.\n\n**Irreversible:** the member's API keys stay revoked; to come back, the person is invited again.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key of `live` with the right `admin`. Members are the organization's, in both environments: a key of `test` gets `403 forbidden`. Removing an owner is for an owner in person (`403 forbidden` otherwise).",
        "operationId": "members.remove",
        "parameters": [
          {
            "description": "The member's user id (a UUID).",
            "in": "path",
            "name": "user_id",
            "required": true,
            "schema": {
              "description": "The member's user id (a UUID).",
              "format": "uuid",
              "title": "User Id",
              "type": "string"
            }
          },
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "last_owner": {
                    "summary": "last_owner",
                    "value": {
                      "error": {
                        "code": "last_owner",
                        "message": "An organization keeps at least one owner."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_in_progress, last_owner, operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Remove a member",
        "tags": [
          "members"
        ]
      },
      "patch": {
        "description": "Set the role of a member: `member`, `admin` or `owner`. Made `member`, they lose the API keys they own in the organization (revoked, in both environments) and the open invitations they sent (withdrawn); an `owner` made `admin` loses the open invitations of admins they sent. The organization keeps at least one owner (`409 last_owner`). Someone who is not a member of this organization is `404 not_found`. Returns the member with their new role.\n\n**Irreversible:** the API keys revoked by a demotion to `member` stay revoked: giving the role back does not bring them back.\n\n**Who may call:** A person with the role `owner`; an API key of `live` with the right `admin`, between `member` and `admin` only. Making or unmaking an owner is for an owner in person (`403 forbidden` otherwise); a key of `test` gets `403 forbidden`.",
        "operationId": "members.set_role",
        "parameters": [
          {
            "description": "The member's user id (a UUID).",
            "in": "path",
            "name": "user_id",
            "required": true,
            "schema": {
              "description": "The member's user id (a UUID).",
              "format": "uuid",
              "title": "User Id",
              "type": "string"
            }
          },
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MemberUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MemberOut"
                }
              }
            },
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "last_owner": {
                    "summary": "last_owner",
                    "value": {
                      "error": {
                        "code": "last_owner",
                        "message": "An organization keeps at least one owner."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_in_progress, last_owner, operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Change a member's role",
        "tags": [
          "members"
        ]
      }
    },
    "/api/v1/organizations": {
      "post": {
        "description": "Create an organization, with its `test` and `live` environments; the caller becomes its `owner`. `slug` (2 to 63 characters `[a-z0-9-]`, starting with a letter or a digit) is the value of the `Keyseal-Organization` header; one already taken is `409 slug_taken`, and `api`, `app`, `assets`, `invitations`, `me` and `organizations`, reserved by Keyseal, are `422 slug_reserved`. At most 5 new organizations per person in 24 hours (`429 organization_limit_reached`). A separate lifetime creation ceiling returns `409 organization_creation_limit` and `limit`. Returns `201` with the organization and the caller's role.\n\n**Who may call:** A person signed in with Clerk, without the organization headers. API keys are refused (`403 forbidden`): this is for a person.\n\n**Idempotency:** not supported: a request with `Idempotency-Key` is refused (`400 idempotency_not_supported`). This route is outside any organization; a retry is safe anyway: the slug, once taken, answers `409 slug_taken`, and `account.me` lists the organization made.",
        "operationId": "account.organizations.create",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrganizationCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MembershipOut"
                }
              }
            },
            "description": "Successful Response"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_not_supported": {
                    "summary": "idempotency_not_supported",
                    "value": {
                      "error": {
                        "code": "idempotency_not_supported",
                        "message": "This operation does not take an Idempotency-Key: send it without the header."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_not_supported"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "email_unverified": {
                    "summary": "email_unverified",
                    "value": {
                      "error": {
                        "code": "email_unverified",
                        "message": "Verify the primary e-mail address of your account, then sign in again."
                      }
                    }
                  },
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "email_unverified, forbidden"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  },
                  "organization_creation_limit": {
                    "summary": "organization_creation_limit",
                    "value": {
                      "error": {
                        "code": "organization_creation_limit",
                        "message": "You have reached your total organization creation limit."
                      }
                    }
                  },
                  "slug_taken": {
                    "summary": "slug_taken",
                    "value": {
                      "error": {
                        "code": "slug_taken",
                        "message": "This organization name is already taken."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy, organization_creation_limit, slug_taken"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  },
                  "slug_reserved": {
                    "summary": "slug_reserved",
                    "value": {
                      "error": {
                        "code": "slug_reserved",
                        "message": "This identifier is reserved by Keyseal: choose another."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request, slug_reserved"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "organization_limit_reached": {
                    "summary": "organization_limit_reached",
                    "value": {
                      "error": {
                        "code": "organization_limit_reached",
                        "message": "You made 5 organizations in the last 24 hours: try again later."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "organization_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1.0,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1.0,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Create an organization",
        "tags": [
          "account"
        ]
      }
    },
    "/api/v1/plans": {
      "get": {
        "description": "The plans of every product of the environment of the request, oldest first, each with its current price (`null` for a plan without one, which is not sold: it serves the licences given by hand) and its state at Stripe (`stripe`).\n\n**Who may call:** Any member of the organization; an API key with the right `read` or `catalog` (or `admin`, which implies every right).",
        "operationId": "catalog.plans.list",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlansResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "List the plans",
        "tags": [
          "catalog"
        ]
      },
      "post": {
        "description": "Create a plan, a way to sell a product with its price, then push it to Stripe when Stripe is connected. `kind`: `perpetual`, `perpetual_with_updates` or `renewal` (both with `update_months`, 1 to 1200), or `subscription` (whose price alone has an `interval`, `month` or `year`). `slug` is unique in the environment (`409 plan_slug_taken`) and is the address of the buy link, `/b/{org}/{slug}`; `public: false` keeps the plan off its buy link, and a `renewal` plan is sold only through a renewal link. `seats`: machines per licence (3 by default). `price`: `amount` in minor units, `currency` in three letters, `tax_behavior` `inclusive` (default) or `exclusive`; a plan without a price is not sold. `free: true` makes a free plan: its buy link gives a licence against a confirmed e-mail address, without Stripe; it is `perpetual` or `perpetual_with_updates` and has no `price` (`422 free_plan_not_allowed` otherwise), and it is never sent to Stripe. An unknown product is `404 not_found`. Returns `201` with the plan, its `stripe` as for a product.\n\n**Irreversible:** the `kind`, the `slug` and the product of a plan never change.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `catalog` (or `admin`, which implies every right).",
        "operationId": "catalog.plans.create",
        "parameters": [
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlanCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlanOut"
                }
              }
            },
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  },
                  "plan_slug_taken": {
                    "summary": "plan_slug_taken",
                    "value": {
                      "error": {
                        "code": "plan_slug_taken",
                        "message": "A plan of this environment already has this slug."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_in_progress, operator_busy, plan_slug_taken"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "free_plan_not_allowed": {
                    "summary": "free_plan_not_allowed",
                    "value": {
                      "error": {
                        "code": "free_plan_not_allowed",
                        "message": "A free plan is perpetual or perpetual_with_updates, and has no price."
                      }
                    }
                  },
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "free_plan_not_allowed, idempotency_key_reused, invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Create a plan of a product",
        "tags": [
          "catalog"
        ]
      }
    },
    "/api/v1/plans/{plan_id}": {
      "get": {
        "description": "One plan of the environment of the request, by its id (a UUID), with its current price and its state at Stripe. Another organization's or environment's is `404 not_found`.\n\n**Who may call:** Any member of the organization; an API key with the right `read` or `catalog` (or `admin`, which implies every right).",
        "operationId": "catalog.plans.get",
        "parameters": [
          {
            "description": "The plan's id (a UUID).",
            "in": "path",
            "name": "plan_id",
            "required": true,
            "schema": {
              "description": "The plan's id (a UUID).",
              "format": "uuid",
              "title": "Plan Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlanOut"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Read a plan",
        "tags": [
          "catalog"
        ]
      },
      "patch": {
        "description": "Change the fields sent among `name`, `seats`, `features`, `update_months`, `public`, `free` and `price`, then push the plan to Stripe; the `kind`, the `slug` and the product never change. A `price` replaces the current one: at Stripe a new Price is made and the old one deactivated, and the same price sent again changes nothing. `\"price\": null` is refused: a price is replaced, never removed. A price for a free plan is `422 plan_is_free`; `free: true` for a plan that is neither `perpetual` nor `perpetual_with_updates`, or that has a price, is `422 free_plan_not_allowed`. A free plan is never sent to Stripe. Returns the plan.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `catalog` (or `admin`, which implies every right).",
        "operationId": "catalog.plans.update",
        "parameters": [
          {
            "description": "The plan's id (a UUID).",
            "in": "path",
            "name": "plan_id",
            "required": true,
            "schema": {
              "description": "The plan's id (a UUID).",
              "format": "uuid",
              "title": "Plan Id",
              "type": "string"
            }
          },
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlanUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlanOut"
                }
              }
            },
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_in_progress, operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "free_plan_not_allowed": {
                    "summary": "free_plan_not_allowed",
                    "value": {
                      "error": {
                        "code": "free_plan_not_allowed",
                        "message": "A free plan is perpetual or perpetual_with_updates, and has no price."
                      }
                    }
                  },
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  },
                  "plan_is_free": {
                    "summary": "plan_is_free",
                    "value": {
                      "error": {
                        "code": "plan_is_free",
                        "message": "A free plan has no price: make it not free first."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "free_plan_not_allowed, idempotency_key_reused, invalid_request, plan_is_free"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Update a plan",
        "tags": [
          "catalog"
        ]
      }
    },
    "/api/v1/products": {
      "get": {
        "description": "The products of the environment of the request, oldest first. `stripe` says whether each is at Stripe as it is in Keyseal (`error`: `stripe_not_connected` without a connection, `null` while a push is due).\n\n**Who may call:** Any member of the organization; an API key with the right `read` or `catalog` (or `admin`, which implies every right).",
        "operationId": "catalog.products.list",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "List the products",
        "tags": [
          "catalog"
        ]
      },
      "post": {
        "description": "Create a product and its first signing key, then push it to Stripe when Stripe is connected. `slug` (`[a-z0-9-]`, 64 characters at most) and `key_prefix` (three capital letters, the start of its licence keys: `DSM-…`) are unique in the environment (`409 product_slug_taken`, `409 key_prefix_taken`). `lease_days` (30 by default, 1 to 3650) is the lease of the certificates of its licences; `offline_policy` is `open` (default) or `closed`; `website_url` is also where a buyer who cancels the payment comes back to; `tax_code` is one of `catalog.tax_codes.list`. `page_enabled` (false by default) gives the product a hosted page, `/p/{org}/{slug}`, with `image_url` (`https://` only) as its image. Returns `201` with the product. A push to Stripe that fails never fails the write: `stripe.synced` is then `false` and `stripe.error` says why (`stripe_unavailable`, `stripe_refused`, `stripe_not_connected`); `stripe.sync` catches up.\n\n**Irreversible:** the `slug` and the `key_prefix` of a product never change.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `catalog` (or `admin`, which implies every right).",
        "operationId": "catalog.products.create",
        "parameters": [
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProductCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductOut"
                }
              }
            },
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "key_prefix_taken": {
                    "summary": "key_prefix_taken",
                    "value": {
                      "error": {
                        "code": "key_prefix_taken",
                        "message": "A product of this environment already uses this key prefix."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  },
                  "product_slug_taken": {
                    "summary": "product_slug_taken",
                    "value": {
                      "error": {
                        "code": "product_slug_taken",
                        "message": "A product of this environment already has this slug."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_in_progress, key_prefix_taken, operator_busy, product_slug_taken"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Create a product",
        "tags": [
          "catalog"
        ]
      }
    },
    "/api/v1/products/{product_id}": {
      "get": {
        "description": "One product of the environment of the request, by its id (a UUID), with its state at Stripe (`stripe`). Another organization's or environment's is `404 not_found`.\n\n**Who may call:** Any member of the organization; an API key with the right `read` or `catalog` (or `admin`, which implies every right).",
        "operationId": "catalog.products.get",
        "parameters": [
          {
            "description": "The product's id (a UUID).",
            "in": "path",
            "name": "product_id",
            "required": true,
            "schema": {
              "description": "The product's id (a UUID).",
              "format": "uuid",
              "title": "Product Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductOut"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Read a product",
        "tags": [
          "catalog"
        ]
      },
      "patch": {
        "description": "Change the fields sent among `name`, `lease_days`, `offline_policy`, `description`, `website_url`, `tax_code`, `ls_compat`, `page_enabled` and `image_url`, then push the product to Stripe; any other field (the `slug`, the `key_prefix`) is `422 invalid_request`. `page_enabled` turns the product's hosted page, `/p/{org}/{slug}`, on or off; `image_url` (`https://` only, `null` clears it) is its image. `ls_compat: true` gives the product's new licences a key in Lemon Squeezy's format (a UUID) instead of `PFX-…`; the keys already issued never change. Returns the product, its `stripe` as for `catalog.products.create`.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `catalog` (or `admin`, which implies every right).",
        "operationId": "catalog.products.update",
        "parameters": [
          {
            "description": "The product's id (a UUID).",
            "in": "path",
            "name": "product_id",
            "required": true,
            "schema": {
              "description": "The product's id (a UUID).",
              "format": "uuid",
              "title": "Product Id",
              "type": "string"
            }
          },
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProductUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductOut"
                }
              }
            },
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_in_progress, operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Update a product",
        "tags": [
          "catalog"
        ]
      }
    },
    "/api/v1/products/{product_id}/image": {
      "get": {
        "description": "Read the currently selected Keyseal-hosted thumbnail as base64 WebP, including for an unpublished product. An external image or a product with no uploaded image answers `404 not_found`. The preview is private and must not be cached.\n\n**Who may call:** Any member of the organization; an API key with the right `read` or `catalog` (or `admin`, which implies every right).",
        "operationId": "catalog.products.preview_image",
        "parameters": [
          {
            "description": "The product's id (a UUID).",
            "in": "path",
            "name": "product_id",
            "required": true,
            "schema": {
              "description": "The product's id (a UUID).",
              "format": "uuid",
              "title": "Product Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductImagePreview"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Preview the selected product image",
        "tags": [
          "catalog"
        ]
      },
      "put": {
        "description": "Replace the product image with a still PNG, JPEG or WebP of at most 512 KiB and eight million pixels. Send standard base64 in `content_base64`. Keyseal strips metadata and returns a same-origin WebP URL, up to 768 pixels per side. Only an enabled product page serves the selected image. A private page retains the image for a future publication. Clearing or replacing `image_url` withdraws this URL. The operation does not publish a page or an offer.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `catalog` (or `admin`, which implies every right).",
        "operationId": "catalog.products.upload_image",
        "parameters": [
          {
            "description": "The product's id (a UUID).",
            "in": "path",
            "name": "product_id",
            "required": true,
            "schema": {
              "description": "The product's id (a UUID).",
              "format": "uuid",
              "title": "Product Id",
              "type": "string"
            }
          },
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProductImageIn"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductImageOut"
                }
              }
            },
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_in_progress, operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Upload the image for a product's hosted page",
        "tags": [
          "catalog"
        ]
      }
    },
    "/api/v1/products/{product_id}/releases": {
      "get": {
        "description": "The releases of a product (a UUID) of the environment of the request, the most recent first (the drafts without a day, then by day, then by creation), each with its files. No answer carries the key of an object in the store.\n\n**Who may call:** Any member of the organization; an API key with the right `read` or `files` (or `admin`, which implies every right).",
        "operationId": "releases.list",
        "parameters": [
          {
            "description": "The product's id (a UUID).",
            "in": "path",
            "name": "product_id",
            "required": true,
            "schema": {
              "description": "The product's id (a UUID).",
              "format": "uuid",
              "title": "Product Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReleasesResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "List the releases of a product",
        "tags": [
          "releases"
        ]
      },
      "post": {
        "description": "Create a release of a product, in `draft`: `version` (required; at most 64 characters among `0-9 A-Z a-z . + -`, unique per product), `notes` (Markdown, kept as text), `public` (`false` by default), `released_on` (a day `YYYY-MM-DD`; none: publishing sets the day, in UTC). A version already taken is `409 release_version_taken`, a malformed one `422 invalid_version`. Then declare its files (`releases.files.start_upload`) and publish it (`releases.publish`). Returns `201` with the release.\n\n**Irreversible:** the `version` of a release never changes.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `files` (or `admin`, which implies every right).",
        "operationId": "releases.create",
        "parameters": [
          {
            "description": "The product's id (a UUID).",
            "in": "path",
            "name": "product_id",
            "required": true,
            "schema": {
              "description": "The product's id (a UUID).",
              "format": "uuid",
              "title": "Product Id",
              "type": "string"
            }
          },
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReleaseCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReleaseOut"
                }
              }
            },
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  },
                  "release_version_taken": {
                    "summary": "release_version_taken",
                    "value": {
                      "error": {
                        "code": "release_version_taken",
                        "message": "A release of this product already has this version."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_in_progress, operator_busy, release_version_taken"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  },
                  "invalid_version": {
                    "summary": "invalid_version",
                    "value": {
                      "error": {
                        "code": "invalid_version",
                        "message": "The version must have 1 to 64 characters among 0-9 A-Z a-z . + -."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_request, invalid_version"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Create a release of a product",
        "tags": [
          "releases"
        ]
      }
    },
    "/api/v1/releases/{release_id}": {
      "delete": {
        "description": "Delete the release, whatever its state, and all its files; their objects are erased from the store once the deletion is committed (an erasure that fails is logged, never fails the request, and the object is never served again). It works without a store configured. Returns `204`.\n\n**Irreversible:** the release and its files are deleted for good, with their objects.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `files` (or `admin`, which implies every right).",
        "operationId": "releases.delete",
        "parameters": [
          {
            "description": "The release's id, `rel_…`.",
            "in": "path",
            "name": "release_id",
            "required": true,
            "schema": {
              "description": "The release's id, `rel_…`.",
              "title": "Release Id",
              "type": "string"
            }
          },
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_in_progress, operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Delete a release and its files",
        "tags": [
          "releases"
        ]
      },
      "get": {
        "description": "One release (`rel_…`) of the environment of the request, with its files: their platform, name, size, SHA-256 and status (`pending` until their upload is complete, then `ready`).\n\n**Who may call:** Any member of the organization; an API key with the right `read` or `files` (or `admin`, which implies every right).",
        "operationId": "releases.get",
        "parameters": [
          {
            "description": "The release's id, `rel_…`.",
            "in": "path",
            "name": "release_id",
            "required": true,
            "schema": {
              "description": "The release's id, `rel_…`.",
              "title": "Release Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReleaseOut"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Read a release",
        "tags": [
          "releases"
        ]
      },
      "patch": {
        "description": "Change the fields sent among `notes`, `public` and `released_on`; `null` is accepted only for the day of a draft, and the `version` never changes. Returns the release.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `files` (or `admin`, which implies every right).",
        "operationId": "releases.update",
        "parameters": [
          {
            "description": "The release's id, `rel_…`.",
            "in": "path",
            "name": "release_id",
            "required": true,
            "schema": {
              "description": "The release's id, `rel_…`.",
              "title": "Release Id",
              "type": "string"
            }
          },
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReleaseUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReleaseOut"
                }
              }
            },
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_in_progress, operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Update a release",
        "tags": [
          "releases"
        ]
      }
    },
    "/api/v1/releases/{release_id}/files": {
      "post": {
        "description": "Step 1 of 3 of sending a file, whose bytes go straight to the object store, never through Keyseal. Declare the file of one `platform` (`macos-universal`, `macos-arm64`, `macos-x64`, `windows-x64`, `windows-arm64`, `linux-x64`, `linux-arm64`, `any`; one file per platform and release) with its `filename` (200 characters at most, without slash, backslash, double quote or control character), its `size` in bytes (at most the server's limit, 2 GiB by default: `413 file_too_large`), its `sha256` (64 hexadecimal digits, shown to buyers to check their download) and its `content_type` (`application/octet-stream` by default). Returns `201` with the file, `pending`, and `upload_url`, an address valid 15 minutes (`upload_expires_at`): step 2 is a `PUT` of the bytes to it, step 3 `releases.files.complete_upload`. Declaring again a platform still `pending` replaces it (a new id, a new address); one already `ready` is `409 file_platform_taken` (delete that file first). Without a store configured: `503 storage_unavailable`.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `files` (or `admin`, which implies every right).",
        "operationId": "releases.files.start_upload",
        "parameters": [
          {
            "description": "The release's id, `rel_…`.",
            "in": "path",
            "name": "release_id",
            "required": true,
            "schema": {
              "description": "The release's id, `rel_…`.",
              "title": "Release Id",
              "type": "string"
            }
          },
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FileCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UploadStarted"
                }
              }
            },
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "file_platform_taken": {
                    "summary": "file_platform_taken",
                    "value": {
                      "error": {
                        "code": "file_platform_taken",
                        "message": "This release already has an uploaded file for this platform."
                      }
                    }
                  },
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "file_platform_taken, idempotency_key_in_progress, operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "file_too_large": {
                    "summary": "file_too_large",
                    "value": {
                      "error": {
                        "code": "file_too_large",
                        "message": "This file is larger than the largest file allowed."
                      }
                    }
                  },
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "file_too_large, payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_filename": {
                    "summary": "invalid_filename",
                    "value": {
                      "error": {
                        "code": "invalid_filename",
                        "message": "The file name must have 1 to 200 characters, with no slash, backslash, double quote or control character."
                      }
                    }
                  },
                  "invalid_platform": {
                    "summary": "invalid_platform",
                    "value": {
                      "error": {
                        "code": "invalid_platform",
                        "message": "This platform is not one Keyseal knows."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  },
                  "invalid_sha256": {
                    "summary": "invalid_sha256",
                    "value": {
                      "error": {
                        "code": "invalid_sha256",
                        "message": "The SHA-256 must be 64 hexadecimal characters."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_filename, invalid_platform, invalid_request, invalid_sha256"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  },
                  "storage_unavailable": {
                    "summary": "storage_unavailable",
                    "value": {
                      "error": {
                        "code": "storage_unavailable",
                        "message": "File storage is unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable, storage_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Declare a file of a release and get its upload address",
        "tags": [
          "releases"
        ]
      }
    },
    "/api/v1/releases/{release_id}/publish": {
      "post": {
        "description": "Publish a draft that has at least one `ready` file: a release that is not a draft is `409 release_not_draft`, one without a `ready` file `409 release_has_no_ready_file`. A draft without `released_on` gets the day of its publication, in UTC. Returns the release, `published`.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `files` (or `admin`, which implies every right).",
        "operationId": "releases.publish",
        "parameters": [
          {
            "description": "The release's id, `rel_…`.",
            "in": "path",
            "name": "release_id",
            "required": true,
            "schema": {
              "description": "The release's id, `rel_…`.",
              "title": "Release Id",
              "type": "string"
            }
          },
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReleaseOut"
                }
              }
            },
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  },
                  "release_has_no_ready_file": {
                    "summary": "release_has_no_ready_file",
                    "value": {
                      "error": {
                        "code": "release_has_no_ready_file",
                        "message": "A published release keeps at least one uploaded file."
                      }
                    }
                  },
                  "release_not_draft": {
                    "summary": "release_not_draft",
                    "value": {
                      "error": {
                        "code": "release_not_draft",
                        "message": "Only a draft release can be published."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_in_progress, operator_busy, release_has_no_ready_file, release_not_draft"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Publish a release",
        "tags": [
          "releases"
        ]
      }
    },
    "/api/v1/releases/{release_id}/unpublish": {
      "post": {
        "description": "Put a published release back in `draft`; it keeps its day. Returns the release.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `files` (or `admin`, which implies every right).",
        "operationId": "releases.unpublish",
        "parameters": [
          {
            "description": "The release's id, `rel_…`.",
            "in": "path",
            "name": "release_id",
            "required": true,
            "schema": {
              "description": "The release's id, `rel_…`.",
              "title": "Release Id",
              "type": "string"
            }
          },
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReleaseOut"
                }
              }
            },
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_in_progress, operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Unpublish a release",
        "tags": [
          "releases"
        ]
      }
    },
    "/api/v1/stripe": {
      "delete": {
        "description": "Disconnect Stripe from the environment of the request: Keyseal's webhook endpoint is deleted at Stripe, the key and the webhook secret are forgotten, and the Stripe ids of the environment's products and prices are cleared; the licences do not change. Without `force=true`, a running subscription or an outstanding publisher checkout returns `409 stripe_active_subscriptions`. If Keyseal cannot verify an expired checkout with Stripe, it keeps the endpoint and returns `409 stripe_connection_busy`. The discount codes made in Keyseal are deactivated at Stripe first, then discounts and codes become unavailable for good, their history kept. Without `force=true`, if a code cannot be deactivated (Stripe unreachable, a dead or unreadable key, a right taken away, a creation or activation whose answer was lost and that may still land), the connection is kept and the answer is `409 stripe_discount_codes_active`, which names them in `codes` (the codes already deactivated stay so). Returns `200` with `disconnected` and `codes_still_active`: after a forced disconnection, the codes that may still be active at Stripe, to deactivate by hand in its Dashboard (empty otherwise).\n\n**Irreversible:** the key, the webhook secret and the Stripe ids of the catalogue are forgotten: connecting again takes a restricted key. The discount codes made in Keyseal never come back: new ones are made after connecting again.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `admin`.",
        "operationId": "stripe.disconnect",
        "parameters": [
          {
            "description": "True: disconnect even with running subscriptions, outstanding publisher checkouts or discount codes that cannot be deactivated (their texts come back in codes_still_active).",
            "in": "query",
            "name": "force",
            "required": false,
            "schema": {
              "default": false,
              "description": "True: disconnect even with running subscriptions, outstanding publisher checkouts or discount codes that cannot be deactivated (their texts come back in codes_still_active).",
              "title": "Force",
              "type": "boolean"
            }
          },
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StripeDisconnectedOut"
                }
              }
            },
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  },
                  "stripe_active_subscriptions": {
                    "summary": "stripe_active_subscriptions",
                    "value": {
                      "error": {
                        "code": "stripe_active_subscriptions",
                        "message": "Subscriptions are still running on this Stripe account; disconnect with force=true to go ahead anyway."
                      }
                    }
                  },
                  "stripe_connection_busy": {
                    "summary": "stripe_connection_busy",
                    "value": {
                      "error": {
                        "code": "stripe_connection_busy",
                        "message": "The Stripe connection cannot be changed now (another change is under way, or a payment could not be checked at Stripe): try again."
                      }
                    }
                  },
                  "stripe_discount_codes_active": {
                    "summary": "stripe_discount_codes_active",
                    "value": {
                      "error": {
                        "code": "stripe_discount_codes_active",
                        "message": "Discount codes may still be active at Stripe and could not be deactivated: try again later, or disconnect with force=true and deactivate them in the Stripe Dashboard."
                      }
                    }
                  },
                  "stripe_not_connected": {
                    "summary": "stripe_not_connected",
                    "value": {
                      "error": {
                        "code": "stripe_not_connected",
                        "message": "Stripe is not connected in this environment."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_in_progress, operator_busy, stripe_active_subscriptions, stripe_connection_busy, stripe_discount_codes_active, stripe_not_connected"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Disconnect Stripe",
        "tags": [
          "stripe"
        ]
      },
      "get": {
        "description": "The Stripe connection of the environment of the request: `connected`, the last 4 characters of the restricted key (`key_hint`), the webhook endpoint Keyseal made at Stripe (`webhook_endpoint`, `null` without one) and when the key was last checked (`checked_at`); never the key nor the webhook secret. Stripe is connected per environment: `test` with an `rk_test_…` key, `live` with an `rk_live_…` key.\n\n**Who may call:** Any member of the organization; an API key with the right `read` or `admin`.",
        "operationId": "stripe.get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StripeConnectionOut"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Read the Stripe connection",
        "tags": [
          "stripe"
        ]
      },
      "put": {
        "description": "Connect (or connect again) the Stripe account of the environment of the request with a restricted key: `rk_test_…` in `test`, `rk_live_…` in `live`; a secret `sk_…` key is refused. Keyseal checks the key, its mode, its permissions and Managed Payments, makes its webhook endpoint at Stripe, then pushes the whole catalogue of the environment. Returns the connection and, in `catalog`, the report of the push: a push that fails does not undo the connection (`catalog.synced` is `false`, `catalog.error` says why, `stripe.sync` catches up). A key of another Stripe account than the current connection's is `409 stripe_account_changed`: disconnect first. An API key of `test` connects the Stripe of test, never the one of live.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `admin`.",
        "operationId": "stripe.connect",
        "parameters": [
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StripeConnect"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StripeConnectedOut"
                }
              }
            },
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  },
                  "stripe_account_changed": {
                    "summary": "stripe_account_changed",
                    "value": {
                      "error": {
                        "code": "stripe_account_changed",
                        "message": "This key belongs to another Stripe account: disconnect Stripe first."
                      }
                    }
                  },
                  "stripe_connection_busy": {
                    "summary": "stripe_connection_busy",
                    "value": {
                      "error": {
                        "code": "stripe_connection_busy",
                        "message": "The Stripe connection cannot be changed now (another change is under way, or a payment could not be checked at Stripe): try again."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_in_progress, operator_busy, stripe_account_changed, stripe_connection_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  },
                  "stripe_key_invalid": {
                    "summary": "stripe_key_invalid",
                    "value": {
                      "error": {
                        "code": "stripe_key_invalid",
                        "message": "This is not a valid Stripe restricted key, or Stripe does not know it."
                      }
                    }
                  },
                  "stripe_key_not_restricted": {
                    "summary": "stripe_key_not_restricted",
                    "value": {
                      "error": {
                        "code": "stripe_key_not_restricted",
                        "message": "Use a Stripe restricted key (rk_…), never a secret key (sk_…)."
                      }
                    }
                  },
                  "stripe_key_wrong_mode": {
                    "summary": "stripe_key_wrong_mode",
                    "value": {
                      "error": {
                        "code": "stripe_key_wrong_mode",
                        "message": "This Stripe key is for the other mode: a test key in test, a live key in live."
                      }
                    }
                  },
                  "stripe_managed_payments_unavailable": {
                    "summary": "stripe_managed_payments_unavailable",
                    "value": {
                      "error": {
                        "code": "stripe_managed_payments_unavailable",
                        "message": "Managed Payments is not enabled or not available on this Stripe account."
                      }
                    }
                  },
                  "stripe_permissions_missing": {
                    "summary": "stripe_permissions_missing",
                    "value": {
                      "error": {
                        "code": "stripe_permissions_missing",
                        "message": "The restricted key lacks permissions Keyseal needs."
                      }
                    }
                  },
                  "stripe_webhook_endpoint_refused": {
                    "summary": "stripe_webhook_endpoint_refused",
                    "value": {
                      "error": {
                        "code": "stripe_webhook_endpoint_refused",
                        "message": "Stripe refused Keyseal's webhook endpoint for this account; check the account's webhook endpoints and try again."
                      }
                    }
                  },
                  "stripe_webhook_unreachable": {
                    "summary": "stripe_webhook_unreachable",
                    "value": {
                      "error": {
                        "code": "stripe_webhook_unreachable",
                        "message": "Keyseal's public address cannot receive Stripe notifications."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_request, stripe_key_invalid, stripe_key_not_restricted, stripe_key_wrong_mode, stripe_managed_payments_unavailable, stripe_permissions_missing, stripe_webhook_endpoint_refused, stripe_webhook_unreachable"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  },
                  "stripe_unavailable": {
                    "summary": "stripe_unavailable",
                    "value": {
                      "error": {
                        "code": "stripe_unavailable",
                        "message": "Stripe is unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable, stripe_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Connect Stripe with a restricted key",
        "tags": [
          "stripe"
        ]
      }
    },
    "/api/v1/stripe/sync": {
      "post": {
        "description": "Push the whole catalogue of the environment to Stripe: what a write could not push is caught up here. Returns the report: the products created and updated, the prices created and deactivated, and in `failures` the objects Stripe refused (skipped; the others are pushed). `synced` is `true` when everything passed. Stripe unreachable is `503 stripe_unavailable`: what was pushed before is kept, and the next push resumes.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `admin`.",
        "operationId": "stripe.sync",
        "parameters": [
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CatalogSyncOut"
                }
              }
            },
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  },
                  "stripe_not_connected": {
                    "summary": "stripe_not_connected",
                    "value": {
                      "error": {
                        "code": "stripe_not_connected",
                        "message": "Stripe is not connected in this environment."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_in_progress, operator_busy, stripe_not_connected"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  },
                  "stripe_permissions_missing": {
                    "summary": "stripe_permissions_missing",
                    "value": {
                      "error": {
                        "code": "stripe_permissions_missing",
                        "message": "The restricted key lacks permissions Keyseal needs."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_request, stripe_permissions_missing"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  },
                  "stripe_unavailable": {
                    "summary": "stripe_unavailable",
                    "value": {
                      "error": {
                        "code": "stripe_unavailable",
                        "message": "Stripe is unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable, stripe_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Push the catalogue to Stripe",
        "tags": [
          "stripe"
        ]
      }
    },
    "/api/v1/usage": {
      "get": {
        "description": "Current gauges and daily usage across the entire environment. Members are counted for the entire organization. Missing past gauge samples and untracked counters are null. Dates are inclusive UTC calendar dates, at most 366 days apart including both ends. The default is the 30 days ending today. Future dates are accepted and the daily series stops at the observation time. A reversed or excessive range is 422 invalid_request.\n\n**Who may call:** Any member of the organization; an API key with the right `read` (or `admin`, which implies every right).",
        "operationId": "usage.get",
        "parameters": [
          {
            "description": "First UTC date (YYYY-MM-DD), inclusive. Defaults to 29 days before to.",
            "in": "query",
            "name": "from",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "First UTC date (YYYY-MM-DD), inclusive. Defaults to 29 days before to.",
              "title": "From"
            }
          },
          {
            "description": "Last UTC date (YYYY-MM-DD), inclusive. Defaults to today.",
            "in": "query",
            "name": "to",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Last UTC date (YYYY-MM-DD), inclusive. Defaults to today.",
              "title": "To"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageReport"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Read publisher usage",
        "tags": [
          "usage"
        ]
      }
    },
    "/api/v1/webhooks/deliveries": {
      "get": {
        "description": "The journal of the environment of the request: one delivery per event and endpoint, newest first, by pages, kept for the plan retention period (30 days in beta). Filters: `endpoint_id` (`whe_…`), `status` (`pending`, `sending`, `succeeded`, `failed`), `type` (an event type, or `ping`). Each says its attempts, the endpoint's last HTTP status and `last_error`; `webhooks.deliveries.get` adds the body sent and the start of the answer.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `admin`.",
        "operationId": "webhooks.deliveries.list",
        "parameters": [
          {
            "description": "Only the deliveries to this endpoint, whe_…",
            "in": "query",
            "name": "endpoint_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Only the deliveries to this endpoint, whe_…",
              "title": "Endpoint Id"
            }
          },
          {
            "description": "Only the deliveries in this status.",
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/WebhookDeliveryStatus"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Only the deliveries in this status.",
              "title": "Status"
            }
          },
          {
            "description": "Only the deliveries of this event type (order.created, ping…).",
            "in": "query",
            "name": "type",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Only the deliveries of this event type (order.created, ping…).",
              "title": "Type"
            }
          },
          {
            "description": "The page size, 1 to 100; 50 by default.",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "description": "The page size, 1 to 100; 50 by default.",
              "maximum": 100,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "description": "The next_cursor of the previous page; left out for the first page.",
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "The next_cursor of the previous page; left out for the first page.",
              "title": "Cursor"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookDeliveriesResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "List the webhook deliveries",
        "tags": [
          "webhooks"
        ]
      }
    },
    "/api/v1/webhooks/deliveries/{delivery_id}": {
      "get": {
        "description": "One delivery (`whd_…`) with the body sent (`payload`: `id`, `type`, `created`, `environment`, `data`) and the first 1024 bytes of the endpoint's last answer (`response_excerpt`).\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `admin`.",
        "operationId": "webhooks.deliveries.get",
        "parameters": [
          {
            "description": "The webhook delivery's id, `whd_…`.",
            "in": "path",
            "name": "delivery_id",
            "required": true,
            "schema": {
              "description": "The webhook delivery's id, `whd_…`.",
              "title": "Delivery Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookDeliveryDetail"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  },
                  "webhook_delivery_not_found": {
                    "summary": "webhook_delivery_not_found",
                    "value": {
                      "error": {
                        "code": "webhook_delivery_not_found",
                        "message": "There is no such webhook delivery in this organization and environment."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found, webhook_delivery_not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Read a webhook delivery",
        "tags": [
          "webhooks"
        ]
      }
    },
    "/api/v1/webhooks/deliveries/{delivery_id}/retry": {
      "post": {
        "description": "Put a delivery back in the queue, due now, its attempts at zero (nine more tries, about 3 days), whatever its status: a `failed` one is sent again, a `succeeded` one once more (the receiver deduplicates by the event's `id`). Its `last_error` is cleared. A delivery whose endpoint was deleted is `404 webhook_endpoint_not_found`; one a worker is sending right now is `409 webhook_delivery_in_progress` (retry once its attempt is over). Returns the delivery, `pending`.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `admin`.",
        "operationId": "webhooks.deliveries.retry",
        "parameters": [
          {
            "description": "The webhook delivery's id, `whd_…`.",
            "in": "path",
            "name": "delivery_id",
            "required": true,
            "schema": {
              "description": "The webhook delivery's id, `whd_…`.",
              "title": "Delivery Id",
              "type": "string"
            }
          },
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookDeliveryOut"
                }
              }
            },
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  },
                  "webhook_delivery_not_found": {
                    "summary": "webhook_delivery_not_found",
                    "value": {
                      "error": {
                        "code": "webhook_delivery_not_found",
                        "message": "There is no such webhook delivery in this organization and environment."
                      }
                    }
                  },
                  "webhook_endpoint_not_found": {
                    "summary": "webhook_endpoint_not_found",
                    "value": {
                      "error": {
                        "code": "webhook_endpoint_not_found",
                        "message": "There is no such webhook endpoint in this organization and environment."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found, webhook_delivery_not_found, webhook_endpoint_not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  },
                  "webhook_delivery_in_progress": {
                    "summary": "webhook_delivery_in_progress",
                    "value": {
                      "error": {
                        "code": "webhook_delivery_in_progress",
                        "message": "This delivery is being sent right now: try again once its attempt is over."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_in_progress, operator_busy, webhook_delivery_in_progress"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Send a webhook delivery again",
        "tags": [
          "webhooks"
        ]
      }
    },
    "/api/v1/webhooks/endpoints": {
      "get": {
        "description": "The webhook endpoints of the environment of the request (at most 10), oldest first: their address, the events they receive, whether they are active. Never a secret.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `admin`.",
        "operationId": "webhooks.endpoints.list",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1.0,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1.0,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "List the webhook endpoints",
        "tags": [
          "webhooks"
        ]
      },
      "post": {
        "description": "Create an endpoint of the environment of the request, where Keyseal POSTs the events chosen, each signed with the endpoint's secret (header `Keyseal-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256(secret, \"<t>.<body>\")>`). `url`: `https://` only, 2048 characters at most, a public host name: `localhost`, a name without a dot, credentials or an internal IP address are `422 invalid_webhook_url` (a name resolving to an internal address is refused at each delivery). `events`: one or more of `webhooks.event_types.list`, or `[\"*\"]` alone for all, those added later included (`422 invalid_webhook_events` otherwise). `description`: a note, 500 characters at most. `active`: `true` by default. At most 10 endpoints per environment (`409 webhook_endpoint_limit_reached`). Returns the endpoint with its signing secret in `secret`, **the only time it is shown**: keep it at once (`Cache-Control: no-store`).\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `admin`.\n\n**Idempotency:** not supported: a request with `Idempotency-Key` is refused (`400 idempotency_not_supported`). The answer carries the endpoint's signing secret in clear, shown this once and never kept for a replay: if the answer was lost, find the endpoint in `webhooks.endpoints.list` and give it a new secret (`webhooks.endpoints.rotate_secret`), or delete it.",
        "operationId": "webhooks.endpoints.create",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEndpointCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointWithSecret"
                }
              }
            },
            "description": "Successful Response"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_not_supported": {
                    "summary": "idempotency_not_supported",
                    "value": {
                      "error": {
                        "code": "idempotency_not_supported",
                        "message": "This operation does not take an Idempotency-Key: send it without the header."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_not_supported"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  },
                  "webhook_endpoint_limit_reached": {
                    "summary": "webhook_endpoint_limit_reached",
                    "value": {
                      "error": {
                        "code": "webhook_endpoint_limit_reached",
                        "message": "This environment has 10 webhook endpoints already: delete one first."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy, webhook_endpoint_limit_reached"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  },
                  "invalid_webhook_events": {
                    "summary": "invalid_webhook_events",
                    "value": {
                      "error": {
                        "code": "invalid_webhook_events",
                        "message": "Choose one or more known event types (webhooks.event_types.list), or [\"*\"] alone for all."
                      }
                    }
                  },
                  "invalid_webhook_url": {
                    "summary": "invalid_webhook_url",
                    "value": {
                      "error": {
                        "code": "invalid_webhook_url",
                        "message": "A webhook endpoint is an https:// address of 2048 characters at most, without credentials, on a public host name (not localhost, not an internal address)."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request, invalid_webhook_events, invalid_webhook_url"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1.0,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1.0,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Create a webhook endpoint",
        "tags": [
          "webhooks"
        ]
      }
    },
    "/api/v1/webhooks/endpoints/{endpoint_id}": {
      "delete": {
        "description": "Delete an endpoint: nothing more is sent to it, and its deliveries still pending fail (`endpoint_deleted`). Its deliveries stay in the journal, their `endpoint_id` set to `null`; they cannot be sent again. Returns `204`.\n\n**Irreversible:** the endpoint and its secret are gone, and its pending deliveries are failed for good: make a new endpoint, with a new secret.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `admin`.",
        "operationId": "webhooks.endpoints.delete",
        "parameters": [
          {
            "description": "The webhook endpoint's id, `whe_…`.",
            "in": "path",
            "name": "endpoint_id",
            "required": true,
            "schema": {
              "description": "The webhook endpoint's id, `whe_…`.",
              "title": "Endpoint Id",
              "type": "string"
            }
          },
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  },
                  "webhook_endpoint_not_found": {
                    "summary": "webhook_endpoint_not_found",
                    "value": {
                      "error": {
                        "code": "webhook_endpoint_not_found",
                        "message": "There is no such webhook endpoint in this organization and environment."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found, webhook_endpoint_not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_in_progress, operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Delete a webhook endpoint",
        "tags": [
          "webhooks"
        ]
      },
      "get": {
        "description": "One endpoint (`whe_…`) of the environment of the request: its address, its description, the events it receives, whether it is active. Never its secret.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `admin`.",
        "operationId": "webhooks.endpoints.get",
        "parameters": [
          {
            "description": "The webhook endpoint's id, `whe_…`.",
            "in": "path",
            "name": "endpoint_id",
            "required": true,
            "schema": {
              "description": "The webhook endpoint's id, `whe_…`.",
              "title": "Endpoint Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointOut"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  },
                  "webhook_endpoint_not_found": {
                    "summary": "webhook_endpoint_not_found",
                    "value": {
                      "error": {
                        "code": "webhook_endpoint_not_found",
                        "message": "There is no such webhook endpoint in this organization and environment."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found, webhook_endpoint_not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Read a webhook endpoint",
        "tags": [
          "webhooks"
        ]
      },
      "patch": {
        "description": "Change the fields sent among `url`, `description`, `events` and `active`, each checked as at creation (`422 invalid_webhook_url`, `422 invalid_webhook_events`); `null` is refused. An endpoint made inactive receives nothing: the deliveries due meanwhile fail with `endpoint_disabled` (`webhooks.deliveries.retry` sends one again once it is active). An event type removed from `events` is no longer sent, even a delivery already queued (`event_not_selected`). Returns the endpoint.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `admin`.",
        "operationId": "webhooks.endpoints.update",
        "parameters": [
          {
            "description": "The webhook endpoint's id, `whe_…`.",
            "in": "path",
            "name": "endpoint_id",
            "required": true,
            "schema": {
              "description": "The webhook endpoint's id, `whe_…`.",
              "title": "Endpoint Id",
              "type": "string"
            }
          },
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEndpointUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointOut"
                }
              }
            },
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  },
                  "webhook_endpoint_not_found": {
                    "summary": "webhook_endpoint_not_found",
                    "value": {
                      "error": {
                        "code": "webhook_endpoint_not_found",
                        "message": "There is no such webhook endpoint in this organization and environment."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found, webhook_endpoint_not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_in_progress, operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  },
                  "invalid_webhook_events": {
                    "summary": "invalid_webhook_events",
                    "value": {
                      "error": {
                        "code": "invalid_webhook_events",
                        "message": "Choose one or more known event types (webhooks.event_types.list), or [\"*\"] alone for all."
                      }
                    }
                  },
                  "invalid_webhook_url": {
                    "summary": "invalid_webhook_url",
                    "value": {
                      "error": {
                        "code": "invalid_webhook_url",
                        "message": "A webhook endpoint is an https:// address of 2048 characters at most, without credentials, on a public host name (not localhost, not an internal address)."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_request, invalid_webhook_events, invalid_webhook_url"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Update a webhook endpoint",
        "tags": [
          "webhooks"
        ]
      }
    },
    "/api/v1/webhooks/endpoints/{endpoint_id}/rotate-secret": {
      "post": {
        "description": "Give the endpoint a new signing secret, at once: every delivery from now on, those already queued included, is signed with the new one. Update the receiver right after. Returns the endpoint with its signing secret in `secret`, **the only time it is shown**: keep it at once (`Cache-Control: no-store`).\n\n**Irreversible:** the old secret signs nothing more and cannot be brought back.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `admin`.\n\n**Idempotency:** not supported: a request with `Idempotency-Key` is refused (`400 idempotency_not_supported`). The answer carries the new signing secret in clear, shown this once and never kept for a replay: if the answer was lost, rotate again (the lost secret then signs nothing).",
        "operationId": "webhooks.endpoints.rotate_secret",
        "parameters": [
          {
            "description": "The webhook endpoint's id, `whe_…`.",
            "in": "path",
            "name": "endpoint_id",
            "required": true,
            "schema": {
              "description": "The webhook endpoint's id, `whe_…`.",
              "title": "Endpoint Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointWithSecret"
                }
              }
            },
            "description": "Successful Response"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_not_supported": {
                    "summary": "idempotency_not_supported",
                    "value": {
                      "error": {
                        "code": "idempotency_not_supported",
                        "message": "This operation does not take an Idempotency-Key: send it without the header."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_not_supported"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  },
                  "webhook_endpoint_not_found": {
                    "summary": "webhook_endpoint_not_found",
                    "value": {
                      "error": {
                        "code": "webhook_endpoint_not_found",
                        "message": "There is no such webhook endpoint in this organization and environment."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found, webhook_endpoint_not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Replace a webhook endpoint's secret",
        "tags": [
          "webhooks"
        ]
      }
    },
    "/api/v1/webhooks/endpoints/{endpoint_id}/test": {
      "post": {
        "description": "Queue a `ping` event to this endpoint alone, whatever events it chose, signed like any other: its `data` is `{\"endpoint_id\": \"whe_…\"}`. The worker sends it within seconds; `webhooks.deliveries.get` then shows the endpoint's answer. An inactive endpoint is not sent to: the delivery fails with `endpoint_disabled`. Returns `202` with the delivery, `pending`.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `admin`.",
        "operationId": "webhooks.endpoints.test",
        "parameters": [
          {
            "description": "The webhook endpoint's id, `whe_…`.",
            "in": "path",
            "name": "endpoint_id",
            "required": true,
            "schema": {
              "description": "The webhook endpoint's id, `whe_…`.",
              "title": "Endpoint Id",
              "type": "string"
            }
          },
          {
            "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^[!-~]{1,255}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional: makes a retry of this write safe. A key of 1 to 255 visible ASCII characters (a new UUID per write is a good one). Within 24 hours, the same key sent again by the same caller (the same person or API key) in the same organization and environment, with the same method, path, query and body, does not run the write again: it answers the first answer again (a success or a 4xx refusal), with the header `Idempotent-Replayed: true`. The same key with another request is `422 idempotency_key_reused`. `409 idempotency_key_in_progress` means the first request has not answered: it still runs, or it stopped after its change without its answer being kept; check the state of what it changes, then use a new key if the write must still be made. Not kept, so that a retry with the same key runs the write: a 5xx, a 429 or `409 stripe_connection_busy` (a \"try again\"), and an answer larger than 256 KiB, as long as the write changed nothing; a failure after the write made its change leaves the key `409 idempotency_key_in_progress` for 24 hours instead (never a second effect).",
              "title": "Idempotency-Key"
            }
          }
        ],
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookDeliveryOut"
                }
              }
            },
            "description": "Successful Response",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this answer is the stored answer of an earlier request with the same `Idempotency-Key`, sent again without running the write again; absent otherwise.",
                "schema": {
                  "enum": [
                    "true"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  },
                  "webhook_endpoint_not_found": {
                    "summary": "webhook_endpoint_not_found",
                    "value": {
                      "error": {
                        "code": "webhook_endpoint_not_found",
                        "message": "There is no such webhook endpoint in this organization and environment."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found, webhook_endpoint_not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_in_progress": {
                    "summary": "idempotency_key_in_progress",
                    "value": {
                      "error": {
                        "code": "idempotency_key_in_progress",
                        "message": "The request first sent with this Idempotency-Key has not answered: it still runs, or it stopped without its answer being kept. Check the state of what it changes, then use a new key if the write must still be made."
                      }
                    }
                  },
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_in_progress, operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "idempotency_key_reused": {
                    "summary": "idempotency_key_reused",
                    "value": {
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was used for another request (method, path, query or body) in the last 24 hours: use a new key for a new request."
                      }
                    }
                  },
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "idempotency_key_reused, invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "Send a test event to a webhook endpoint",
        "tags": [
          "webhooks"
        ]
      }
    },
    "/api/v1/webhooks/event-types": {
      "get": {
        "description": "The event types an endpoint may choose, in `events`; `[\"*\"]` chooses them all, those added later included. `ping` is not one: only `webhooks.endpoints.test` sends it.\n\n**Who may call:** A person with the role `admin` or `owner`; an API key with the right `admin`.",
        "operationId": "webhooks.event_types.list",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEventTypesResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/json": {
                "examples": {
                  "unauthenticated": {
                    "summary": "unauthenticated",
                    "value": {
                      "error": {
                        "code": "unauthenticated",
                        "message": "A valid Clerk session or API key is required."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "unauthenticated",
            "headers": {
              "WWW-Authenticate": {
                "description": "The challenge of the bearer scheme: send `Authorization: Bearer` with a valid API key or Clerk session token.",
                "schema": {
                  "enum": [
                    "Bearer realm=\"keyseal\""
                  ],
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "forbidden": {
                    "summary": "forbidden",
                    "value": {
                      "error": {
                        "code": "forbidden",
                        "message": "Your role or your key's rights do not allow this."
                      }
                    }
                  },
                  "scope_mismatch": {
                    "summary": "scope_mismatch",
                    "value": {
                      "error": {
                        "code": "scope_mismatch",
                        "message": "The organization or environment asked for is not the API key's."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "forbidden, scope_mismatch"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "not_found": {
                    "summary": "not_found",
                    "value": {
                      "error": {
                        "code": "not_found",
                        "message": "There is nothing at this address."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "not_found"
          },
          "409": {
            "content": {
              "application/json": {
                "examples": {
                  "operator_busy": {
                    "summary": "operator_busy",
                    "value": {
                      "error": {
                        "code": "operator_busy",
                        "message": "Another operator request is in progress. Try again shortly."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "operator_busy"
          },
          "413": {
            "content": {
              "application/json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "payload_too_large",
                    "value": {
                      "error": {
                        "code": "payload_too_large",
                        "message": "The request body is too large."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "payload_too_large"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "invalid_request": {
                    "summary": "invalid_request",
                    "value": {
                      "error": {
                        "code": "invalid_request",
                        "message": "The request is invalid."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "invalid_request"
          },
          "429": {
            "content": {
              "application/json": {
                "examples": {
                  "billing_limit_reached": {
                    "summary": "billing_limit_reached",
                    "value": {
                      "error": {
                        "code": "billing_limit_reached",
                        "message": "The publisher has reached a plan limit."
                      }
                    }
                  },
                  "rate_limited": {
                    "summary": "rate_limited",
                    "value": {
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "billing_limit_reached, rate_limited",
            "headers": {
              "Retry-After": {
                "description": "With `rate_limited`: the whole seconds before the allowance's window resets; wait them, then retry. The daily caps (`*_limit_reached`) send none: they free up as the oldest item counted turns 24 hours old.",
                "schema": {
                  "minimum": 1.0,
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/json": {
                "examples": {
                  "auth_unavailable": {
                    "summary": "auth_unavailable",
                    "value": {
                      "error": {
                        "code": "auth_unavailable",
                        "message": "Authentication is unavailable, try again later."
                      }
                    }
                  },
                  "billing_unavailable": {
                    "summary": "billing_unavailable",
                    "value": {
                      "error": {
                        "code": "billing_unavailable",
                        "message": "The platform billing configuration is unavailable."
                      }
                    }
                  },
                  "limits_unavailable": {
                    "summary": "limits_unavailable",
                    "value": {
                      "error": {
                        "code": "limits_unavailable",
                        "message": "Request limits are unavailable, try again later."
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "auth_unavailable, billing_unavailable, limits_unavailable",
            "headers": {
              "Retry-After": {
                "description": "30, with a provider that did not answer (`auth_unavailable`, `billing_outcome_unknown`, `limits_unavailable`, `ls_unavailable`, `storage_unavailable`, `stripe_unavailable`): the whole seconds after which the request may be retried (an estimate: the end of the outage is not known). Absent when the service is not configured (`mail_unavailable`, no file store, no Clerk): no retry gets through, tell the operator.",
                "schema": {
                  "minimum": 1.0,
                  "type": "integer"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "summary": "List the webhook event types",
        "tags": [
          "webhooks"
        ]
      }
    }
  }
}
