{
  "openapi": "3.1.0",
  "info": {
    "title": "Billstrato API",
    "version": "2026-11-01",
    "summary": "One billing layer for Stripe, PayPal, Mollie, Klarna, the App Store and Google Play.",
    "description": "Secret keys (sk_…) belong on servers and are scoped to one project and environment, so project_uuid and environment can be left out. Apps use a publishable key (pk_…) and a customer token from POST /customers/session. Errors answer { error, error_code }; error codes are listed in https://billstrato.com/atlas.json. Webhooks are described there too.",
    "contact": {
      "name": "Billstrato",
      "url": "https://billstrato.com",
      "email": "support@oriven.tech"
    }
  },
  "servers": [
    {
      "url": "https://api.billstrato.com/api/v1"
    }
  ],
  "externalDocs": {
    "url": "https://billstrato.com/docs",
    "description": "Documentation"
  },
  "components": {
    "securitySchemes": {
      "secretKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "A secret key, sk_test_… for the sandbox, sk_live_… for production."
      },
      "publishableKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Billstrato-Key",
        "description": "A publishable key, safe in apps and browsers."
      },
      "customerToken": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Billstrato-Customer",
        "description": "A customer token from POST /customers/session or POST /client/anonymous."
      }
    },
    "responses": {
      "Error": {
        "description": "Error",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "required": [
                "error",
                "error_code"
              ],
              "properties": {
                "error": {
                  "type": "string"
                },
                "error_code": {
                  "type": "string",
                  "description": "See atlas.json errors"
                },
                "field_errors": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "paths": {
    "/analytics/export": {
      "get": {
        "operationId": "exportBookings",
        "summary": "Succeeded transactions of a period for bookkeeping: format csv, or datev for a DATEV Buchungsstapel (EXTF 700) in SKR03 or SKR04 (chart; default from the project settings)",
        "description": "Succeeded transactions of a period for bookkeeping: format csv, or datev for a DATEV Buchungsstapel (EXTF 700) in SKR03 or SKR04 (chart; default from the project settings). Answers { filename, content, encoding, rows }; with encoding latin1-bytes each character is one Windows-1252 byte.",
        "tags": [
          "Project and analytics"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "analytics:own:read",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "First day, YYYY-MM-DD, in the project's time zone"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Last day, YYYY-MM-DD, inclusive"
            }
          },
          {
            "name": "format",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "csv",
                "datev"
              ],
              "description": "csv or datev"
            }
          },
          {
            "name": "chart",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "SKR03",
                "SKR04"
              ],
              "description": "DATEV chart of accounts: SKR03 or SKR04. Empty: the project's setting"
            }
          }
        ]
      }
    },
    "/analytics/report": {
      "get": {
        "operationId": "analyticsReport",
        "summary": "Revenue, MRR (with at risk and in trial apart), churn, trial conversion, cohorts, LTV and refund rate, in the project's reporting currency (ECB rates) and time zone",
        "description": "Revenue, MRR (with at risk and in trial apart), churn, trial conversion, cohorts, LTV and refund rate, in the project's reporting currency (ECB rates) and time zone.",
        "tags": [
          "Project and analytics"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "analytics:own:read",
        "parameters": [
          {
            "name": "days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 400,
              "description": "Window in days, 1 to 400 (default 30)"
            }
          }
        ]
      }
    },
    "/catalog/discounts/archive": {
      "post": {
        "operationId": "archiveDiscount",
        "summary": "Stop a promotion code",
        "description": "Stop a promotion code.",
        "tags": [
          "Catalog"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "catalog:own:delete",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "code"
                ],
                "properties": {
                  "code": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/catalog/discounts/store_offers/import_codes": {
      "post": {
        "operationId": "importOfferCodes",
        "summary": "Add offer codes from the CSV file of App Store Connect",
        "description": "Add offer codes from the CSV file of App Store Connect.",
        "tags": [
          "Catalog"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "catalog:own:update",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "code",
                  "csv",
                  "expires_at"
                ],
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "csv": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 2000000
                  },
                  "expires_at": {
                    "type": "string",
                    "format": "date-time"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/catalog/discounts/store_offers/remove": {
      "post": {
        "operationId": "removeStoreOffer",
        "summary": "Stop applying a code in one store",
        "description": "Stop applying a code in one store.",
        "tags": [
          "Catalog"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "catalog:own:delete",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "code",
                  "store"
                ],
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "store": {
                    "type": "string",
                    "enum": [
                      "app_store",
                      "play_store"
                    ]
                  }
                }
              }
            }
          }
        }
      }
    },
    "/catalog/discounts/store_offers/request_codes": {
      "post": {
        "operationId": "requestOfferCodes",
        "summary": "Order one-time-use offer codes from App Store Connect now",
        "description": "Order one-time-use offer codes from App Store Connect now.",
        "tags": [
          "Catalog"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "catalog:own:update",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "code"
                ],
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "number_of_codes": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 25000
                  }
                }
              }
            }
          }
        }
      }
    },
    "/catalog/discounts/store_offers/upsert": {
      "post": {
        "operationId": "upsertStoreOffer",
        "summary": "Link a promotion code to an App Store or Google Play offer",
        "description": "Link a promotion code to an App Store or Google Play offer.",
        "tags": [
          "Catalog"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "catalog:own:update",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "code",
                  "store",
                  "kind",
                  "store_product_id"
                ],
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "store": {
                    "type": "string",
                    "enum": [
                      "app_store",
                      "play_store"
                    ]
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "offer_code_pool",
                      "custom_offer_code",
                      "promotional_offer",
                      "developer_offer"
                    ]
                  },
                  "store_product_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "offer_id": {
                    "type": "string",
                    "maxLength": 255
                  },
                  "base_plan_id": {
                    "type": "string",
                    "maxLength": 120
                  },
                  "reference_name": {
                    "type": "string",
                    "maxLength": 255
                  },
                  "custom_code": {
                    "type": "string",
                    "maxLength": 64
                  },
                  "active": {
                    "type": "boolean"
                  },
                  "low_watermark": {
                    "type": "integer"
                  },
                  "batch_size": {
                    "type": "integer"
                  },
                  "batch_validity_days": {
                    "type": "integer"
                  },
                  "daily_issue_cap": {
                    "type": "integer"
                  },
                  "quarterly_budget": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/catalog/discounts/store_offers": {
      "get": {
        "operationId": "listStoreOffers",
        "summary": "Store offers with the offer code stock",
        "description": "Store offers with the offer code stock. Never the codes themselves.",
        "tags": [
          "Catalog"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "catalog:own:list"
      }
    },
    "/catalog/discounts/upsert": {
      "post": {
        "operationId": "upsertDiscount",
        "summary": "Create a promotion code",
        "description": "Create a promotion code.",
        "tags": [
          "Catalog"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "catalog:own:update",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "code",
                  "name",
                  "discount_type"
                ],
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 60
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 160
                  },
                  "discount_type": {
                    "type": "string",
                    "enum": [
                      "percentage",
                      "fixed_amount"
                    ]
                  },
                  "percent_bps": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 10000
                  },
                  "amount_minor": {
                    "type": "integer"
                  },
                  "currency": {
                    "type": "string"
                  },
                  "duration": {
                    "type": "string",
                    "enum": [
                      "once",
                      "repeating",
                      "forever"
                    ]
                  },
                  "duration_months": {
                    "type": "integer"
                  },
                  "product_identifier": {
                    "type": "string"
                  },
                  "max_redemptions": {
                    "type": "integer"
                  },
                  "expires_at": {
                    "type": "string",
                    "format": "date-time"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/catalog/entitlements/delete": {
      "post": {
        "operationId": "deleteEntitlement",
        "summary": "Delete an unused entitlement",
        "description": "Delete an unused entitlement.",
        "tags": [
          "Catalog"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "catalog:own:delete",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "identifier"
                ],
                "properties": {
                  "identifier": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/catalog/entitlements/upsert": {
      "post": {
        "operationId": "upsertEntitlement",
        "summary": "Create or update an entitlement",
        "description": "Create or update an entitlement.",
        "tags": [
          "Catalog"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "catalog:own:update",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "identifier",
                  "display_name"
                ],
                "properties": {
                  "identifier": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "display_name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "description": {
                    "type": "string"
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "feature",
                      "credits"
                    ]
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Any unique string; a retry with the same key and body never acts twice."
          }
        ]
      }
    },
    "/catalog/import/preview": {
      "get": {
        "operationId": "previewCatalogImport",
        "summary": "Products that exist at a provider",
        "description": "Products that exist at a provider.",
        "tags": [
          "Catalog"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "catalog:own:read",
        "parameters": [
          {
            "name": "provider",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "stripe",
                "paypal",
                "mollie",
                "klarna",
                "app_store",
                "play_store"
              ]
            }
          }
        ]
      }
    },
    "/catalog/import": {
      "post": {
        "operationId": "importCatalog",
        "summary": "Import selected ones",
        "description": "Import selected ones.",
        "tags": [
          "Catalog"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "catalog:own:update",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "provider",
                  "external_price_ids"
                ],
                "properties": {
                  "provider": {
                    "type": "string",
                    "enum": [
                      "stripe",
                      "paypal",
                      "mollie",
                      "klarna",
                      "app_store",
                      "play_store"
                    ]
                  },
                  "external_price_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/catalog/mappings/set": {
      "post": {
        "operationId": "setPriceMapping",
        "summary": "Link a price to a provider product",
        "description": "Link a price to a provider product.",
        "tags": [
          "Catalog"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "catalog:own:update",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "price_uuid",
                  "provider",
                  "external_product_id"
                ],
                "properties": {
                  "price_uuid": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "provider": {
                    "type": "string",
                    "enum": [
                      "stripe",
                      "paypal",
                      "mollie",
                      "klarna",
                      "app_store",
                      "play_store"
                    ]
                  },
                  "external_product_id": {
                    "type": "string",
                    "maxLength": 255
                  },
                  "external_price_id": {
                    "type": "string",
                    "maxLength": 255
                  }
                }
              }
            }
          }
        }
      }
    },
    "/catalog/offerings/delete": {
      "post": {
        "operationId": "deleteOffering",
        "summary": "Delete an offering",
        "description": "Delete an offering.",
        "tags": [
          "Catalog"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "catalog:own:delete",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "identifier"
                ],
                "properties": {
                  "identifier": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/catalog/offerings/upsert": {
      "post": {
        "operationId": "upsertOffering",
        "summary": "Create or update an offering",
        "description": "Create or update an offering.",
        "tags": [
          "Catalog"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "catalog:own:update",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "identifier",
                  "name",
                  "packages"
                ],
                "properties": {
                  "identifier": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 160
                  },
                  "is_default": {
                    "type": "boolean"
                  },
                  "metadata": {
                    "description": "JSON"
                  },
                  "packages": {
                    "description": "JSON. List of {identifier, price_uuid}"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/catalog/prices/migrate": {
      "post": {
        "operationId": "migratePrice",
        "summary": "Move running subscriptions to another price on a date at least 30 days ahead: notify for a lower price, opt_in (the customer must agree) for a higher one",
        "description": "Move running subscriptions to another price on a date at least 30 days ahead: notify for a lower price, opt_in (the customer must agree) for a higher one.",
        "tags": [
          "Catalog"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "catalog:own:update",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "from_price_uuid",
                  "to_price_uuid",
                  "effective_at"
                ],
                "properties": {
                  "from_price_uuid": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "to_price_uuid": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "mode": {
                    "type": "string",
                    "enum": [
                      "notify",
                      "opt_in"
                    ],
                    "description": "notify (lower or equal price) or opt_in (higher price: the customer must agree). Default: chosen from the amounts."
                  },
                  "effective_at": {
                    "type": "string",
                    "format": "date-time",
                    "description": "At least 30 days ahead. Each subscription switches at its first renewal on or after this date."
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 500
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Any unique string; a retry with the same key and body never acts twice."
          }
        ]
      }
    },
    "/catalog/prices/migrations/cancel": {
      "post": {
        "operationId": "cancelPriceMigration",
        "summary": "Stop a price migration before its date",
        "description": "Stop a price migration before its date.",
        "tags": [
          "Catalog"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "catalog:own:update",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "migration_uuid"
                ],
                "properties": {
                  "migration_uuid": {
                    "type": "string",
                    "format": "uuid"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/catalog/prices/migrations": {
      "get": {
        "operationId": "listPriceMigrations",
        "summary": "Price migrations with counts per state",
        "description": "Price migrations with counts per state.",
        "tags": [
          "Catalog"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "catalog:own:read"
      }
    },
    "/catalog/products/archive": {
      "post": {
        "operationId": "archiveProduct",
        "summary": "Stop selling a product",
        "description": "Stop selling a product.",
        "tags": [
          "Catalog"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "catalog:own:delete",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "identifier"
                ],
                "properties": {
                  "identifier": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/catalog/products/owners": {
      "get": {
        "operationId": "productOwners",
        "summary": "How many subscribers and one-time buyers own a product, before you change what it unlocks",
        "description": "How many subscribers and one-time buyers own a product, before you change what it unlocks. existing_owners on upsert decides: apply_now, at_renewal or keep.",
        "tags": [
          "Catalog"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "catalog:own:read",
        "parameters": [
          {
            "name": "identifier",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 80
            }
          }
        ]
      }
    },
    "/catalog/products/upsert": {
      "post": {
        "operationId": "upsertProduct",
        "summary": "Create or update a product with prices and entitlements, then mirror it to every provider",
        "description": "Create or update a product with prices and entitlements, then mirror it to every provider.",
        "tags": [
          "Catalog"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "catalog:own:update",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "identifier",
                  "name",
                  "kind"
                ],
                "properties": {
                  "identifier": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 160
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "subscription",
                      "consumable",
                      "non_consumable",
                      "physical"
                    ]
                  },
                  "description": {
                    "type": "string"
                  },
                  "image_url": {
                    "type": "string"
                  },
                  "tax_category": {
                    "type": "string"
                  },
                  "entitlements": {
                    "description": "JSON. List of {identifier, credits, credit_policy (reset|accumulate), credit_interval (period|month)}"
                  },
                  "prices": {
                    "description": "JSON. List of {currency, amount_minor, interval, interval_count, trial_days, nickname}"
                  },
                  "metadata": {
                    "description": "JSON"
                  },
                  "existing_owners": {
                    "type": "string",
                    "enum": [
                      "apply_now",
                      "at_renewal",
                      "keep"
                    ],
                    "description": "When the entitlements change and people own the product: apply_now (default), at_renewal or keep"
                  },
                  "notify": {
                    "type": "boolean",
                    "description": "Send customer.product_changed for every owner whose access changes, so your app can tell them"
                  },
                  "remove_from_lifetime": {
                    "type": "boolean",
                    "description": "With apply_now: also take removed entitlements from one-time buyers. Off by default: they keep what they paid for."
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Any unique string; a retry with the same key and body never acts twice."
          }
        ]
      }
    },
    "/catalog/sync/retry": {
      "post": {
        "operationId": "retryCatalogSync",
        "summary": "Retry failed syncs",
        "description": "Retry failed syncs.",
        "tags": [
          "Catalog"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "catalog:own:update",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [],
                "properties": {}
              }
            }
          }
        }
      }
    },
    "/checkout/create": {
      "post": {
        "operationId": "createCheckout",
        "summary": "Start a hosted checkout",
        "description": "Start a hosted checkout.",
        "tags": [
          "Checkout and subscriptions"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "commerce:own:create",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "app_user_id",
                  "provider",
                  "items",
                  "success_url",
                  "cancel_url"
                ],
                "properties": {
                  "app_user_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "provider": {
                    "type": "string",
                    "enum": [
                      "auto",
                      "stripe",
                      "paypal",
                      "mollie",
                      "klarna"
                    ]
                  },
                  "items": {
                    "description": "JSON. List of {price_uuid | product, quantity} or {name, amount_minor, currency, quantity}"
                  },
                  "success_url": {
                    "type": "string"
                  },
                  "cancel_url": {
                    "type": "string"
                  },
                  "discount_code": {
                    "type": "string"
                  },
                  "payment_methods": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "locale": {
                    "type": "string"
                  },
                  "metadata": {
                    "description": "JSON"
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Any unique string; a retry with the same key and body never acts twice."
          }
        ]
      }
    },
    "/client/anonymous": {
      "post": {
        "operationId": "clientAnonymous",
        "summary": "Create an anonymous customer and a token",
        "description": "Create an anonymous customer and a token.",
        "tags": [
          "Client API"
        ],
        "security": [
          {
            "publishableKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [],
                "properties": {
                  "locale": {
                    "type": "string"
                  },
                  "country": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/client/catalog": {
      "get": {
        "operationId": "clientCatalog",
        "summary": "Offerings and prices for the paywall",
        "description": "Offerings and prices for the paywall.",
        "tags": [
          "Client API"
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "parameters": [
          {
            "name": "platform",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "web",
                "ios",
                "android"
              ]
            }
          },
          {
            "name": "country",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/client/checkout": {
      "post": {
        "operationId": "clientCheckout",
        "summary": "Start a hosted checkout for a catalog price",
        "description": "Start a hosted checkout for a catalog price.",
        "tags": [
          "Client API"
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "provider",
                  "price_uuid",
                  "success_url",
                  "cancel_url"
                ],
                "properties": {
                  "provider": {
                    "type": "string",
                    "enum": [
                      "auto",
                      "stripe",
                      "paypal",
                      "mollie",
                      "klarna"
                    ]
                  },
                  "price_uuid": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "quantity": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100
                  },
                  "success_url": {
                    "type": "string"
                  },
                  "cancel_url": {
                    "type": "string"
                  },
                  "discount_code": {
                    "type": "string"
                  },
                  "payment_methods": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "locale": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/client/customer": {
      "get": {
        "operationId": "clientCustomer",
        "summary": "What the customer owns",
        "description": "What the customer owns.",
        "tags": [
          "Client API"
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/client/discounts/resolve": {
      "post": {
        "operationId": "clientResolveDiscount",
        "summary": "What the app does with a promotion code on ios, android or web",
        "description": "What the app does with a promotion code on ios, android or web.",
        "tags": [
          "Client API"
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "code",
                  "platform"
                ],
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 60
                  },
                  "platform": {
                    "type": "string",
                    "enum": [
                      "ios",
                      "android",
                      "web"
                    ]
                  },
                  "store_product_id": {
                    "type": "string",
                    "maxLength": 255
                  }
                }
              }
            }
          }
        }
      }
    },
    "/client/offers/app_store": {
      "post": {
        "operationId": "clientAppStoreOfferSignature",
        "summary": "Sign a promotional offer",
        "description": "Sign a promotional offer.",
        "tags": [
          "Client API"
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "product_id",
                  "offer_id"
                ],
                "properties": {
                  "product_id": {
                    "type": "string"
                  },
                  "offer_id": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/client/receipts/app_store": {
      "post": {
        "operationId": "clientSyncAppStore",
        "summary": "Unlock a StoreKit 2 transaction, or every purchase a StoreKit 1 app receipt names (looked up at Apple)",
        "description": "Unlock a StoreKit 2 transaction, or every purchase a StoreKit 1 app receipt names (looked up at Apple).",
        "tags": [
          "Client API"
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [],
                "properties": {
                  "signed_transaction": {
                    "type": "string"
                  },
                  "signed_renewal_info": {
                    "type": "string"
                  },
                  "app_receipt": {
                    "type": "string",
                    "maxLength": 600000,
                    "description": "Base64 StoreKit 1 app receipt (Bundle.main.appStoreReceiptURL), for apps that do not use StoreKit 2 yet"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/client/receipts/play_store": {
      "post": {
        "operationId": "clientSyncPlayStore",
        "summary": "Unlock and finish a Play purchase",
        "description": "Unlock and finish a Play purchase.",
        "tags": [
          "Client API"
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "purchase_token",
                  "product_id",
                  "purchase_kind"
                ],
                "properties": {
                  "purchase_token": {
                    "type": "string"
                  },
                  "product_id": {
                    "type": "string"
                  },
                  "purchase_kind": {
                    "type": "string",
                    "enum": [
                      "subscription",
                      "one_time"
                    ]
                  }
                }
              }
            }
          }
        }
      }
    },
    "/client/referrals/attribute": {
      "post": {
        "operationId": "clientAttributeReferral",
        "summary": "Attribute the signed-in customer to a referral code or the raw Play install referrer",
        "description": "Attribute the signed-in customer to a referral code or the raw Play install referrer. Organic installs answer attributed: false.",
        "tags": [
          "Client API"
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [],
                "properties": {
                  "referral_code": {
                    "type": "string",
                    "maxLength": 64
                  },
                  "install_referrer": {
                    "type": "string",
                    "maxLength": 1000,
                    "description": "The raw Google Play install referrer string"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/client/subscriptions/cancel": {
      "post": {
        "operationId": "clientCancelSubscription",
        "summary": "Let the customer cancel at period end",
        "description": "Let the customer cancel at period end.",
        "tags": [
          "Client API"
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "subscription_uuid"
                ],
                "properties": {
                  "subscription_uuid": {
                    "type": "string",
                    "format": "uuid"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/client/subscriptions/manage_link": {
      "post": {
        "operationId": "clientManageLink",
        "summary": "The manage link for the signed-in customer, valid for an hour",
        "description": "The manage link for the signed-in customer, valid for an hour. direct_url opens the provider right away; cancel_url and withdraw_url open the personal cancel and withdraw pages.",
        "tags": [
          "Client API"
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [],
                "properties": {
                  "subscription_uuid": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "return_url": {
                    "type": "string",
                    "maxLength": 2000
                  }
                }
              }
            }
          }
        }
      }
    },
    "/console_analytics/overview": {
      "get": {
        "operationId": "getRevenueOverview",
        "summary": "Recurring and net revenue per currency",
        "description": "Recurring and net revenue per currency.",
        "tags": [
          "Project and analytics"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "analytics:own:read",
        "parameters": [
          {
            "name": "days",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ]
      }
    },
    "/console_analytics/providers": {
      "get": {
        "operationId": "getProviderSplit",
        "summary": "Revenue by provider",
        "description": "Revenue by provider.",
        "tags": [
          "Project and analytics"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "analytics:own:read",
        "parameters": [
          {
            "name": "days",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ]
      }
    },
    "/console_analytics/series": {
      "get": {
        "operationId": "getRevenueSeries",
        "summary": "Net revenue per day and provider",
        "description": "Net revenue per day and provider.",
        "tags": [
          "Project and analytics"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "analytics:own:read",
        "parameters": [
          {
            "name": "days",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ]
      }
    },
    "/console_analytics/subscriptions": {
      "get": {
        "operationId": "getSubscriptionStats",
        "summary": "Active, trialing, at risk, churned",
        "description": "Active, trialing, at risk, churned.",
        "tags": [
          "Project and analytics"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "analytics:own:read",
        "parameters": [
          {
            "name": "days",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ]
      }
    },
    "/console_analytics/usage": {
      "get": {
        "operationId": "getUsageStatement",
        "summary": "Tracked production revenue and fee per month",
        "description": "Tracked production revenue and fee per month.",
        "tags": [
          "Project and analytics"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "analytics:own:read"
      }
    },
    "/console_catalog/discounts": {
      "get": {
        "operationId": "listCatalogDiscounts",
        "summary": "Promotion codes",
        "description": "Promotion codes.",
        "tags": [
          "Catalog"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "catalog:own:list"
      }
    },
    "/console_catalog/entitlements": {
      "get": {
        "operationId": "listCatalogEntitlements",
        "summary": "Entitlements",
        "description": "Entitlements.",
        "tags": [
          "Catalog"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "catalog:own:list"
      }
    },
    "/console_catalog/offerings": {
      "get": {
        "operationId": "listCatalogOfferings",
        "summary": "Offerings",
        "description": "Offerings.",
        "tags": [
          "Catalog"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "catalog:own:list"
      }
    },
    "/console_catalog/products": {
      "get": {
        "operationId": "listCatalogProducts",
        "summary": "Products with prices and sync state",
        "description": "Products with prices and sync state.",
        "tags": [
          "Catalog"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "catalog:own:list",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "max_entries",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "entry_offset",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ]
      }
    },
    "/console_commerce/orders": {
      "get": {
        "operationId": "listOrders",
        "summary": "List orders",
        "description": "List orders.",
        "tags": [
          "Checkout and subscriptions"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "commerce:own:list",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "provider",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "max_entries",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "entry_offset",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ]
      }
    },
    "/console_commerce/subscriptions": {
      "get": {
        "operationId": "listSubscriptions",
        "summary": "List subscriptions",
        "description": "List subscriptions.",
        "tags": [
          "Checkout and subscriptions"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "commerce:own:list",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "provider",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "max_entries",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "entry_offset",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ]
      }
    },
    "/console_commerce/transactions": {
      "get": {
        "operationId": "listTransactions",
        "summary": "List money movements",
        "description": "List money movements.",
        "tags": [
          "Checkout and subscriptions"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "commerce:own:list",
        "parameters": [
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "provider",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "max_entries",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "entry_offset",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ]
      }
    },
    "/console_customers/count": {
      "get": {
        "operationId": "countCustomers",
        "summary": "Number of customers",
        "description": "Number of customers.",
        "tags": [
          "Customers"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "customer:own:count"
      }
    },
    "/console_customers/list": {
      "get": {
        "operationId": "listCustomers",
        "summary": "Search customers",
        "description": "Search customers.",
        "tags": [
          "Customers"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "customer:own:list",
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "max_entries",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "entry_offset",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ]
      }
    },
    "/console_legal/referral_program": {
      "get": {
        "operationId": "listReferralPrograms",
        "summary": "The referral program settings of the project",
        "description": "The referral program settings of the project.",
        "tags": [
          "Project and analytics"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "referral:own:list"
      }
    },
    "/console_legal/requests": {
      "get": {
        "operationId": "listLegalRequests",
        "summary": "Cancellation and withdrawal declarations",
        "description": "Cancellation and withdrawal declarations.",
        "tags": [
          "Project and analytics"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "legal_request:own:list",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "max_entries",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "entry_offset",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ]
      }
    },
    "/console_setup/providers": {
      "get": {
        "operationId": "listProviderConnections",
        "summary": "Connected providers, without credentials",
        "description": "Connected providers, without credentials.",
        "tags": [
          "Project and analytics"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "provider_connection:own:list"
      }
    },
    "/console_setup/status": {
      "get": {
        "operationId": "getSetupStatus",
        "summary": "Setup progress",
        "description": "Setup progress.",
        "tags": [
          "Project and analytics"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "project:own:read"
      }
    },
    "/console_webhooks/endpoints": {
      "get": {
        "operationId": "listWebhookEndpoints",
        "summary": "Endpoints",
        "description": "Endpoints.",
        "tags": [
          "Events and endpoints"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "webhook:own:list"
      }
    },
    "/console_webhooks/events": {
      "get": {
        "operationId": "listProjectEvents",
        "summary": "Events with their deliveries",
        "description": "Events with their deliveries.",
        "tags": [
          "Events and endpoints"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "webhook:own:list",
        "parameters": [
          {
            "name": "event_type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customer_uuid",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "max_entries",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "entry_offset",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ]
      }
    },
    "/console_webhooks/inbound": {
      "get": {
        "operationId": "listInboundEvents",
        "summary": "Provider webhooks",
        "description": "Provider webhooks.",
        "tags": [
          "Events and endpoints"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "webhook:own:list",
        "parameters": [
          {
            "name": "provider",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "max_entries",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "entry_offset",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ]
      }
    },
    "/customers/alias": {
      "post": {
        "operationId": "aliasCustomer",
        "summary": "Merge an anonymous customer into an account",
        "description": "Merge an anonymous customer into an account.",
        "tags": [
          "Customers"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "customer:own:update",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "from_app_user_id",
                  "to_app_user_id"
                ],
                "properties": {
                  "from_app_user_id": {
                    "type": "string"
                  },
                  "to_app_user_id": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/customers/credits": {
      "post": {
        "operationId": "adjustCredits",
        "summary": "Add or consume credits",
        "description": "Add or consume credits. Never below zero, each key counts once.",
        "tags": [
          "Customers"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "customer:own:update",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "app_user_id",
                  "entitlement",
                  "delta",
                  "idempotency_key_body"
                ],
                "properties": {
                  "app_user_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "entitlement": {
                    "type": "string"
                  },
                  "delta": {
                    "type": "integer"
                  },
                  "idempotency_key_body": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 180,
                    "description": "Unique key of this booking"
                  },
                  "note": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/customers/erase": {
      "post": {
        "operationId": "eraseCustomer",
        "summary": "Remove personal data",
        "description": "Remove personal data. Stops renewals at the provider first; 409 active_store_subscription while an App Store subscription renews.",
        "tags": [
          "Customers"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "customer:own:delete",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "app_user_id"
                ],
                "properties": {
                  "app_user_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "force": {
                    "type": "boolean",
                    "description": "Erase although subscriptions still renew (App Store, or a provider that refused). They keep renewing; the response lists them."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/customers/export": {
      "get": {
        "operationId": "exportCustomer",
        "summary": "Everything stored about a customer",
        "description": "Everything stored about a customer.",
        "tags": [
          "Customers"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "customer:own:read",
        "parameters": [
          {
            "name": "app_user_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            }
          }
        ]
      }
    },
    "/customers/grant": {
      "post": {
        "operationId": "grantEntitlement",
        "summary": "Give an entitlement for free",
        "description": "Give an entitlement for free.",
        "tags": [
          "Customers"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "customer:own:update",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "app_user_id",
                  "entitlement"
                ],
                "properties": {
                  "app_user_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "entitlement": {
                    "type": "string"
                  },
                  "days": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 36500
                  },
                  "note": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Any unique string; a retry with the same key and body never acts twice."
          }
        ]
      }
    },
    "/customers/info": {
      "get": {
        "operationId": "getCustomerInfo",
        "summary": "Entitlements, credits, subscriptions, orders and transactions of one customer",
        "description": "Entitlements, credits, subscriptions, orders and transactions of one customer.",
        "tags": [
          "Customers"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "customer:own:read",
        "parameters": [
          {
            "name": "app_user_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            }
          }
        ]
      }
    },
    "/customers/revoke": {
      "post": {
        "operationId": "revokeEntitlement",
        "summary": "Revoke manual grants",
        "description": "Revoke manual grants.",
        "tags": [
          "Customers"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "customer:own:update",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "app_user_id",
                  "entitlement"
                ],
                "properties": {
                  "app_user_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "entitlement": {
                    "type": "string"
                  },
                  "reason": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/customers/session": {
      "post": {
        "operationId": "createCustomerSession",
        "summary": "Create a client token for one customer",
        "description": "Create a client token for one customer.",
        "tags": [
          "Customers"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "customer:own:update",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "app_user_id"
                ],
                "properties": {
                  "app_user_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "ttl_minutes": {
                    "type": "integer",
                    "minimum": 5,
                    "maximum": 1440
                  }
                }
              }
            }
          }
        }
      }
    },
    "/customers/upsert": {
      "post": {
        "operationId": "upsertCustomer",
        "summary": "Create or update a customer",
        "description": "Create or update a customer.",
        "tags": [
          "Customers"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "customer:own:update",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "app_user_id"
                ],
                "properties": {
                  "app_user_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "email": {
                    "type": "string"
                  },
                  "display_name": {
                    "type": "string"
                  },
                  "country": {
                    "type": "string"
                  },
                  "locale": {
                    "type": "string"
                  },
                  "attributes": {
                    "description": "JSON"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/endpoints/delete": {
      "post": {
        "operationId": "deleteEndpoint",
        "summary": "Delete an endpoint",
        "description": "Delete an endpoint.",
        "tags": [
          "Events and endpoints"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "webhook:own:delete",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "endpoint_uuid"
                ],
                "properties": {
                  "endpoint_uuid": {
                    "type": "string",
                    "format": "uuid"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/endpoints/rotate": {
      "post": {
        "operationId": "rotateEndpointSecret",
        "summary": "Rotate the signing secret",
        "description": "Rotate the signing secret.",
        "tags": [
          "Events and endpoints"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "webhook:own:update",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "endpoint_uuid"
                ],
                "properties": {
                  "endpoint_uuid": {
                    "type": "string",
                    "format": "uuid"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/endpoints/test": {
      "post": {
        "operationId": "sendTestEvent",
        "summary": "Send a test event and report the answer",
        "description": "Send a test event and report the answer.",
        "tags": [
          "Events and endpoints"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "webhook:own:update",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "endpoint_uuid"
                ],
                "properties": {
                  "endpoint_uuid": {
                    "type": "string",
                    "format": "uuid"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/endpoints/upsert": {
      "post": {
        "operationId": "upsertEndpoint",
        "summary": "Create or update an endpoint",
        "description": "Create or update an endpoint. The secret is in the first answer only.",
        "tags": [
          "Events and endpoints"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "webhook:own:update",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "url"
                ],
                "properties": {
                  "endpoint_uuid": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "url": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 160
                  },
                  "event_types": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "enabled": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/events/replay": {
      "post": {
        "operationId": "replayEvent",
        "summary": "Send an event again",
        "description": "Send an event again.",
        "tags": [
          "Events and endpoints"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "webhook:own:update",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "event_uuid"
                ],
                "properties": {
                  "event_uuid": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "endpoint_uuid": {
                    "type": "string",
                    "format": "uuid"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/events/reprocess": {
      "post": {
        "operationId": "reprocessInboundEvent",
        "summary": "Process a stored provider webhook again",
        "description": "Process a stored provider webhook again.",
        "tags": [
          "Events and endpoints"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "webhook:own:update",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "inbound_event_uuid"
                ],
                "properties": {
                  "inbound_event_uuid": {
                    "type": "string",
                    "format": "uuid"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/events/simulate": {
      "post": {
        "operationId": "simulateScenario",
        "summary": "Play a scenario",
        "description": "Play a scenario. Sandbox only.",
        "tags": [
          "Events and endpoints"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "webhook:own:update",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "scenario"
                ],
                "properties": {
                  "scenario": {
                    "type": "string"
                  },
                  "app_user_id": {
                    "type": "string"
                  },
                  "product_identifier": {
                    "type": "string"
                  },
                  "provider": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/events/types": {
      "get": {
        "operationId": "listEventTypes",
        "summary": "Every event type and scenario",
        "description": "Every event type and scenario.",
        "tags": [
          "Events and endpoints"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "webhook:own:list"
      }
    },
    "/health/ready": {
      "get": {
        "operationId": "healthReady",
        "summary": "Readiness without a key: database, Redis, worker heartbeat and queue ages",
        "description": "Readiness without a key: database, Redis, worker heartbeat and queue ages. 200 ok or degraded, 503 when the service cannot do its job. /health is the liveness check.",
        "tags": [
          "Project and analytics"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/imports/cancel": {
      "post": {
        "operationId": "cancelImport",
        "summary": "Stop a running import",
        "description": "Stop a running import. What is done stays.",
        "tags": [
          "Project and analytics"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "customer:own:update",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "import_id"
                ],
                "properties": {
                  "import_id": {
                    "type": "string",
                    "format": "uuid"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/imports/get": {
      "get": {
        "operationId": "getImport",
        "summary": "Progress, counts per outcome and the report of rows that did not go through",
        "description": "Progress, counts per outcome and the report of rows that did not go through.",
        "tags": [
          "Project and analytics"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "customer:own:read",
        "parameters": [
          {
            "name": "import_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ]
      }
    },
    "/imports/list": {
      "get": {
        "operationId": "listImports",
        "summary": "The last 50 imports",
        "description": "The last 50 imports.",
        "tags": [
          "Project and analytics"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "customer:own:read"
      }
    },
    "/imports/start": {
      "post": {
        "operationId": "startImport",
        "summary": "Import customers and purchases",
        "description": "Import customers and purchases. source is revenuecat_csv, revenuecat_api, stripe, app_store, play_store or csv; options takes stripe_match and revenuecat_project_id. Store ids are looked up at Apple, Google and Stripe; only their answer unlocks anything. Webhooks stay quiet unless send_events. See Switching to Billstrato.",
        "tags": [
          "Project and analytics"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "customer:own:update",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "type": "string",
                    "enum": [
                      "revenuecat_csv",
                      "revenuecat_api",
                      "app_store",
                      "play_store",
                      "stripe",
                      "csv"
                    ]
                  },
                  "dry_run": {
                    "type": "boolean",
                    "description": "Only read and report what would happen"
                  },
                  "send_events": {
                    "type": "boolean",
                    "description": "Send webhook events for imported purchases (off by default)"
                  },
                  "csv": {
                    "type": "string",
                    "maxLength": 20000000,
                    "description": "CSV text for revenuecat_csv and csv (at most 20 MB)"
                  },
                  "ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Store ids for app_store (original transaction ids) and play_store (purchase tokens, optionally product_id:token)"
                  },
                  "options": {
                    "description": "JSON. Source options, see docs/api (for example the Stripe mapping rule or the RevenueCat project id)"
                  },
                  "api_key": {
                    "type": "string",
                    "maxLength": 500,
                    "description": "RevenueCat secret API key (v2). Sealed for the run and wiped at the end."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/legal/resolve": {
      "post": {
        "operationId": "resolveLegalRequest",
        "summary": "Execute or reject a declaration",
        "description": "Execute or reject a declaration.",
        "tags": [
          "Project and analytics"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "legal_request:own:update",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "request_uuid",
                  "action"
                ],
                "properties": {
                  "request_uuid": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "action": {
                    "type": "string",
                    "enum": [
                      "execute",
                      "reject"
                    ]
                  },
                  "note": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/project/context": {
      "get": {
        "operationId": "getProjectContext",
        "summary": "Project, environment and rights of the key",
        "description": "Project, environment and rights of the key.",
        "tags": [
          "Project and analytics"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "project:own:read"
      }
    },
    "/projects/sandbox/reset": {
      "post": {
        "operationId": "resetSandbox",
        "summary": "Delete every sandbox customer, purchase and event",
        "description": "Delete every sandbox customer, purchase and event. Catalog, keys and connections stay. Needs the project's slug typed as confirm.",
        "tags": [
          "Project and analytics"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "project:own:update",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "confirm"
                ],
                "properties": {
                  "confirm": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80,
                    "description": "The project's slug, typed by the person who resets"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/providers/catalog": {
      "get": {
        "operationId": "getProviderCatalog",
        "summary": "Supported providers and capabilities",
        "description": "Supported providers and capabilities.",
        "tags": [
          "Project and analytics"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "provider_connection:own:list"
      }
    },
    "/providers/verify": {
      "post": {
        "operationId": "verifyProvider",
        "summary": "Check stored credentials",
        "description": "Check stored credentials.",
        "tags": [
          "Project and analytics"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "provider_connection:own:update",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "provider"
                ],
                "properties": {
                  "provider": {
                    "type": "string",
                    "enum": [
                      "stripe",
                      "paypal",
                      "mollie",
                      "klarna",
                      "app_store",
                      "play_store"
                    ]
                  },
                  "app_id": {
                    "type": "string",
                    "maxLength": 255,
                    "description": "Bundle ID or package name when the project has several store apps"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/referrals/attribute": {
      "post": {
        "operationId": "attributeReferral",
        "summary": "Attribute a customer to a code, or to the code in a Google Play install referrer",
        "description": "Attribute a customer to a code, or to the code in a Google Play install referrer.",
        "tags": [
          "Project and analytics"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "referral:own:update",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "app_user_id"
                ],
                "properties": {
                  "app_user_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "referral_code": {
                    "type": "string",
                    "maxLength": 64
                  },
                  "install_referrer": {
                    "type": "string",
                    "maxLength": 1000,
                    "description": "The raw Google Play install referrer string, instead of referral_code"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/referrals/program": {
      "post": {
        "operationId": "configureReferralProgram",
        "summary": "Configure referral rewards",
        "description": "Configure referral rewards.",
        "tags": [
          "Project and analytics"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "referral:own:update",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "enabled"
                ],
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "entitlement": {
                    "type": "string"
                  },
                  "referrer_credits": {
                    "type": "integer"
                  },
                  "referee_credits": {
                    "type": "integer"
                  },
                  "referrer_days": {
                    "type": "integer"
                  },
                  "referee_days": {
                    "type": "integer"
                  },
                  "max_rewards_per_referrer": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/refunds/create": {
      "post": {
        "operationId": "createRefund",
        "summary": "Refund a charge in full or in part",
        "description": "Refund a charge in full or in part.",
        "tags": [
          "Checkout and subscriptions"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "commerce:own:update",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "transaction_uuid"
                ],
                "properties": {
                  "transaction_uuid": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "amount_minor": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "reason": {
                    "type": "string"
                  },
                  "revoke_access": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Any unique string; a retry with the same key and body never acts twice."
          }
        ]
      }
    },
    "/subscriptions/cancel": {
      "post": {
        "operationId": "cancelSubscription",
        "summary": "Cancel at period end or now",
        "description": "Cancel at period end or now.",
        "tags": [
          "Checkout and subscriptions"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "commerce:own:update",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "subscription_uuid",
                  "mode"
                ],
                "properties": {
                  "subscription_uuid": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "mode": {
                    "type": "string",
                    "enum": [
                      "at_period_end",
                      "immediately"
                    ]
                  },
                  "reason": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/subscriptions/change": {
      "post": {
        "operationId": "changeSubscription",
        "summary": "Move to another price",
        "description": "Move to another price.",
        "tags": [
          "Checkout and subscriptions"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "commerce:own:update",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "subscription_uuid",
                  "price_uuid"
                ],
                "properties": {
                  "subscription_uuid": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "price_uuid": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "proration": {
                    "type": "string",
                    "enum": [
                      "prorate",
                      "none"
                    ]
                  }
                }
              }
            }
          }
        }
      }
    },
    "/subscriptions/extend": {
      "post": {
        "operationId": "extendSubscription",
        "summary": "Give free days",
        "description": "Give free days.",
        "tags": [
          "Checkout and subscriptions"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "commerce:own:update",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "subscription_uuid",
                  "days"
                ],
                "properties": {
                  "subscription_uuid": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "days": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 365
                  }
                }
              }
            }
          }
        }
      }
    },
    "/subscriptions/manage_link": {
      "post": {
        "operationId": "subscriptionManageLink",
        "summary": "One link where the customer manages or cancels at the provider that bills them: Stripe portal, PayPal, App Store, Google Play, or a hosted page for Mollie",
        "description": "One link where the customer manages or cancels at the provider that bills them: Stripe portal, PayPal, App Store, Google Play, or a hosted page for Mollie. Also returns cancel_url and withdraw_url: personal pages where this customer cancels or withdraws with one click, without typing name or address.",
        "tags": [
          "Checkout and subscriptions"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "commerce:own:create",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "app_user_id"
                ],
                "properties": {
                  "app_user_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "subscription_uuid": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Only this subscription. Without it the link covers all of the customer."
                  },
                  "return_url": {
                    "type": "string",
                    "maxLength": 2000,
                    "description": "Where the provider portal sends the customer back. Defaults to the project website."
                  },
                  "expires_in_hours": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 720,
                    "description": "How long the link works, 1 to 720 hours. Default 24."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/subscriptions/pause": {
      "post": {
        "operationId": "pauseSubscription",
        "summary": "Pause collection",
        "description": "Pause collection.",
        "tags": [
          "Checkout and subscriptions"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "commerce:own:update",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "subscription_uuid"
                ],
                "properties": {
                  "subscription_uuid": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "resumes_at": {
                    "type": "string",
                    "format": "date-time"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/subscriptions/price_change/decide": {
      "post": {
        "operationId": "decidePriceChange",
        "summary": "Record the customer's answer to a price increase, for example from your app",
        "description": "Record the customer's answer to a price increase, for example from your app. No means the subscription ends with its paid period.",
        "tags": [
          "Checkout and subscriptions"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "commerce:own:update",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "subscription_uuid",
                  "accept"
                ],
                "properties": {
                  "subscription_uuid": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "accept": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/subscriptions/resume": {
      "post": {
        "operationId": "resumeSubscription",
        "summary": "Undo a cancellation or a pause",
        "description": "Undo a cancellation or a pause.",
        "tags": [
          "Checkout and subscriptions"
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Engine routes answer { result: … }; list routes answer the rows."
                }
              }
            }
          },
          "4XX": {
            "$ref": "#/components/responses/Error"
          },
          "5XX": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-billstrato-permission": "commerce:own:update",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "subscription_uuid"
                ],
                "properties": {
                  "subscription_uuid": {
                    "type": "string",
                    "format": "uuid"
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
