{
  "openapi": "3.0.3",
  "info": {
    "title": "Spiffy API",
    "version": "2.0.0",
    "description": "# Getting Started\n\nThe Spiffy API allows you to programmatically manage customers, orders, subscriptions, and more.\n\n## Authentication\n\nThe Spiffy API supports two authentication methods. Which one you use depends on the type of integration you're building.\n\n| | API Key | OAuth 2.0 |\n|---|---|---|\n| **For** | Private integrations | Third-party integrations |\n| **Access scope** | Your account only | Any merchant who authorizes your app |\n| **Setup** | Create a key in the dashboard | Register OAuth client on Developer Platform |\n\n### API Key\n\nAPI key authentication is the simplest way to access the Spiffy API. It's intended for private integrations — internal tools and scripts that connect to your own Spiffy account.\n\nCreate and manage keys in your Spiffy dashboard under **Settings → API**. An account can hold multiple named keys — for example, one per integration — so you can tell at a glance what each key is used for and revoke one without affecting the others.\n\nPass a key as a Bearer token in the `Authorization` header on every request:\n\n```\nAuthorization: Bearer YOUR_API_KEY\n```\n\n**Security:**\n- Treat every key like a password. Do not commit it to version control or expose it in client-side code.\n- To rotate a key without downtime, create a new key, cut your integration over to it, then delete the old key.\n- If a key is compromised, regenerate it from Settings → API. That invalidates only that key's old secret immediately and issues a new one in its place — other keys on the account are unaffected.\n\n### OAuth 2.0\n\nOAuth 2.0 is required for third-party integrations — apps that connect to other merchants' Spiffy accounts on their behalf.\n\n**Step 1 — Redirect the merchant to authorize:**\n\n```\nhttps://app.spiffy.co/oauth/authorize\n  ?client_id=YOUR_CLIENT_ID\n  &redirect_uri=YOUR_REDIRECT_URI\n  &response_type=code\n  &scope=REQUESTED_SCOPES\n  &state=RANDOM_STATE_VALUE\n```\n\nThe `state` parameter should be a random, unguessable value to prevent CSRF attacks.\n\n**Step 2 — Exchange the authorization code for tokens:**\n\n```\nPOST https://api.spiffy.co/oauth/token\nContent-Type: application/x-www-form-urlencoded\n\ngrant_type=authorization_code\n&code=AUTHORIZATION_CODE\n&client_id=YOUR_CLIENT_ID\n&client_secret=YOUR_CLIENT_SECRET\n&redirect_uri=YOUR_REDIRECT_URI\n```\n\nResponse:\n```json\n{\n  \"access_token\": \"...\",\n  \"refresh_token\": \"...\",\n  \"token_type\": \"bearer\",\n  \"expires_in\": 3600\n}\n```\n\n**Step 3 — Use the access token:**\n\n```\nAuthorization: Bearer ACCESS_TOKEN\n```\n\n**Step 4 — Refresh when expired:**\n\nAccess tokens expire after 1 hour. Refresh tokens are valid for 1 month and are single-use — each refresh issues a new pair.\n\n```\nPOST https://api.spiffy.co/oauth/token\nContent-Type: application/x-www-form-urlencoded\n\ngrant_type=refresh_token\n&refresh_token=REFRESH_TOKEN\n&client_id=YOUR_CLIENT_ID\n&client_secret=YOUR_CLIENT_SECRET\n```\n\n**Available scopes:** account, users, customers, checkouts, subscriptions, subscription_metered_billing, integrations, orders, payments, paymentplans, webhooks\n\n**Token security:**\n- Store tokens securely — treat them like passwords\n- Never expose tokens in client-side code, URLs, or logs\n- Merchants can revoke access at any time; handle 401 responses gracefully\n\n## Rate Limiting\n\nAPI requests are subject to two types of rate limiting:\n\n### Per-Minute Rate Limit\n\n- **100 requests per 60-second window** (fixed window)\n- Applies to account API key requests only. Approved third-party developer applications are metered separately and are subject to neither the per-minute limit nor the monthly quota.\n- Response headers on every request:\n  - `X-RateLimit-Limit`: Maximum requests allowed (100)\n  - `X-RateLimit-Remaining`: Requests remaining in current window\n  - `X-RateLimit-Reset`: Unix timestamp when the window resets\n\n### Monthly Request Quota\n\nMonthly limits are based on your Spiffy subscription plan:\n\n| Plan | Monthly Limit |\n|---|---|\n| Pro | 10,000 |\n| Business | 20,000 |\n| Scale | 50,000 |\n\n- Response headers on every request:\n  - `X-Monthly-RateLimit-Limit`: Your quota for the current month\n  - `X-Monthly-RateLimit-Remaining`: Requests remaining this month\n  - `X-Monthly-RateLimit-Reset`: Unix timestamp for the first of next month (UTC)\n- An email warning is sent when usage reaches 80% of the monthly limit.\n- Your quota can change during a month — Spiffy support can grant a temporary increase, which\n  ends at the reset. `X-Monthly-RateLimit-Limit` always reflects the quota currently in force,\n  so read it per response rather than caching the table above.\n\nWhen either limit is exceeded, the API returns **429 Too Many Requests**. The two\nlimits return different error codes, and they need different handling — branch on\n`error.code` rather than on the status alone.\n\nPer-minute limit exceeded. Retryable; a `Retry-After` header gives the number of\nseconds to wait:\n\n```json\n{\n  \"error\": {\n    \"code\": \"rate_limit_exceeded\",\n    \"message\": \"Too many requests\"\n  }\n}\n```\n\nMonthly quota exhausted. **Not retryable** — there is no `Retry-After` header, and\nrequests will continue to fail until the quota resets at the start of the next\nmonth (see `X-Monthly-RateLimit-Reset`). Retrying will not succeed, and each\nrejected attempt is itself counted, so a retry loop consumes the quota it is\nwaiting on:\n\n```json\n{\n  \"error\": {\n    \"code\": \"monthly_limit_exceeded\",\n    \"message\": \"Monthly API request limit exceeded\"\n  }\n}\n```\n\n## Pagination\n\nList endpoints return paginated results to improve performance. You control pagination using query parameters:\n\n| Parameter | Default | Maximum | Description |\n|---|---|---|---|\n| `page` | 1 | - | Page number (1-based) |\n| `per_page` | 50 | 100 | Items per page |\n\n**Example request:**\n```\nGET /v2/customers?page=2&per_page=25\n```\n\n**Response format:**\n```json\n{\n  \"data\": [\n    { \"id\": \"cus_123\", \"email\": \"john@example.com\", ... },\n    { \"id\": \"cus_124\", \"email\": \"jane@example.com\", ... }\n  ],\n  \"meta\": {\n    \"pagination\": {\n      \"page\": 2,\n      \"page_size\": 25,\n      \"total_count\": 150,\n      \"total_pages\": 6,\n      \"has_more\": true\n    }\n  }\n}\n```\n\nNote that `pagination` is nested inside `meta`, not at the top level.\n\nThe `meta.pagination` object provides:\n- `page`: Current page number\n- `page_size`: Items per page (same as the `per_page` parameter)\n- `total_count`: Total number of items across all pages\n- `total_pages`: Total number of pages\n- `has_more`: Whether another page follows this one\n\n`has_more` is the value to loop on. Paging until a request returns an empty\n`data` array works, but costs one extra request per resource per run, and every\nrequest counts against your quota.\n\nPagination is offset-based. There is no cursor, and no `next` link in the\nenvelope — advance by incrementing `page`.\n\n## Filtering\n\nMost list endpoints support filtering to narrow results. Filters use a dot notation syntax for operators:\n\n| Syntax | Operator | Example |\n|---|---|---|\n| `?filter[field]=value` | Exact match | `?filter[status]=active` |\n| `?filter[field.contains]=value` | Contains (case-insensitive) | `?filter[email.contains]=gmail` |\n| `?filter[field.gt]=value` | Greater than | `?filter[amount.gt]=100` |\n| `?filter[field.gte]=value` | Greater than or equal | `?filter[created_at.gte]=2025-01-01` |\n| `?filter[field.lt]=value` | Less than | `?filter[amount.lt]=500` |\n| `?filter[field.lte]=value` | Less than or equal | `?filter[updated_at.lte]=2025-12-31` |\n| `?filter[field.in]=value1,value2` | In list | `?filter[status.in]=active,trialing` |\n| `?filter[field.nin]=value1,value2` | Not in list | `?filter[status.nin]=canceled,expired` |\n\n**Complex example:**\n```\nGET /v2/customers?filter[email.contains]=john&filter[created_at.gte]=2025-01-01&filter[status]=active\n```\n\nThis finds active customers with \"john\" in their email address created after January 1st, 2025.\n\n### Unrecognized parameters are ignored, not rejected\n\nFiltering, expansion, search and sort all fail open. A filter key that is not\nsupported for a resource, an `include=` value that does not exist, `search=` on\nan endpoint with no searchable fields, and `sort=` on a field that is not\nsortable are each dropped silently. The request returns **200** with a normal\nbody — unfiltered, or unexpanded.\n\nThis is worth designing around, because nothing in the response tells you it\nhappened: a filter that looks reasonable but is not in the parameter list for\nthat specific endpoint will return your entire table, one page at a time, and\nthe code will look correct. Check the parameters documented for the exact\nendpoint you are calling rather than assuming a field that exists on the object\nis filterable.\n\nValues are validated once a key is recognized — an unknown enum value returns\n**400** listing the valid ones, and a malformed date or number returns **400**\nnaming the field.\n\n## Searching\n\nList endpoints support full-text search using the `search` parameter. Search is case-insensitive and works across multiple text fields relevant to each resource type.\n\n**Example:**\n```\nGET /v2/customers?search=smith\n```\n\nThis searches across customer names, emails, company names, and other text fields for the term \"smith\".\n\nSearch can be combined with filters and pagination:\n```\nGET /v2/customers?search=smith&filter[status]=active&page=2\n```\n\n## Resource Expansion\n\nMany endpoints support expanding related resources in a single request using the `include` parameter. This reduces the number of API calls needed to fetch related data.\n\n**Example:**\n```\nGET /v2/customers/cus_123?include=cards,stats,fields\n```\n\nThis returns the customer with their payment cards, statistics, and custom fields included:\n\n```json\n{\n  \"id\": \"cus_123\",\n  \"email\": \"john@example.com\",\n  \"name\": \"John Smith\",\n  // ... other customer fields ...\n  \"cards\": [\n    { \"id\": \"card_456\", \"last4\": \"4242\", \"brand\": \"Visa\" }\n  ],\n  \"stats\": {\n    \"total_orders\": 15,\n    \"total_spent\": 1250.00,\n    \"avg_order_value\": 83.33\n  },\n  \"fields\": [\n    { \"name\": \"preferred_contact\", \"value\": \"email\" }\n  ]\n}\n```\n\nAvailable expansions are listed in each endpoint's documentation. Multiple expansions can be requested as a comma-separated list.\n\n## Webhooks\n\nWebhooks push changes to you instead of you polling for them, and deliveries do\nnot count against your API quota. Manage endpoints under\n`/v2/webhook-endpoints`.\n\n### Event types\n\n`GET /v2/webhook-event-types` returns the live catalog and needs no\nauthentication. **Treat it as the source of truth** — subscribe from it rather\nthan from a hardcoded list.\n\nThe `events` array on an endpoint is not validated against the catalog. A\nmisspelled type is accepted, stored, and never fires, with no error at creation\ntime and nothing in the delivery log to inspect, because no delivery is ever\nattempted. Omitting `events` subscribes to everything.\n\n### Verifying the signature\n\nEvery delivery carries a `Spiffy-Signature` header:\n\n```\nSpiffy-Signature: t=1755043200,v1=3f8a...c4\n```\n\n- `t` is the Unix timestamp at signing.\n- `v1` is a hex-encoded HMAC-SHA256, using your endpoint's signing secret as the\n  key, over the exact string `{t}.{raw request body}`.\n\nSign the **raw body as received**. Parsing the JSON and re-serializing it will\nchange key order or spacing and the signature will not match.\n\n```js\nconst crypto = require('crypto');\n\nfunction verify(rawBody, header, secret) {\n    const parts = Object.fromEntries(header.split(',').map(p => p.split('=')));\n    const expected = crypto.createHmac('sha256', secret)\n        .update(parts.t + '.' + rawBody)\n        .digest('hex');\n    return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1));\n}\n```\n\nCompare with a constant-time function, and reject deliveries whose `t` is\noutside a tolerance you choose, so an intercepted payload cannot be replayed\nlater. The signing secret is returned when you create an endpoint, and again\nfrom `POST /v2/webhook-endpoints/{id}/rotate-secret`.\n\n### Delivery\n\nDelivery is **at-least-once and unordered**. The same event will eventually\narrive twice, and a later state change can arrive before an earlier one.\nDeduplicate on the envelope `id`, and compare the object's own timestamps\nbefore writing rather than assuming the newest delivery is the newest truth.\n\nA delivery succeeds on any 2xx within 10 seconds. Respond first and do your work\nafterward — once you return 2xx the event is considered delivered and will not\nbe sent again.\n\nFailures retry 7 times over roughly 34 hours: immediately, then after 1 minute,\n5 minutes, 30 minutes, 2 hours, 8 hours and 24 hours. An endpoint that\naccumulates 50 consecutive failures is disabled automatically and its owners are\nemailed; any success resets the counter.\n\nEvents are only queued for endpoints that were active when they fired, so\nanything that happened while an endpoint was down, disabled or unsubscribed\ncannot be backfilled. Pair webhooks with a low-frequency\n`filter[updated_at.gte]` sweep to close that gap.\n\nEndpoint URLs must be HTTPS and publicly resolvable; hostnames resolving to\nprivate or loopback addresses are refused at delivery time.\n\n## Not supported\n\nThese do not exist. They are listed so you can design around them rather than\ndiscovering them in production:\n\n- **Cursor pagination.** Offset/page only, as described above.\n- **Sparse fieldsets.** `fields` is a reserved parameter name but is not\n  implemented; responses always carry the full resource.\n- **Idempotency keys.** No endpoint reads an `Idempotency-Key` header, so a\n  retried `POST` is a second write. Deduplicate in your own application.\n- **Conditional requests.** The API sets no `ETag`, `Last-Modified` or\n  `Cache-Control` semantics, and no endpoint short-circuits on a request\n  validator. A repeated identical `GET` is a full query and a full quota unit,\n  so any caching has to be yours.\n- **Bulk writes.** Every write is one resource per request. For bulk *reads*,\n  use `filter[id.in]` with `per_page=100`, or a report export.\n\n## Errors\n\nThe API uses standard HTTP status codes and returns detailed error information in a consistent JSON format:\n\n```json\n{\n  \"error\": {\n    \"code\": \"error_code\",\n    \"message\": \"Human-readable error message\",\n    \"details\": {}  // Optional field-specific errors\n  }\n}\n```\n\n### Error Codes\n\n| Status | Code | Description |\n|---|---|---|\n| 400 | `bad_request` | The request was invalid or malformed |\n| 401 | `unauthorized` | Authentication is required or has failed |\n| 403 | `forbidden` | You do not have permission to access this resource |\n| 403 | `invalid_scope` | Missing required OAuth scope |\n| 404 | `not_found` | The requested resource does not exist |\n| 409 | `conflict` | The request conflicts with the current state (e.g., duplicate email) |\n| 422 | `validation_error` | The request data failed validation |\n| 429 | `rate_limit_exceeded` | Too many requests |\n| 500 | `internal_error` | An unexpected server error occurred |\n\n### Validation Errors\n\nValidation errors include additional details about which fields failed:\n\n```json\n{\n  \"error\": {\n    \"code\": \"validation_error\",\n    \"message\": \"Validation failed\",\n    \"details\": {\n      \"fieldErrors\": {\n        \"email\": [\"Invalid email format\"],\n        \"name\": [\"String must contain at least 1 character(s)\"]\n      }\n    }\n  }\n}\n```",
    "contact": {
      "name": "Spiffy Support",
      "email": "support@spiffy.co"
    }
  },
  "servers": [
    {
      "url": "https://api.spiffy.co",
      "description": "Production"
    }
  ],
  "tags": [
    {
      "name": "customers",
      "description": "Customer management endpoints"
    },
    {
      "name": "orders",
      "description": "Order management endpoints"
    },
    {
      "name": "products",
      "description": "Product, option, and price management"
    },
    {
      "name": "subscriptions",
      "description": "Subscription management"
    },
    {
      "name": "payments",
      "description": "Payment management"
    },
    {
      "name": "paymentplans",
      "description": "Payment plan management"
    },
    {
      "name": "promos",
      "description": "Promo/discount code management"
    },
    {
      "name": "Affiliates",
      "description": "Manage affiliates, affiliate programs, and payouts."
    },
    {
      "name": "affiliates",
      "description": "Affiliate management",
      "x-parent": "Affiliates"
    },
    {
      "name": "affiliate-programs",
      "description": "Affiliate program management (programs, checkouts, prices, options, links)",
      "x-parent": "Affiliates"
    },
    {
      "name": "affiliate-payouts",
      "description": "Affiliate payout management",
      "x-parent": "Affiliates"
    },
    {
      "name": "Webhooks",
      "description": "Manage webhook endpoints, view event delivery logs, and browse available event types."
    },
    {
      "name": "webhook-endpoints",
      "description": "Webhook endpoint management",
      "x-parent": "Webhooks"
    },
    {
      "name": "webhook-events",
      "description": "Webhook event delivery logs",
      "x-parent": "Webhooks"
    },
    {
      "name": "webhook-event-types",
      "description": "Available webhook event types",
      "x-parent": "Webhooks"
    },
    {
      "name": "API v1",
      "description": "Legacy API v1 endpoints. These endpoints are stable but will not receive new features."
    },
    {
      "name": "v1-account",
      "description": "Account info (v1)",
      "x-parent": "API v1"
    },
    {
      "name": "v1-orders",
      "description": "Order listing (v1)",
      "x-parent": "API v1"
    },
    {
      "name": "v1-customers",
      "description": "Customer management (v1)",
      "x-parent": "API v1"
    },
    {
      "name": "v1-subscriptions",
      "description": "Subscription management (v1)",
      "x-parent": "API v1"
    },
    {
      "name": "v1-payments",
      "description": "Payment listing (v1)",
      "x-parent": "API v1"
    },
    {
      "name": "v1-paymentplans",
      "description": "Payment plan listing (v1)",
      "x-parent": "API v1"
    },
    {
      "name": "v1-checkouts",
      "description": "Checkout listing (v1)",
      "x-parent": "API v1"
    },
    {
      "name": "v1-affiliates",
      "description": "Affiliate auth (v1)",
      "x-parent": "API v1"
    },
    {
      "name": "v1-integrations",
      "description": "Integration actions (v1)",
      "x-parent": "API v1"
    }
  ],
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API Key",
        "description": "Account API key authentication. Pass an API key as a Bearer token in the `Authorization` header. An account may have multiple named keys; any of them grants full access to all endpoints — equivalent to all OAuth scopes."
      },
      "OAuth2": {
        "type": "oauth2",
        "description": "OAuth 2.0 authentication for third-party integrations. Access is limited to the scopes granted by the merchant during authorization.",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://app.spiffy.co/oauth/authorize",
            "tokenUrl": "https://api.spiffy.co/oauth/token",
            "refreshUrl": "https://api.spiffy.co/oauth/token",
            "scopes": {
              "account": "Access account details and settings",
              "users": "Manage users",
              "customers": "Read and manage customers",
              "checkouts": "Read and manage checkouts",
              "subscriptions": "Read and manage subscriptions",
              "subscription_metered_billing": "Manage metered billing for subscriptions",
              "integrations": "Manage integrations",
              "orders": "Read and manage orders",
              "payments": "Read and manage payments",
              "paymentplans": "Read and manage payment plans",
              "webhooks": "Manage webhook endpoints and view event logs",
              "promos": "Read and manage promo/discount codes",
              "affiliates": "Read and manage affiliates and programs",
              "products": "Read and manage products",
              "analytics": "Read analytics data (revenue, orders, subscriptions, MRR)",
              "reports": "Create, run, and read saved reports and their results"
            }
          }
        }
      }
    },
    "schemas": {
      "Error401": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "unauthorized"
                ],
                "example": "unauthorized"
              },
              "message": {
                "type": "string",
                "example": "Authentication required"
              }
            },
            "required": [
              "code",
              "message"
            ]
          }
        },
        "required": [
          "error"
        ]
      },
      "Error403": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "forbidden"
                ],
                "example": "forbidden"
              },
              "message": {
                "type": "string",
                "example": "Access denied"
              }
            },
            "required": [
              "code",
              "message"
            ]
          }
        },
        "required": [
          "error"
        ]
      },
      "Error500": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "internal_error"
                ],
                "example": "internal_error"
              },
              "message": {
                "type": "string",
                "example": "Internal server error"
              }
            },
            "required": [
              "code",
              "message"
            ]
          }
        },
        "required": [
          "error"
        ]
      },
      "CustomerResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "minimum": 0,
            "exclusiveMinimum": true,
            "description": "Unique customer identifier",
            "example": 12345
          },
          "account_id": {
            "type": "integer",
            "minimum": 0,
            "exclusiveMinimum": true,
            "description": "Account ID this customer belongs to",
            "example": 1
          },
          "email": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "format": "email",
            "description": "Customer email address",
            "example": "customer@example.com"
          },
          "name_first": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Customer first name",
            "example": "John"
          },
          "name_last": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Customer last name",
            "example": "Doe"
          },
          "company_name": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Company name (for business customers)",
            "example": "Acme Corp"
          },
          "tax_id": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Tax identification number",
            "example": "12-3456789"
          },
          "locale": {
            "type": "string",
            "nullable": true,
            "maxLength": 10,
            "description": "BCP 47 locale the customer most recently requested (source of truth for comms)"
          },
          "created_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Timestamp when customer was created",
            "example": "2024-01-15T10:30:00Z"
          },
          "updated_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Timestamp when customer was last updated",
            "example": "2024-01-20T14:45:00Z"
          },
          "cards": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CardResponse"
            },
            "description": "Customer payment cards (included via ?include=cards)"
          },
          "fields": {
            "type": "array",
            "items": {
              "nullable": true
            },
            "description": "Custom fields (included via ?include=fields)"
          },
          "stats": {
            "$ref": "#/components/schemas/CustomerStats"
          },
          "integrations": {
            "type": "object",
            "additionalProperties": {
              "nullable": true
            },
            "description": "Integration-specific data (included via ?include=integrations)"
          }
        },
        "required": [
          "id",
          "account_id"
        ]
      },
      "CardResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Unique card identifier",
            "example": 789
          },
          "customer_id": {
            "type": "integer",
            "description": "ID of the customer who owns this card",
            "example": 12345
          },
          "is_active": {
            "type": "boolean",
            "nullable": true,
            "description": "Whether the card is active and can be used for payments",
            "example": true
          },
          "is_three_d_secure_supported": {
            "type": "boolean",
            "nullable": true,
            "description": "Whether the card supports 3D Secure authentication",
            "example": true
          },
          "type": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Card brand/type",
            "example": "Visa"
          },
          "last_four": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Last four digits of the card number",
            "example": "4242"
          },
          "exp_month": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Expiration month (2 digits)",
            "example": "12"
          },
          "exp_year": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Expiration year (4 digits)",
            "example": "2025"
          },
          "address_zip": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Billing address ZIP/postal code",
            "example": "10001"
          },
          "country": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Card country code",
            "example": "US"
          },
          "fingerprint": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Unique card fingerprint for duplicate detection"
          },
          "cardholder_name_first": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Cardholder first name",
            "example": "John"
          },
          "cardholder_name_last": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Cardholder last name",
            "example": "Doe"
          },
          "address_street1": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Billing address line 1",
            "example": "123 Main St"
          },
          "address_street2": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Billing address line 2",
            "example": "Apt 4B"
          },
          "address_city": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Billing address city",
            "example": "New York"
          },
          "address_state": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Billing address state/province",
            "example": "NY"
          },
          "address_country": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Billing address country code",
            "example": "US"
          },
          "created_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Timestamp when card was added",
            "example": "2024-01-15T10:30:00Z"
          },
          "updated_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Timestamp when card was last updated",
            "example": "2024-01-20T14:45:00Z"
          },
          "is_in_use": {
            "type": "boolean",
            "description": "Whether card is used by active subscriptions or payment plans",
            "example": true
          },
          "active_subscription_count": {
            "type": "integer",
            "description": "Number of active subscriptions using this card",
            "example": 2
          },
          "active_paymentplan_count": {
            "type": "integer",
            "description": "Number of active payment plans using this card",
            "example": 1
          },
          "gateway_id": {
            "type": "integer",
            "nullable": true,
            "description": "Gateway ID from the latest card source"
          },
          "stripe_paymentmethod_id": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Stripe PaymentMethod ID from the latest card source"
          },
          "stripe_customer_id": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Stripe Customer ID from the latest card source"
          },
          "paypal_billing_agreement_id": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "PayPal billing agreement ID from the latest card source"
          },
          "paypal_payer_id": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "PayPal payer ID from the latest card source"
          },
          "paypal_customer_id": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "PayPal customer ID from the latest card source"
          },
          "paypal_token_id": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "PayPal token ID from the latest card source"
          },
          "is_incompatible": {
            "type": "boolean",
            "description": "Whether this card is incompatible with the subscription due to different Stripe customer ID"
          },
          "is_test_broken": {
            "type": "boolean",
            "description": "Always false in production; internal QA use only."
          }
        },
        "required": [
          "id",
          "customer_id",
          "is_in_use",
          "active_subscription_count",
          "active_paymentplan_count"
        ]
      },
      "CustomerStats": {
        "type": "object",
        "properties": {
          "sales_count": {
            "type": "integer",
            "description": "Total number of completed sales/orders",
            "example": 42
          },
          "sales_amount": {
            "type": "number",
            "description": "Total sales amount in dollars",
            "example": 1234.56
          },
          "active_subscription_count": {
            "type": "integer",
            "description": "Number of active subscriptions",
            "example": 3
          },
          "unpaid_subscription_count": {
            "type": "integer",
            "description": "Number of subscriptions with unpaid invoices",
            "example": 0
          },
          "payment_plan_in_progress_count": {
            "type": "integer",
            "description": "Number of active payment plans",
            "example": 1
          }
        },
        "description": "Customer statistics (included via ?include=stats)"
      },
      "Customer": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "minimum": 0,
            "exclusiveMinimum": true,
            "description": "Unique customer identifier",
            "example": 12345
          },
          "account_id": {
            "type": "integer",
            "minimum": 0,
            "exclusiveMinimum": true,
            "description": "Account ID this customer belongs to",
            "example": 1
          },
          "email": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "format": "email",
            "description": "Customer email address",
            "example": "customer@example.com"
          },
          "name_first": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Customer first name",
            "example": "John"
          },
          "name_last": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Customer last name",
            "example": "Doe"
          },
          "company_name": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Company name (for business customers)",
            "example": "Acme Corp"
          },
          "tax_id": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Tax identification number",
            "example": "12-3456789"
          },
          "locale": {
            "type": "string",
            "nullable": true,
            "maxLength": 10,
            "description": "BCP 47 locale the customer most recently requested (source of truth for comms)"
          },
          "created_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Timestamp when customer was created",
            "example": "2024-01-15T10:30:00Z"
          },
          "updated_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Timestamp when customer was last updated",
            "example": "2024-01-20T14:45:00Z"
          }
        },
        "required": [
          "id",
          "account_id"
        ]
      },
      "Error404": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "not_found"
                ],
                "example": "not_found"
              },
              "message": {
                "type": "string",
                "example": "Resource not found"
              }
            },
            "required": [
              "code",
              "message"
            ]
          }
        },
        "required": [
          "error"
        ]
      },
      "Error400": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "bad_request"
                ],
                "example": "bad_request"
              },
              "message": {
                "type": "string",
                "example": "Invalid request parameters"
              }
            },
            "required": [
              "code",
              "message"
            ]
          }
        },
        "required": [
          "error"
        ]
      },
      "Error409": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "conflict"
                ],
                "example": "conflict"
              },
              "message": {
                "type": "string",
                "example": "Email is already in use by another customer"
              }
            },
            "required": [
              "code",
              "message"
            ]
          }
        },
        "required": [
          "error"
        ]
      },
      "Order": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Unique order identifier",
            "example": 123
          },
          "customer_id": {
            "type": "integer",
            "description": "Customer who placed the order",
            "example": 12345
          },
          "checkout_publish_id": {
            "type": "integer",
            "description": "Published checkout ID"
          },
          "card_id": {
            "type": "integer",
            "description": "Payment card ID used"
          },
          "checkoutview_id": {
            "type": "integer",
            "nullable": true,
            "description": "Checkout view ID"
          },
          "gateway_id": {
            "type": "integer",
            "nullable": true,
            "description": "Payment gateway ID"
          },
          "user_id": {
            "type": "integer",
            "nullable": true,
            "description": "Admin user who created order (if manual)"
          },
          "account_address_id": {
            "type": "integer",
            "nullable": true,
            "description": "Account address ID"
          },
          "url_token": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Unique URL token for order"
          },
          "currency": {
            "type": "string",
            "nullable": true,
            "enum": [
              "aud",
              "cad",
              "usd",
              "gbp",
              "eur",
              "sgd",
              "aed",
              "afn",
              "all",
              "amd",
              "ang",
              "aoa",
              "ars",
              "awg",
              "azn",
              "bam",
              "bbd",
              "bdt",
              "bgn",
              "bif",
              "bmd",
              "bnd",
              "bob",
              "brl",
              "bsd",
              "bwp",
              "bzd",
              "cdf",
              "chf",
              "clp",
              "cny",
              "cop",
              "crc",
              "cve",
              "czk",
              "djf",
              "dkk",
              "dop",
              "dzd",
              "egp",
              "etb",
              "fjd",
              "fkp",
              "gel",
              "gip",
              "gmd",
              "gnf",
              "gtq",
              "gyd",
              "hkd",
              "hnl",
              "hrk",
              "htg",
              "huf",
              "idr",
              "ils",
              "inr",
              "isk",
              "jmd",
              "jpy",
              "kes",
              "kgs",
              "khr",
              "kmf",
              "krw",
              "kyd",
              "kzt",
              "lak",
              "lbp",
              "lkr",
              "lrd",
              "lsl",
              "mad",
              "mdl",
              "mga",
              "mkd",
              "mmk",
              "mnt",
              "mop",
              "mro",
              "mur",
              "mvr",
              "mwk",
              "mxn",
              "myr",
              "mzn",
              "nad",
              "ngn",
              "nio",
              "nok",
              "npr",
              "nzd",
              "pab",
              "pen",
              "pgk",
              "php",
              "pkr",
              "pln",
              "pyg",
              "qar",
              "ron",
              "rsd",
              "rub",
              "rwf",
              "sar",
              "sbd",
              "scr",
              "sek",
              "shp",
              "sll",
              "sos",
              "srd",
              "std",
              "szl",
              "thb",
              "tjs",
              "top",
              "try",
              "ttd",
              "twd",
              "tzs",
              "uah",
              "ugx",
              "uyu",
              "uzs",
              "vnd",
              "vuv",
              "wst",
              "xaf",
              "xcd",
              "xof",
              "xpf",
              "yer",
              "zar",
              "zmw",
              null
            ],
            "description": "Order currency code",
            "example": "USD"
          },
          "display_total": {
            "type": "integer",
            "description": "Total order amount in cents",
            "example": 9999
          },
          "shipping_country": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Shipping country code",
            "example": "US"
          },
          "shipping_zip": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Shipping ZIP/postal code",
            "example": "10001"
          },
          "shipping_state": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Shipping state/province",
            "example": "NY"
          },
          "shipping_city": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Shipping city",
            "example": "New York"
          },
          "shipping_street2": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Shipping address line 2",
            "example": "Apt 4B"
          },
          "shipping_street1": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Shipping address line 1",
            "example": "123 Main St"
          },
          "billing_country": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Billing country code",
            "example": "US"
          },
          "billing_zip": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Billing ZIP/postal code",
            "example": "10001"
          },
          "billing_state": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Billing state/province",
            "example": "NY"
          },
          "billing_city": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Billing city",
            "example": "New York"
          },
          "billing_street2": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Billing address line 2"
          },
          "billing_street1": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Billing address line 1"
          },
          "phone_number": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Customer phone number",
            "example": "+1-555-123-4567"
          },
          "user_agent": {
            "type": "string",
            "nullable": true,
            "description": "Browser user agent string"
          },
          "terms_signed_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "When terms were accepted"
          },
          "privacy_policy_signed_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "When privacy policy was accepted"
          },
          "marketing_opted_in_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "When customer opted into marketing"
          },
          "is_apple_pay": {
            "type": "boolean",
            "description": "Whether order used Apple Pay",
            "example": false
          },
          "is_rollback": {
            "type": "boolean",
            "description": "Whether order is a rollback"
          },
          "is_captcha": {
            "type": "boolean",
            "description": "Whether CAPTCHA was completed"
          },
          "promo_id": {
            "type": "integer",
            "nullable": true,
            "description": "Promotion ID applied"
          },
          "internal_name": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Internal order name/reference"
          },
          "is_google_pay": {
            "type": "boolean",
            "description": "Whether order used Google Pay",
            "example": false
          },
          "offer_name": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Offer/campaign name"
          },
          "ip": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Customer IP address",
            "example": "192.168.1.1"
          },
          "is_customer_prefilled": {
            "type": "boolean",
            "nullable": true,
            "description": "Whether customer data was pre-filled"
          },
          "affiliate_cookies": {
            "type": "string",
            "nullable": true,
            "description": "Affiliate tracking cookie data (JSON)"
          },
          "event_ready_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "When order event was ready"
          },
          "published_block_item_ids": {
            "type": "array",
            "nullable": true,
            "items": {
              "type": "integer"
            },
            "description": "Array of published block item IDs"
          },
          "preserved_params": {
            "type": "object",
            "nullable": true,
            "additionalProperties": {
              "nullable": true
            },
            "description": "Preserved URL parameters"
          },
          "locale": {
            "type": "string",
            "nullable": true,
            "maxLength": 10,
            "description": "BCP 47 locale code captured at checkout"
          },
          "created_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Order creation timestamp",
            "example": "2024-01-15T10:30:00Z"
          },
          "updated_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Last update timestamp",
            "example": "2024-01-20T14:45:00Z"
          },
          "detail": {
            "type": "object",
            "additionalProperties": {
              "nullable": true
            },
            "description": "Calculated order summary (subtotal, tax, total, etc.)"
          },
          "payment_status": {
            "type": "string",
            "description": "Computed payment status",
            "example": "succeeded"
          },
          "stepkeys": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderStepkey"
            },
            "description": "Order stepkeys (completion status)"
          },
          "checkout": {
            "type": "object",
            "nullable": true,
            "additionalProperties": {
              "nullable": true
            },
            "description": "Checkout configuration"
          },
          "card": {
            "type": "object",
            "nullable": true,
            "additionalProperties": {
              "nullable": true
            },
            "description": "Payment card details (without sources)"
          },
          "gateway": {
            "type": "object",
            "nullable": true,
            "additionalProperties": {
              "nullable": true
            },
            "description": "Payment gateway info"
          },
          "promo": {
            "type": "object",
            "nullable": true,
            "additionalProperties": {
              "nullable": true
            },
            "description": "Promo code data"
          },
          "user": {
            "type": "object",
            "nullable": true,
            "additionalProperties": {
              "nullable": true
            },
            "description": "User who created order (if manual)"
          },
          "checkoutview": {
            "type": "object",
            "nullable": true,
            "additionalProperties": {
              "nullable": true
            },
            "description": "Checkout view data"
          },
          "account_address": {
            "type": "object",
            "nullable": true,
            "additionalProperties": {
              "nullable": true
            },
            "description": "Account address data"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderItem"
            },
            "description": "Order items (expansion: items)"
          },
          "payments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderPayment"
            },
            "description": "Order payments (expansion: payments)"
          },
          "subscriptions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Subscription"
            },
            "description": "Subscriptions (expansion: subscriptions)"
          },
          "paymentplans": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Paymentplan"
            },
            "description": "Payment plans (expansion: paymentplans)"
          },
          "customer": {
            "type": "object",
            "nullable": true,
            "additionalProperties": {
              "nullable": true
            },
            "description": "Customer data with cards (expansion: customer)"
          },
          "affiliate": {
            "type": "object",
            "nullable": true,
            "additionalProperties": {
              "nullable": true
            },
            "description": "Affiliate data (expansion: affiliate)"
          },
          "program": {
            "type": "object",
            "nullable": true,
            "additionalProperties": {
              "nullable": true
            },
            "description": "Affiliate program data (expansion: affiliate)"
          },
          "fields": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "nullable": true
                }
              },
              {
                "type": "object",
                "additionalProperties": {
                  "nullable": true
                }
              },
              {
                "nullable": true
              }
            ],
            "description": "Order fields array (expansion: fields)"
          },
          "integrations": {
            "type": "object",
            "nullable": true,
            "additionalProperties": {
              "nullable": true
            },
            "description": "Integration attributes (expansion: integrations)"
          }
        },
        "required": [
          "id",
          "customer_id",
          "checkout_publish_id",
          "card_id"
        ]
      },
      "OrderStepkey": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "order_id": {
            "type": "integer"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "accepted",
              "declined",
              "expired",
              "in_progress"
            ],
            "description": "Order completion status",
            "example": "accepted"
          },
          "url_slug": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "URL slug for order completion page"
          },
          "session_key": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Session key for order completion"
          },
          "created_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "order_id"
        ]
      },
      "OrderItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Order item ID",
            "example": 456
          },
          "order_id": {
            "type": "integer",
            "description": "Associated order ID",
            "example": 123
          },
          "name": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Item name/description",
            "example": "Premium Widget"
          },
          "base_price": {
            "type": "integer",
            "description": "Base price in cents",
            "example": 2999
          },
          "tax_type": {
            "type": "string",
            "nullable": true,
            "enum": [
              "vat",
              "tax",
              "gst",
              null
            ],
            "description": "Type of tax applied"
          },
          "tax_rate": {
            "type": "number",
            "nullable": true,
            "description": "Tax rate as decimal",
            "example": 0.0825
          },
          "is_commissionable": {
            "type": "boolean",
            "nullable": true,
            "description": "Whether this item generates affiliate commission"
          },
          "is_refunded_by_spiffy": {
            "type": "boolean",
            "nullable": true,
            "description": "Whether refund is handled by Spiffy"
          },
          "published_checkout_item_id": {
            "type": "integer",
            "nullable": true,
            "description": "Source checkout item ID"
          },
          "sort_order": {
            "type": "integer",
            "nullable": true,
            "description": "Display order"
          },
          "product_option_price_id": {
            "type": "integer",
            "nullable": true,
            "description": "Product option price ID"
          },
          "parent_id": {
            "type": "integer",
            "nullable": true,
            "description": "Parent item ID (for nested items)"
          },
          "published_block_item_id": {
            "type": "integer",
            "nullable": true,
            "description": "Block item ID"
          },
          "replace_published_block_item_id": {
            "type": "integer",
            "nullable": true,
            "description": "Replacement block item ID"
          },
          "block_type": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Block type identifier"
          },
          "offset_type": {
            "type": "string",
            "nullable": true,
            "description": "Offset type for billing"
          },
          "replace_price_id": {
            "type": "integer",
            "nullable": true,
            "description": "Replacement price ID"
          },
          "is_skipped": {
            "type": "boolean",
            "description": "Whether this item was skipped"
          },
          "event_ready_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Event readiness timestamp"
          },
          "created_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Creation timestamp"
          },
          "updated_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Last update timestamp"
          },
          "payment_ids": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "description": "Array of payment IDs for this item"
          },
          "discounts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "integer"
                },
                "order_item_id": {
                  "type": "integer"
                },
                "promo_id": {
                  "type": "integer"
                },
                "discount_type": {
                  "type": "string",
                  "nullable": true,
                  "enum": [
                    "amount",
                    "percent",
                    null
                  ],
                  "description": "Type of discount applied"
                },
                "discount_offset": {
                  "type": "integer",
                  "nullable": true,
                  "description": "Discount amount (cents) or percentage"
                },
                "use_taxes": {
                  "type": "boolean",
                  "nullable": true,
                  "description": "Which subtotal tax is calculated on: true = the discounted subtotal, false = the full, undiscounted subtotal (NULL behaves as false)"
                },
                "created_at": {
                  "type": "string",
                  "nullable": true,
                  "format": "date-time"
                },
                "updated_at": {
                  "type": "string",
                  "nullable": true,
                  "format": "date-time"
                },
                "promo_code": {
                  "type": "string",
                  "nullable": true,
                  "description": "Promo code string"
                }
              },
              "required": [
                "id",
                "order_item_id",
                "promo_id"
              ]
            },
            "description": "Discounts applied to this item"
          }
        },
        "required": [
          "id",
          "order_id"
        ]
      },
      "OrderItemDiscount": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "order_item_id": {
            "type": "integer"
          },
          "promo_id": {
            "type": "integer"
          },
          "discount_type": {
            "type": "string",
            "nullable": true,
            "enum": [
              "amount",
              "percent",
              null
            ],
            "description": "Type of discount applied"
          },
          "discount_offset": {
            "type": "integer",
            "nullable": true,
            "description": "Discount amount (cents) or percentage"
          },
          "use_taxes": {
            "type": "boolean",
            "nullable": true,
            "description": "Which subtotal tax is calculated on: true = the discounted subtotal, false = the full, undiscounted subtotal (NULL behaves as false)"
          },
          "created_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "order_item_id",
          "promo_id"
        ]
      },
      "OrderPayment": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Payment ID",
            "example": 789
          },
          "order_id": {
            "type": "integer",
            "description": "Associated order ID",
            "example": 123
          },
          "customer_id": {
            "type": "integer",
            "nullable": true,
            "description": "Customer who made the payment (sourced from the parent order; included for convenience so customer-centric reporting doesn't require a second hop through /v2/orders)",
            "example": 12345
          },
          "source_id": {
            "type": "integer",
            "nullable": true,
            "description": "Payment source (card) ID (database field)"
          },
          "source": {
            "type": "object",
            "properties": {
              "id": {
                "type": "integer",
                "description": "Payment source ID"
              },
              "card_id": {
                "type": "integer",
                "description": "Customer card ID"
              },
              "gateway_id": {
                "type": "integer",
                "description": "Payment gateway ID"
              },
              "stripe_source_id": {
                "type": "string",
                "nullable": true,
                "description": "Stripe source ID"
              },
              "stripe_paymentmethod_id": {
                "type": "string",
                "nullable": true,
                "description": "Stripe payment method ID"
              },
              "paypal_billing_agreement_id": {
                "type": "string",
                "nullable": true,
                "description": "PayPal billing agreement ID"
              },
              "created_at": {
                "type": "string",
                "nullable": true,
                "format": "date-time",
                "description": "Creation timestamp"
              },
              "updated_at": {
                "type": "string",
                "nullable": true,
                "format": "date-time",
                "description": "Last update timestamp"
              },
              "stripe_customer_id": {
                "type": "string",
                "nullable": true,
                "description": "Stripe customer ID"
              },
              "paypal_payer_id": {
                "type": "string",
                "nullable": true,
                "description": "PayPal payer ID"
              },
              "paypal_customer_id": {
                "type": "string",
                "nullable": true,
                "description": "PayPal customer ID"
              },
              "paypal_token_id": {
                "type": "string",
                "nullable": true,
                "description": "PayPal token ID"
              },
              "nmi_customer_vault_id": {
                "type": "string",
                "nullable": true,
                "description": "NMI customer vault ID"
              },
              "authentication": {
                "nullable": true,
                "description": "3D Secure authentication data"
              },
              "customer_id": {
                "type": "integer",
                "description": "Customer ID who owns this source"
              },
              "is_active": {
                "type": "boolean",
                "description": "Whether this source is active"
              },
              "is_three_d_secure_supported": {
                "type": "boolean",
                "description": "Whether 3D Secure is supported"
              },
              "type": {
                "type": "string",
                "nullable": true,
                "description": "Card brand (visa, mastercard, etc.)"
              },
              "last_four": {
                "type": "string",
                "nullable": true,
                "description": "Last 4 digits of card number"
              },
              "exp_month": {
                "type": "string",
                "nullable": true,
                "description": "Expiration month (MM)"
              },
              "exp_year": {
                "type": "string",
                "nullable": true,
                "description": "Expiration year (YYYY)"
              },
              "address_zip": {
                "type": "string",
                "nullable": true,
                "description": "Card billing ZIP/postal code"
              },
              "country": {
                "type": "string",
                "nullable": true,
                "description": "Card country code"
              },
              "fingerprint": {
                "type": "string",
                "nullable": true,
                "description": "Card fingerprint for duplicate detection"
              },
              "cardholder_name_first": {
                "type": "string",
                "nullable": true,
                "description": "Cardholder first name"
              },
              "cardholder_name_last": {
                "type": "string",
                "nullable": true,
                "description": "Cardholder last name"
              },
              "address_street1": {
                "type": "string",
                "nullable": true,
                "description": "Billing address line 1"
              },
              "address_street2": {
                "type": "string",
                "nullable": true,
                "description": "Billing address line 2"
              },
              "address_city": {
                "type": "string",
                "nullable": true,
                "description": "Billing city"
              },
              "address_state": {
                "type": "string",
                "nullable": true,
                "description": "Billing state/province"
              },
              "address_country": {
                "type": "string",
                "nullable": true,
                "description": "Billing country code"
              }
            },
            "required": [
              "id",
              "card_id",
              "gateway_id",
              "customer_id"
            ],
            "description": "Payment source (card) object"
          },
          "gateway_id": {
            "type": "integer",
            "nullable": true,
            "description": "Payment gateway ID"
          },
          "initial_payment_id": {
            "type": "integer",
            "nullable": true,
            "description": "Initial payment ID (for retries)"
          },
          "stripe_charge_id": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Stripe charge ID",
            "example": "ch_1abc123"
          },
          "stripe_invoice_id": {
            "type": "string",
            "nullable": true,
            "description": "Stripe invoice ID"
          },
          "stripe_paymentintent_id": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Stripe PaymentIntent ID",
            "example": "pi_1abc123"
          },
          "paypal_order_id": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "PayPal order ID"
          },
          "paypal_capture_id": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "PayPal capture ID"
          },
          "is_manual": {
            "type": "boolean",
            "nullable": true,
            "description": "Whether payment was manually recorded"
          },
          "is_3ds_in_progress": {
            "type": "boolean",
            "description": "Whether 3D Secure authentication is in progress"
          },
          "amount": {
            "type": "integer",
            "description": "Total payment amount in cents",
            "example": 4999
          },
          "amount_paid": {
            "type": "integer",
            "description": "Amount successfully paid in cents",
            "example": 4999
          },
          "amount_refunded": {
            "type": "integer",
            "description": "Amount refunded in cents",
            "example": 0
          },
          "currency": {
            "type": "string",
            "nullable": true,
            "enum": [
              "aud",
              "cad",
              "usd",
              "gbp",
              "eur",
              "sgd",
              "aed",
              "afn",
              "all",
              "amd",
              "ang",
              "aoa",
              "ars",
              "awg",
              "azn",
              "bam",
              "bbd",
              "bdt",
              "bgn",
              "bif",
              "bmd",
              "bnd",
              "bob",
              "brl",
              "bsd",
              "bwp",
              "bzd",
              "cdf",
              "chf",
              "clp",
              "cny",
              "cop",
              "crc",
              "cve",
              "czk",
              "djf",
              "dkk",
              "dop",
              "dzd",
              "egp",
              "etb",
              "fjd",
              "fkp",
              "gel",
              "gip",
              "gmd",
              "gnf",
              "gtq",
              "gyd",
              "hkd",
              "hnl",
              "hrk",
              "htg",
              "huf",
              "idr",
              "ils",
              "inr",
              "isk",
              "jmd",
              "jpy",
              "kes",
              "kgs",
              "khr",
              "kmf",
              "krw",
              "kyd",
              "kzt",
              "lak",
              "lbp",
              "lkr",
              "lrd",
              "lsl",
              "mad",
              "mdl",
              "mga",
              "mkd",
              "mmk",
              "mnt",
              "mop",
              "mro",
              "mur",
              "mvr",
              "mwk",
              "mxn",
              "myr",
              "mzn",
              "nad",
              "ngn",
              "nio",
              "nok",
              "npr",
              "nzd",
              "pab",
              "pen",
              "pgk",
              "php",
              "pkr",
              "pln",
              "pyg",
              "qar",
              "ron",
              "rsd",
              "rub",
              "rwf",
              "sar",
              "sbd",
              "scr",
              "sek",
              "shp",
              "sll",
              "sos",
              "srd",
              "std",
              "szl",
              "thb",
              "tjs",
              "top",
              "try",
              "ttd",
              "twd",
              "tzs",
              "uah",
              "ugx",
              "uyu",
              "uzs",
              "vnd",
              "vuv",
              "wst",
              "xaf",
              "xcd",
              "xof",
              "xpf",
              "yer",
              "zar",
              "zmw",
              null
            ],
            "description": "Payment currency code",
            "example": "USD"
          },
          "failure_reason": {
            "type": "string",
            "nullable": true,
            "description": "Human-readable failure reason"
          },
          "has_pending_retry": {
            "type": "boolean",
            "description": "Whether a retry is pending"
          },
          "refunded_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Refund timestamp"
          },
          "status": {
            "type": "string",
            "nullable": true,
            "enum": [
              "pending",
              "succeeded",
              "failed",
              "refunded",
              "disputed",
              "dispute_refunded",
              null
            ],
            "description": "Payment status",
            "example": "succeeded"
          },
          "is_3ds": {
            "type": "boolean",
            "description": "Whether 3D Secure was used"
          },
          "can_skip": {
            "type": "boolean",
            "description": "Whether payment can be skipped"
          },
          "nmi_transaction_id": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "NMI transaction ID"
          },
          "is_startup_fee": {
            "type": "boolean",
            "description": "Whether this is a startup/setup fee"
          },
          "failure_code": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Gateway-specific failure code"
          },
          "payment_method_type": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "What actually paid this charge, as the gateway reports it (e.g. card, apple_pay, klarna, afterpay_clearpay). Null when unknown or not recorded — clients should fall back to the card display.",
            "example": "klarna"
          },
          "financing_installments_count": {
            "type": "integer",
            "nullable": true,
            "description": "Number of installments for a financing (BNPL) payment. Null for non-financing payments.",
            "example": 4
          },
          "created_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Creation timestamp"
          },
          "updated_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Last update timestamp"
          },
          "attempts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "integer"
                },
                "order_id": {
                  "type": "integer"
                },
                "initial_payment_id": {
                  "type": "integer",
                  "nullable": true
                },
                "amount": {
                  "type": "integer"
                },
                "amount_paid": {
                  "type": "integer"
                },
                "amount_refunded": {
                  "type": "integer"
                },
                "currency": {
                  "type": "string",
                  "nullable": true
                },
                "status": {
                  "type": "string"
                },
                "failure_reason": {
                  "type": "string",
                  "nullable": true
                },
                "has_pending_retry": {
                  "type": "boolean",
                  "nullable": true
                },
                "created_at": {
                  "type": "string",
                  "nullable": true,
                  "format": "date-time"
                },
                "updated_at": {
                  "type": "string",
                  "nullable": true,
                  "format": "date-time"
                }
              },
              "required": [
                "id"
              ]
            },
            "description": "Payment retry attempts"
          }
        },
        "required": [
          "id",
          "order_id",
          "amount_paid"
        ]
      },
      "PaymentSource": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Payment source ID"
          },
          "card_id": {
            "type": "integer",
            "description": "Customer card ID"
          },
          "gateway_id": {
            "type": "integer",
            "description": "Payment gateway ID"
          },
          "stripe_source_id": {
            "type": "string",
            "nullable": true,
            "description": "Stripe source ID"
          },
          "stripe_paymentmethod_id": {
            "type": "string",
            "nullable": true,
            "description": "Stripe payment method ID"
          },
          "paypal_billing_agreement_id": {
            "type": "string",
            "nullable": true,
            "description": "PayPal billing agreement ID"
          },
          "created_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Creation timestamp"
          },
          "updated_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Last update timestamp"
          },
          "stripe_customer_id": {
            "type": "string",
            "nullable": true,
            "description": "Stripe customer ID"
          },
          "paypal_payer_id": {
            "type": "string",
            "nullable": true,
            "description": "PayPal payer ID"
          },
          "paypal_customer_id": {
            "type": "string",
            "nullable": true,
            "description": "PayPal customer ID"
          },
          "paypal_token_id": {
            "type": "string",
            "nullable": true,
            "description": "PayPal token ID"
          },
          "nmi_customer_vault_id": {
            "type": "string",
            "nullable": true,
            "description": "NMI customer vault ID"
          },
          "authentication": {
            "nullable": true,
            "description": "3D Secure authentication data"
          },
          "customer_id": {
            "type": "integer",
            "description": "Customer ID who owns this source"
          },
          "is_active": {
            "type": "boolean",
            "description": "Whether this source is active"
          },
          "is_three_d_secure_supported": {
            "type": "boolean",
            "description": "Whether 3D Secure is supported"
          },
          "type": {
            "type": "string",
            "nullable": true,
            "description": "Card brand (visa, mastercard, etc.)"
          },
          "last_four": {
            "type": "string",
            "nullable": true,
            "description": "Last 4 digits of card number"
          },
          "exp_month": {
            "type": "string",
            "nullable": true,
            "description": "Expiration month (MM)"
          },
          "exp_year": {
            "type": "string",
            "nullable": true,
            "description": "Expiration year (YYYY)"
          },
          "address_zip": {
            "type": "string",
            "nullable": true,
            "description": "Card billing ZIP/postal code"
          },
          "country": {
            "type": "string",
            "nullable": true,
            "description": "Card country code"
          },
          "fingerprint": {
            "type": "string",
            "nullable": true,
            "description": "Card fingerprint for duplicate detection"
          },
          "cardholder_name_first": {
            "type": "string",
            "nullable": true,
            "description": "Cardholder first name"
          },
          "cardholder_name_last": {
            "type": "string",
            "nullable": true,
            "description": "Cardholder last name"
          },
          "address_street1": {
            "type": "string",
            "nullable": true,
            "description": "Billing address line 1"
          },
          "address_street2": {
            "type": "string",
            "nullable": true,
            "description": "Billing address line 2"
          },
          "address_city": {
            "type": "string",
            "nullable": true,
            "description": "Billing city"
          },
          "address_state": {
            "type": "string",
            "nullable": true,
            "description": "Billing state/province"
          },
          "address_country": {
            "type": "string",
            "nullable": true,
            "description": "Billing country code"
          }
        },
        "required": [
          "id",
          "card_id",
          "gateway_id",
          "customer_id"
        ]
      },
      "Subscription": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Subscription ID"
          },
          "order_item_id": {
            "type": "integer",
            "description": "Associated order item ID"
          },
          "product_option_price_id": {
            "type": "integer",
            "description": "Product option price ID"
          },
          "card_id": {
            "type": "integer",
            "description": "Payment card ID"
          },
          "swapped_from_id": {
            "type": "integer",
            "nullable": true,
            "description": "Previous subscription ID if swapped"
          },
          "published_block_item_id": {
            "type": "integer",
            "nullable": true,
            "description": "Published block item ID"
          },
          "replace_published_block_item_id": {
            "type": "integer",
            "nullable": true,
            "description": "Replacement block item ID"
          },
          "name": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Subscription name/description"
          },
          "block_type": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Block type identifier"
          },
          "stripe_subscription_id": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Stripe subscription ID"
          },
          "stripe_subscription_item_id": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Stripe subscription item ID"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "trialing",
              "active",
              "past_due",
              "canceling",
              "canceled",
              "unpaid",
              "swapped"
            ],
            "description": "Subscription status",
            "example": "active"
          },
          "next_payment_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Next scheduled payment date"
          },
          "trial_days": {
            "type": "integer",
            "description": "Trial period duration in days"
          },
          "num_payment_skips_remaining": {
            "type": "integer",
            "description": "Number of payment skips remaining"
          },
          "tax_rate": {
            "type": "number",
            "nullable": true,
            "description": "Tax rate as decimal",
            "example": 0.0825
          },
          "is_commissionable": {
            "type": "boolean",
            "nullable": true,
            "description": "Whether subscription generates affiliate commission"
          },
          "is_trial_end_upcoming_sent": {
            "type": "boolean",
            "nullable": true,
            "description": "Whether trial end notification was sent"
          },
          "unpaid_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "When subscription became unpaid"
          },
          "canceled_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "When subscription was canceled"
          },
          "order_id": {
            "type": "integer",
            "nullable": true,
            "description": "Associated order ID"
          },
          "tax_type": {
            "type": "string",
            "nullable": true,
            "description": "Type of tax (vat, tax, gst)"
          },
          "replace_price_id": {
            "type": "integer",
            "nullable": true,
            "description": "Replacement price ID"
          },
          "published_checkout_item_id": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Published checkout item ID"
          },
          "event_ready_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "When subscription event was ready"
          },
          "created_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Creation timestamp"
          },
          "updated_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Last update timestamp"
          },
          "payment_ids": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "description": "Array of payment IDs (excluding initial payment)"
          },
          "retry_schedule": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Pending retry schedule for past_due subscriptions (array of date strings)"
          },
          "current_payment_status": {
            "type": "string",
            "nullable": true,
            "description": "Status of most recent payment"
          },
          "detail": {
            "type": "object",
            "additionalProperties": {
              "nullable": true
            },
            "description": "Calculated subscription details (pricing, totals)"
          },
          "discounts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "integer",
                  "description": "Discount ID"
                },
                "subscription_id": {
                  "type": "integer",
                  "description": "Associated subscription ID"
                },
                "promo_id": {
                  "type": "integer",
                  "description": "Promotion ID"
                },
                "stripe_coupon_id": {
                  "type": "string",
                  "nullable": true,
                  "maxLength": 255,
                  "description": "Stripe coupon ID"
                },
                "discount_type": {
                  "type": "string",
                  "nullable": true,
                  "enum": [
                    "amount",
                    "percent",
                    null
                  ],
                  "description": "Type of discount (fixed amount or percentage)"
                },
                "discount_offset": {
                  "type": "integer",
                  "nullable": true,
                  "description": "Discount value (cents for amount, percentage for percent)"
                },
                "duration_in_months": {
                  "type": "integer",
                  "description": "Duration of discount in months"
                },
                "use_taxes": {
                  "type": "boolean",
                  "nullable": true,
                  "description": "Which subtotal tax is calculated on: true = the discounted subtotal, false = the full, undiscounted subtotal (NULL behaves as false)"
                },
                "created_at": {
                  "type": "string",
                  "nullable": true,
                  "format": "date-time",
                  "description": "Creation timestamp"
                },
                "updated_at": {
                  "type": "string",
                  "nullable": true,
                  "format": "date-time",
                  "description": "Last update timestamp"
                },
                "deactivated_at": {
                  "type": "string",
                  "nullable": true,
                  "format": "date-time",
                  "description": "When the discount was deactivated"
                },
                "promo_code": {
                  "type": "string",
                  "nullable": true,
                  "description": "Promo code from related promo"
                }
              },
              "required": [
                "id",
                "subscription_id",
                "promo_id"
              ]
            },
            "description": "Discounts applied to subscription"
          },
          "usage": {
            "type": "object",
            "nullable": true,
            "additionalProperties": {
              "nullable": true
            },
            "description": "Usage data from payment gateway"
          },
          "payments": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": {
                "nullable": true
              }
            },
            "description": "Subscription payments (expansion: payments)"
          },
          "custom_fields": {
            "type": "array",
            "items": {
              "nullable": true
            },
            "description": "Custom fields (expansion: custom_fields)"
          },
          "customer": {
            "type": "object",
            "nullable": true,
            "additionalProperties": {
              "nullable": true
            },
            "description": "Customer data (expansion: customer)"
          },
          "order": {
            "type": "object",
            "nullable": true,
            "additionalProperties": {
              "nullable": true
            },
            "description": "Order data (expansion: order)"
          },
          "price": {
            "type": "object",
            "nullable": true,
            "additionalProperties": {
              "nullable": true
            },
            "description": "Product option price with nested option and product"
          },
          "card": {
            "type": "object",
            "nullable": true,
            "additionalProperties": {
              "nullable": true
            },
            "description": "Payment card associated with this subscription"
          },
          "gateway": {
            "type": "object",
            "nullable": true,
            "additionalProperties": {
              "nullable": true
            },
            "description": "Payment gateway used for this subscription"
          }
        },
        "required": [
          "id",
          "order_item_id",
          "product_option_price_id",
          "card_id"
        ]
      },
      "SubscriptionDiscount": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Discount ID"
          },
          "subscription_id": {
            "type": "integer",
            "description": "Associated subscription ID"
          },
          "promo_id": {
            "type": "integer",
            "description": "Promotion ID"
          },
          "stripe_coupon_id": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Stripe coupon ID"
          },
          "discount_type": {
            "type": "string",
            "nullable": true,
            "enum": [
              "amount",
              "percent",
              null
            ],
            "description": "Type of discount (fixed amount or percentage)"
          },
          "discount_offset": {
            "type": "integer",
            "nullable": true,
            "description": "Discount value (cents for amount, percentage for percent)"
          },
          "duration_in_months": {
            "type": "integer",
            "description": "Duration of discount in months"
          },
          "use_taxes": {
            "type": "boolean",
            "nullable": true,
            "description": "Which subtotal tax is calculated on: true = the discounted subtotal, false = the full, undiscounted subtotal (NULL behaves as false)"
          },
          "created_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Creation timestamp"
          },
          "updated_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Last update timestamp"
          },
          "deactivated_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "When the discount was deactivated"
          }
        },
        "required": [
          "id",
          "subscription_id",
          "promo_id"
        ]
      },
      "Paymentplan": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Payment plan ID"
          },
          "order_id": {
            "type": "integer",
            "description": "Associated order ID"
          },
          "card_id": {
            "type": "integer",
            "description": "Card used for payments"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "past_due",
              "unpaid",
              "completed",
              "defaulted"
            ],
            "description": "Payment plan status. 'defaulted' is a terminal write-off state set via the pay endpoint with payoff_outcome='defaulted'.",
            "example": "active"
          },
          "next_payment_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Next scheduled payment date"
          },
          "finished_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Timestamp when the plan reached a terminal state (completed or defaulted). Null for active plans.",
            "example": "2026-05-04T12:00:00Z"
          },
          "frequency": {
            "type": "string",
            "enum": [
              "day",
              "week",
              "month",
              "year"
            ],
            "description": "Payment frequency",
            "example": "month"
          },
          "frequency_count": {
            "type": "integer",
            "description": "Frequency multiplier (e.g., 2 for bi-weekly)",
            "example": 1
          },
          "is_finance_hidden": {
            "type": "boolean",
            "nullable": true,
            "description": "Whether finance details are hidden"
          },
          "unpaid_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "When payment plan became unpaid"
          },
          "is_scheduled": {
            "type": "boolean",
            "description": "Whether plan is scheduled"
          },
          "created_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Creation timestamp"
          },
          "updated_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time",
            "description": "Last update timestamp"
          },
          "remaining_balance": {
            "type": "integer",
            "description": "Remaining balance in cents"
          },
          "paid_amount": {
            "type": "integer",
            "description": "Total paid amount in cents"
          },
          "total_amount": {
            "type": "integer",
            "description": "Total plan amount in cents"
          },
          "defaulted_amount": {
            "type": "integer",
            "description": "Magnitude of write-off adjustments tied to this plan from a payoff_outcome='defaulted' request, in cents (positive). Zero for plans that were never defaulted."
          },
          "payments_made": {
            "type": "integer",
            "description": "Number of payments made"
          },
          "payments_remaining": {
            "type": "integer",
            "description": "Number of payments remaining"
          },
          "item_ids": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "description": "Order item IDs in this plan"
          },
          "current_payment_status": {
            "type": "string",
            "nullable": true,
            "description": "Status of most recent payment"
          },
          "payment_ids": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "description": "Payment IDs for this plan"
          },
          "retry_schedule": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Pending retry schedule for past_due plans (array of date strings)"
          },
          "detail": {
            "type": "object",
            "additionalProperties": {
              "nullable": true
            },
            "description": "Calculated payment plan details"
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": {
                "nullable": true
              }
            },
            "description": "Payment plan items (expansion: items)"
          },
          "payments": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": {
                "nullable": true
              }
            },
            "description": "Payments for this plan (expansion: payments)"
          },
          "order": {
            "type": "object",
            "nullable": true,
            "additionalProperties": {
              "nullable": true
            },
            "description": "Order data (expansion: order)"
          },
          "customer": {
            "type": "object",
            "nullable": true,
            "additionalProperties": {
              "nullable": true
            },
            "description": "Customer data (expansion: customer)"
          },
          "custom_fields": {
            "type": "array",
            "items": {
              "nullable": true
            },
            "description": "Custom fields (expansion: custom_fields)"
          },
          "card": {
            "type": "object",
            "nullable": true,
            "additionalProperties": {
              "nullable": true
            },
            "description": "Payment card (expansion: card)"
          },
          "gateway": {
            "type": "object",
            "nullable": true,
            "additionalProperties": {
              "nullable": true
            },
            "description": "Payment gateway info (expansion: gateway)"
          }
        },
        "required": [
          "id",
          "order_id",
          "card_id",
          "status",
          "frequency"
        ]
      },
      "AnalyticsQueryResponse": {
        "type": "object",
        "properties": {
          "groupBy": {
            "type": "string"
          },
          "period": {
            "type": "object",
            "properties": {
              "start": {
                "type": "string"
              },
              "end": {
                "type": "string"
              }
            },
            "required": [
              "start",
              "end"
            ]
          },
          "comparison": {
            "type": "object",
            "nullable": true,
            "properties": {
              "start": {
                "type": "string"
              },
              "end": {
                "type": "string"
              }
            },
            "required": [
              "start",
              "end"
            ]
          },
          "groups": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "number"
                    }
                  ]
                },
                "label": {
                  "type": "string"
                },
                "meta": {
                  "type": "string"
                },
                "metrics": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "object",
                    "properties": {
                      "value": {
                        "type": "number"
                      },
                      "previous": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "value"
                    ]
                  }
                }
              },
              "required": [
                "key",
                "label",
                "metrics"
              ]
            }
          },
          "totals": {
            "type": "object",
            "additionalProperties": {
              "type": "object",
              "properties": {
                "value": {
                  "type": "number"
                },
                "previous": {
                  "type": "number"
                }
              },
              "required": [
                "value"
              ]
            }
          }
        },
        "required": [
          "groupBy",
          "period",
          "comparison",
          "groups",
          "totals"
        ]
      },
      "AnalyticsQueryRequest": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "account",
              "checkout",
              "product"
            ],
            "description": "Query scope: 'account' for account-wide analytics, or 'checkout' to scope to a single checkout (requires objId). 'product' is not yet supported."
          },
          "objId": {
            "type": "string",
            "description": "Id of the scoped object. Required when object is 'checkout'; omit for 'account'."
          },
          "metrics": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Metric keys to return (e.g. ['revenue', 'mrr', 'refunds']). Omit for the default orders-family set. See get_analytics_capabilities for all keys and their groupBy compatibility."
          },
          "groupBy": {
            "type": "string",
            "description": "'interval' for a time series, or a dimension key (channel, utm_source, utm_medium, utm_campaign, utm_term, utm_content, referring_domain) for an attribution breakdown — see get_analytics_capabilities."
          },
          "period": {
            "type": "object",
            "properties": {
              "start": {
                "type": "string"
              },
              "end": {
                "type": "string"
              }
            },
            "required": [
              "start",
              "end"
            ],
            "description": "Primary date range. start/end are UTC ISO 8601 strings (e.g. '2026-06-01T00:00:00Z'); timezone offsets are not interpreted."
          },
          "compare": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "previous_period"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "start": {
                    "type": "string"
                  },
                  "end": {
                    "type": "string"
                  }
                },
                "required": [
                  "start",
                  "end"
                ]
              },
              {
                "nullable": true
              }
            ],
            "description": "Optional comparison window: 'previous_period' for the automatically-derived preceding window of equal length, or a custom {start, end} object (UTC ISO 8601). Adds a `previous` value to every metric cell."
          },
          "grouping": {
            "type": "string",
            "enum": [
              "day",
              "week",
              "month"
            ],
            "description": "Bucket size when groupBy is 'interval'. Defaults to 'day'."
          },
          "touch": {
            "type": "string",
            "enum": [
              "first",
              "last"
            ],
            "description": "Attribution touch for dimension breakdowns: 'last' (default) groups by the last-touch snapshot, 'first' by the first-touch snapshot. Ignored for groupBy 'interval'; conversion_rate is visit-grain and unaffected."
          }
        },
        "required": [
          "object",
          "groupBy",
          "period"
        ]
      },
      "AnalyticsCapabilitiesResponse": {
        "type": "object",
        "properties": {
          "objects": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "metrics": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "format": {
                  "type": "string"
                },
                "family": {
                  "type": "string"
                },
                "kind": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "group_by": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "anchor": {
                  "type": "string"
                }
              },
              "required": [
                "key",
                "label",
                "format",
                "family",
                "kind",
                "description",
                "group_by"
              ]
            }
          },
          "dimensions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                }
              },
              "required": [
                "key",
                "label"
              ]
            }
          },
          "intervals": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "compare": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "objects",
          "metrics",
          "dimensions",
          "intervals",
          "compare"
        ]
      },
      "WebhookEndpointCreate": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "maxLength": 2048,
            "format": "uri",
            "description": "URL to receive webhook events",
            "example": "https://example.com/webhooks/spiffy"
          },
          "description": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Human-readable description of the webhook",
            "example": "Production webhook endpoint"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "List of event types to subscribe to (defaults to ['*'])",
            "example": [
              "order.created",
              "order.completed"
            ]
          }
        },
        "required": [
          "url"
        ]
      },
      "WebhookEndpointUpdate": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "maxLength": 2048,
            "format": "uri",
            "description": "URL to receive webhook events",
            "example": "https://example.com/webhooks/spiffy"
          },
          "description": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Human-readable description of the webhook",
            "example": "Production webhook endpoint"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "List of event types to subscribe to",
            "example": [
              "order.created",
              "order.completed"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "inactive"
            ],
            "description": "Webhook status (active or inactive)",
            "example": "active"
          }
        }
      },
      "ReportTypeV2": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "filters": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "data_type": {
                  "type": "string"
                },
                "options": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "nullable": true
                      },
                      "label": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "label"
                    ]
                  }
                }
              },
              "required": [
                "name",
                "data_type"
              ]
            }
          },
          "datasets": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string"
                },
                "display_type": {
                  "type": "string"
                },
                "grouping_properties": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "grouping_intervals": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "string"
                  }
                },
                "columns": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "label": {
                        "type": "string"
                      },
                      "data_type": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "name",
                      "label",
                      "data_type"
                    ]
                  }
                }
              },
              "required": [
                "type",
                "display_type",
                "grouping_properties",
                "columns"
              ]
            }
          },
          "relative_dates": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "type",
          "label",
          "filters",
          "datasets",
          "relative_dates"
        ]
      },
      "ReportV2": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "type": {
            "type": "string",
            "description": "Report type key, e.g. 'product_sales'. See GET /v2/reports/types."
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "filters": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "comparison": {
                  "type": "string"
                },
                "values": {
                  "type": "array",
                  "items": {
                    "nullable": true
                  }
                },
                "value": {
                  "nullable": true
                }
              },
              "required": [
                "name",
                "comparison"
              ]
            },
            "description": "Filter set applied to every run. Valid names/comparisons per type come from GET /v2/reports/types."
          },
          "timezone": {
            "type": "string",
            "description": "IANA timezone the report buckets dates in (legacy semantics — unlike /v2/analytics, which is UTC-only)."
          },
          "relative_date": {
            "type": "string",
            "nullable": true,
            "description": "Date-range preset resolved per run, e.g. 'Last Month'."
          },
          "frequency": {
            "type": "string",
            "nullable": true,
            "enum": [
              "day",
              "week",
              "month",
              "year",
              null
            ]
          },
          "frequency_count": {
            "type": "integer",
            "nullable": true
          },
          "next_run_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          },
          "is_active": {
            "type": "boolean"
          },
          "users": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "user_id": {
                  "type": "integer"
                },
                "name": {
                  "type": "string"
                },
                "email": {
                  "type": "string"
                }
              },
              "required": [
                "user_id"
              ]
            },
            "description": "Scheduled-report recipients (account users with report access)."
          },
          "created_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "type",
          "name",
          "filters",
          "timezone",
          "relative_date",
          "frequency",
          "frequency_count",
          "next_run_at",
          "is_active",
          "created_at",
          "updated_at"
        ]
      },
      "ReportV2Create": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string"
          },
          "name": {
            "type": "string",
            "nullable": true,
            "maxLength": 255
          },
          "filters": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "comparison": {
                  "type": "string"
                },
                "values": {
                  "type": "array",
                  "items": {
                    "nullable": true
                  }
                },
                "value": {
                  "nullable": true
                }
              },
              "required": [
                "name",
                "comparison"
              ]
            },
            "description": "Filter set applied to every run. Valid names/comparisons per type come from GET /v2/reports/types."
          },
          "timezone": {
            "type": "string"
          },
          "relative_date": {
            "type": "string"
          },
          "frequency": {
            "type": "string",
            "enum": [
              "day",
              "week",
              "month",
              "year"
            ]
          },
          "frequency_count": {
            "type": "integer",
            "minimum": 0,
            "exclusiveMinimum": true
          },
          "users": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReportRecipientV2"
            },
            "description": "Schedule recipients — {user_id} or {email} each. When scheduling (frequency set) and this is omitted, defaults to the authorizing user."
          }
        },
        "required": [
          "type"
        ]
      },
      "ReportRecipientV2": {
        "type": "object",
        "properties": {
          "user_id": {
            "type": "integer"
          },
          "email": {
            "type": "string"
          }
        },
        "description": "Exactly one of user_id or email. Omitting users entirely while scheduling defaults the recipient to the authorizing user."
      },
      "ReportV2Update": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Report name. null clears the name."
          },
          "filters": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "comparison": {
                  "type": "string"
                },
                "values": {
                  "type": "array",
                  "items": {
                    "nullable": true
                  }
                },
                "value": {
                  "nullable": true
                }
              },
              "required": [
                "name",
                "comparison"
              ]
            },
            "description": "Filter set applied to every run. Valid names/comparisons per type come from GET /v2/reports/types."
          },
          "timezone": {
            "type": "string"
          },
          "relative_date": {
            "type": "string",
            "nullable": true,
            "description": "Date-range preset, e.g. 'Last Month'. null clears the schedule window (only valid when frequency is also null/cleared)."
          },
          "frequency": {
            "type": "string",
            "nullable": true,
            "enum": [
              "day",
              "week",
              "month",
              "year",
              null
            ],
            "description": "Schedule frequency. null clears the schedule (next_run_at becomes null)."
          },
          "frequency_count": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "exclusiveMinimum": true,
            "description": "Schedule interval multiplier. null clears it (treated as 1 while frequency is set)."
          },
          "users": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReportRecipientV2"
            },
            "description": "Replaces the recipient list — {user_id} or {email} each; [] clears it."
          },
          "is_active": {
            "type": "boolean",
            "description": "true reactivates a soft-deleted report; false soft-deletes (same as DELETE)."
          }
        }
      },
      "ReportRunV2": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "report_id": {
            "type": "integer"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "running",
              "completed",
              "failed"
            ]
          },
          "start_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          },
          "end_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          },
          "started_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          },
          "completed_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          },
          "error_reason": {
            "type": "string",
            "nullable": true
          },
          "stats": {
            "type": "object",
            "nullable": true,
            "properties": {
              "flat_stats": {
                "type": "object",
                "additionalProperties": {
                  "type": "object",
                  "properties": {
                    "value": {
                      "type": "number"
                    },
                    "label": {
                      "type": "string"
                    },
                    "data_type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "value",
                    "label",
                    "data_type"
                  ]
                }
              }
            },
            "description": "Present when completed: the summary stat block (small, conversationally useful)."
          },
          "created_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "report_id",
          "status",
          "start_at",
          "end_at",
          "started_at",
          "completed_at",
          "error_reason",
          "created_at"
        ]
      },
      "ReportRunResultsV2": {
        "type": "object",
        "properties": {
          "dataset": {
            "type": "string"
          },
          "columns": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "data_type": {
                  "type": "string"
                }
              },
              "required": [
                "name",
                "label",
                "data_type"
              ]
            }
          },
          "rows": {
            "type": "array",
            "items": {
              "type": "array",
              "items": {
                "nullable": true
              }
            }
          }
        },
        "required": [
          "dataset",
          "columns",
          "rows"
        ]
      },
      "ReportExportV2": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "description": "Short-lived signed download URL for the full CSV. No authentication needed; expires quickly."
          },
          "expires_at": {
            "type": "string",
            "nullable": true,
            "format": "date-time"
          }
        },
        "required": [
          "url",
          "expires_at"
        ]
      },
      "V1ListResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "nullable": true
            },
            "description": "Array of resource objects"
          },
          "page": {
            "type": "integer",
            "description": "Current page number",
            "example": 1
          },
          "per_page": {
            "type": "integer",
            "description": "Items per page",
            "example": 50
          },
          "total": {
            "type": "integer",
            "description": "Total number of items",
            "example": 250
          },
          "total_pages": {
            "type": "integer",
            "description": "Total number of pages",
            "example": 5
          }
        },
        "required": [
          "data",
          "page",
          "per_page",
          "total",
          "total_pages"
        ]
      },
      "V1ErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string",
            "example": "not_found"
          },
          "error_description": {
            "type": "string",
            "example": "The requested resource could not be found."
          }
        },
        "required": [
          "error",
          "error_description"
        ]
      }
    },
    "parameters": {}
  },
  "paths": {
    "/v2/customers": {
      "get": {
        "tags": [
          "customers"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "customers"
            ]
          }
        ],
        "summary": "List customers",
        "description": "Retrieve a paginated list of customers",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "description": "Page number",
              "example": 1
            },
            "required": false,
            "description": "Page number",
            "name": "page",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "maximum": 100,
              "description": "Items per page (max 100)",
              "example": 25
            },
            "required": false,
            "description": "Items per page (max 100)",
            "name": "per_page",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Comma-separated list of expansions: cards, fields, stats, integrations, integration_mappings, subscriptions",
              "example": "cards,fields"
            },
            "required": false,
            "description": "Comma-separated list of expansions: cards, fields, stats, integrations, integration_mappings, subscriptions",
            "name": "include",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Search across: name_first, name_last, email",
              "example": "search term"
            },
            "required": false,
            "description": "Search across: name_first, name_last, email",
            "name": "search",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by id (exact match)."
            },
            "required": false,
            "description": "Filter by id (exact match).",
            "name": "filter[id]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by id (greater than or equal)"
            },
            "required": false,
            "description": "Filter by id (greater than or equal)",
            "name": "filter[id.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by id (less than or equal)"
            },
            "required": false,
            "description": "Filter by id (less than or equal)",
            "name": "filter[id.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by id (comma-separated list). Fetches many records in one request instead of one request per id.",
              "example": "101,102,103"
            },
            "required": false,
            "description": "Filter by id (comma-separated list). Fetches many records in one request instead of one request per id.",
            "name": "filter[id.in]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by id (excluding a comma-separated list)"
            },
            "required": false,
            "description": "Filter by id (excluding a comma-separated list)",
            "name": "filter[id.nin]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by email (exact match)."
            },
            "required": false,
            "description": "Filter by email (exact match).",
            "name": "filter[email]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by email (contains)"
            },
            "required": false,
            "description": "Filter by email (contains)",
            "name": "filter[email.contains]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by name_first (exact match)."
            },
            "required": false,
            "description": "Filter by name_first (exact match).",
            "name": "filter[name_first]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by name_first (contains)"
            },
            "required": false,
            "description": "Filter by name_first (contains)",
            "name": "filter[name_first.contains]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by name_last (exact match)."
            },
            "required": false,
            "description": "Filter by name_last (exact match).",
            "name": "filter[name_last]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by name_last (contains)"
            },
            "required": false,
            "description": "Filter by name_last (contains)",
            "name": "filter[name_last.contains]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by company_name (exact match)."
            },
            "required": false,
            "description": "Filter by company_name (exact match).",
            "name": "filter[company_name]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by company_name (contains)"
            },
            "required": false,
            "description": "Filter by company_name (contains)",
            "name": "filter[company_name.contains]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by created_at (exact match)."
            },
            "required": false,
            "description": "Filter by created_at (exact match).",
            "name": "filter[created_at]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by created_at (greater than or equal)"
            },
            "required": false,
            "description": "Filter by created_at (greater than or equal)",
            "name": "filter[created_at.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by created_at (less than or equal)"
            },
            "required": false,
            "description": "Filter by created_at (less than or equal)",
            "name": "filter[created_at.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by updated_at (exact match)."
            },
            "required": false,
            "description": "Filter by updated_at (exact match).",
            "name": "filter[updated_at]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by updated_at (greater than or equal)"
            },
            "required": false,
            "description": "Filter by updated_at (greater than or equal)",
            "name": "filter[updated_at.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by updated_at (less than or equal)"
            },
            "required": false,
            "description": "Filter by updated_at (less than or equal)",
            "name": "filter[updated_at.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Sort field (prefix with - for descending)",
              "example": "-created_at"
            },
            "required": false,
            "description": "Sort field (prefix with - for descending)",
            "name": "sort",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response with paginated list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "nullable": true
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Current page number",
                          "example": 1
                        },
                        "limit": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Items per page",
                          "example": 25
                        },
                        "total": {
                          "type": "integer",
                          "description": "Total number of items",
                          "example": 150
                        },
                        "pages": {
                          "type": "integer",
                          "description": "Total number of pages",
                          "example": 6
                        }
                      },
                      "required": [
                        "page",
                        "limit",
                        "total",
                        "pages"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "pagination"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/customers/{id}": {
      "get": {
        "tags": [
          "customers"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "customers"
            ]
          }
        ],
        "summary": "Get customers",
        "description": "Retrieve a single customers by ID",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "description": "customers ID",
              "example": 12345
            },
            "required": true,
            "description": "customers ID",
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Comma-separated list of expansions: cards, fields, stats, integrations, integration_mappings, subscriptions",
              "example": "cards,fields"
            },
            "required": false,
            "description": "Comma-separated list of expansions: cards, fields, stats, integrations, integration_mappings, subscriptions",
            "name": "include",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "customers"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "customers"
            ]
          }
        ],
        "summary": "Update a customer",
        "description": "Update a customer's core columns, custom EAV fields, and/or third-party integration linkages (e.g. HubSpot contact ID, Infusionsoft contact ID). Pass `fields` for column/EAV writes; pass `integration_mappings` for integration linkages. Either or both may be provided.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "fields": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "field_id": {
                          "type": "string"
                        },
                        "field_name": {
                          "type": "string"
                        },
                        "field_type": {
                          "type": "string"
                        },
                        "value": {
                          "nullable": true
                        }
                      },
                      "required": [
                        "field_id",
                        "field_name",
                        "field_type"
                      ]
                    },
                    "description": "Array of field objects to update on the customer (core columns and custom EAV fields). Either this or integration_mappings is required."
                  },
                  "integration_mappings": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "object",
                      "additionalProperties": {
                        "nullable": true
                      }
                    },
                    "description": "Map of { integration_slug: { field_key: value } } to set integration linkages on the customer (e.g. HubSpot contact ID, Infusionsoft contact ID). Empty string clears the mapping for non-required fields. Discover valid slugs and field keys via list_integration_entity_fields with entity_type=customer. Customer-portal callers cannot modify mappings (403). Either this or fields is required."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - The request conflicts with the current state of the resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error409"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/customers/{id}/notes": {
      "post": {
        "tags": [
          "customer_note"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "account"
            ]
          }
        ],
        "summary": "Add note to customer",
        "description": "Add a note to customer activity history",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "notes": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "notes"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - The request conflicts with the current state of the resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error409"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/customers/{primary_id}/merge/{secondary_id}": {
      "get": {
        "tags": [
          "customers"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "customers"
            ]
          }
        ],
        "summary": "Preview customer merge",
        "description": "Preview the result of merging secondary customer into primary customer. Returns both customers and potential conflicts.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Primary customer ID (will remain after merge)"
            },
            "required": true,
            "description": "Primary customer ID (will remain after merge)",
            "name": "primary_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Secondary customer ID (will be deleted after merge)"
            },
            "required": true,
            "description": "Secondary customer ID (will be deleted after merge)",
            "name": "secondary_id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "customers"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "customers"
            ]
          }
        ],
        "summary": "Merge customers",
        "description": "Merge secondary customer into primary customer. All orders, cards, and data from secondary customer will be transferred to primary customer. Secondary customer will be deleted.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Primary customer ID (will remain after merge)"
            },
            "required": true,
            "description": "Primary customer ID (will remain after merge)",
            "name": "primary_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Secondary customer ID (will be deleted after merge)"
            },
            "required": true,
            "description": "Secondary customer ID (will be deleted after merge)",
            "name": "secondary_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "fields": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "field_id": {
                          "type": "string"
                        },
                        "use_primary": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "field_id",
                        "use_primary"
                      ]
                    }
                  }
                },
                "required": [
                  "fields"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/customers/{customer_id}/cards": {
      "get": {
        "tags": [
          "customer_cards"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "account"
            ]
          }
        ],
        "summary": "List customer_cards",
        "description": "List customer cards",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "description": "Page number",
              "example": 1
            },
            "required": false,
            "description": "Page number",
            "name": "page",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "maximum": 100,
              "description": "Items per page (max 100)",
              "example": 25
            },
            "required": false,
            "description": "Items per page (max 100)",
            "name": "per_page",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Sort field (prefix with - for descending)",
              "example": "-created_at"
            },
            "required": false,
            "description": "Sort field (prefix with - for descending)",
            "name": "sort",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response with paginated list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/CardResponse"
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Current page number",
                          "example": 1
                        },
                        "limit": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Items per page",
                          "example": 25
                        },
                        "total": {
                          "type": "integer",
                          "description": "Total number of items",
                          "example": 150
                        },
                        "pages": {
                          "type": "integer",
                          "description": "Total number of pages",
                          "example": 6
                        }
                      },
                      "required": [
                        "page",
                        "limit",
                        "total",
                        "pages"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "pagination"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "customer_cards"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "account"
            ]
          }
        ],
        "summary": "Add card to customer",
        "description": "Add a new payment card to customer using tokenized card data from payment gateway",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Customer ID"
            },
            "required": true,
            "description": "Customer ID",
            "name": "customer_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "payment_gateway": {
                    "type": "string",
                    "enum": [
                      "stripe",
                      "paypal_acp",
                      "whop",
                      "spiffy_payments"
                    ]
                  },
                  "token": {
                    "nullable": true
                  }
                },
                "required": [
                  "payment_gateway"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - The request conflicts with the current state of the resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error409"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/customers/{customer_id}/cards/{card_id}": {
      "delete": {
        "tags": [
          "customer_cards"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "account"
            ]
          }
        ],
        "summary": "Delete customer card",
        "description": "Delete a payment card. Card must not be in use by active subscriptions or payment plans.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Customer ID"
            },
            "required": true,
            "description": "Customer ID",
            "name": "customer_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Card ID to delete"
            },
            "required": true,
            "description": "Card ID to delete",
            "name": "card_id",
            "in": "path"
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted successfully"
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/orders": {
      "get": {
        "tags": [
          "orders"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "orders"
            ]
          }
        ],
        "summary": "List orders",
        "description": "Retrieve a paginated list of orders",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "description": "Page number",
              "example": 1
            },
            "required": false,
            "description": "Page number",
            "name": "page",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "maximum": 100,
              "description": "Items per page (max 100)",
              "example": 25
            },
            "required": false,
            "description": "Items per page (max 100)",
            "name": "per_page",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Comma-separated list of expansions: fields, integrations, items, payments, subscriptions, paymentplans, customer, affiliate, checkout, attribution, checkoutview",
              "example": "fields,integrations"
            },
            "required": false,
            "description": "Comma-separated list of expansions: fields, integrations, items, payments, subscriptions, paymentplans, customer, affiliate, checkout, attribution, checkoutview",
            "name": "include",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by id (exact match)."
            },
            "required": false,
            "description": "Filter by id (exact match).",
            "name": "filter[id]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by id (greater than or equal)"
            },
            "required": false,
            "description": "Filter by id (greater than or equal)",
            "name": "filter[id.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by id (less than or equal)"
            },
            "required": false,
            "description": "Filter by id (less than or equal)",
            "name": "filter[id.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by id (comma-separated list). Fetches many records in one request instead of one request per id.",
              "example": "101,102,103"
            },
            "required": false,
            "description": "Filter by id (comma-separated list). Fetches many records in one request instead of one request per id.",
            "name": "filter[id.in]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by id (excluding a comma-separated list)"
            },
            "required": false,
            "description": "Filter by id (excluding a comma-separated list)",
            "name": "filter[id.nin]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by customer_id (exact match)."
            },
            "required": false,
            "description": "Filter by customer_id (exact match).",
            "name": "filter[customer_id]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by customer_id (greater than or equal)"
            },
            "required": false,
            "description": "Filter by customer_id (greater than or equal)",
            "name": "filter[customer_id.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by customer_id (less than or equal)"
            },
            "required": false,
            "description": "Filter by customer_id (less than or equal)",
            "name": "filter[customer_id.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by customer_id (comma-separated list). Fetches many records in one request instead of one request per id.",
              "example": "101,102,103"
            },
            "required": false,
            "description": "Filter by customer_id (comma-separated list). Fetches many records in one request instead of one request per id.",
            "name": "filter[customer_id.in]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by customer_id (excluding a comma-separated list)"
            },
            "required": false,
            "description": "Filter by customer_id (excluding a comma-separated list)",
            "name": "filter[customer_id.nin]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by checkout_publish_id (exact match)."
            },
            "required": false,
            "description": "Filter by checkout_publish_id (exact match).",
            "name": "filter[checkout_publish_id]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by checkout_publish_id (greater than or equal)"
            },
            "required": false,
            "description": "Filter by checkout_publish_id (greater than or equal)",
            "name": "filter[checkout_publish_id.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by checkout_publish_id (less than or equal)"
            },
            "required": false,
            "description": "Filter by checkout_publish_id (less than or equal)",
            "name": "filter[checkout_publish_id.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by checkout_publish_id (comma-separated list). Fetches many records in one request instead of one request per id.",
              "example": "101,102,103"
            },
            "required": false,
            "description": "Filter by checkout_publish_id (comma-separated list). Fetches many records in one request instead of one request per id.",
            "name": "filter[checkout_publish_id.in]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by checkout_publish_id (excluding a comma-separated list)"
            },
            "required": false,
            "description": "Filter by checkout_publish_id (excluding a comma-separated list)",
            "name": "filter[checkout_publish_id.nin]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by checkout_id (exact match)."
            },
            "required": false,
            "description": "Filter by checkout_id (exact match).",
            "name": "filter[checkout_id]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by checkout_id (greater than or equal)"
            },
            "required": false,
            "description": "Filter by checkout_id (greater than or equal)",
            "name": "filter[checkout_id.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by checkout_id (less than or equal)"
            },
            "required": false,
            "description": "Filter by checkout_id (less than or equal)",
            "name": "filter[checkout_id.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by checkout_id (comma-separated list). Fetches many records in one request instead of one request per id.",
              "example": "101,102,103"
            },
            "required": false,
            "description": "Filter by checkout_id (comma-separated list). Fetches many records in one request instead of one request per id.",
            "name": "filter[checkout_id.in]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by checkout_id (excluding a comma-separated list)"
            },
            "required": false,
            "description": "Filter by checkout_id (excluding a comma-separated list)",
            "name": "filter[checkout_id.nin]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by currency (exact match)."
            },
            "required": false,
            "description": "Filter by currency (exact match).",
            "name": "filter[currency]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by display_total (exact match)."
            },
            "required": false,
            "description": "Filter by display_total (exact match).",
            "name": "filter[display_total]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by display_total (greater than or equal)"
            },
            "required": false,
            "description": "Filter by display_total (greater than or equal)",
            "name": "filter[display_total.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by display_total (less than or equal)"
            },
            "required": false,
            "description": "Filter by display_total (less than or equal)",
            "name": "filter[display_total.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by display_total (comma-separated list). Fetches many records in one request instead of one request per id.",
              "example": "101,102,103"
            },
            "required": false,
            "description": "Filter by display_total (comma-separated list). Fetches many records in one request instead of one request per id.",
            "name": "filter[display_total.in]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by display_total (excluding a comma-separated list)"
            },
            "required": false,
            "description": "Filter by display_total (excluding a comma-separated list)",
            "name": "filter[display_total.nin]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by promo_id (exact match)."
            },
            "required": false,
            "description": "Filter by promo_id (exact match).",
            "name": "filter[promo_id]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by promo_id (greater than or equal)"
            },
            "required": false,
            "description": "Filter by promo_id (greater than or equal)",
            "name": "filter[promo_id.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by promo_id (less than or equal)"
            },
            "required": false,
            "description": "Filter by promo_id (less than or equal)",
            "name": "filter[promo_id.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by promo_id (comma-separated list). Fetches many records in one request instead of one request per id.",
              "example": "101,102,103"
            },
            "required": false,
            "description": "Filter by promo_id (comma-separated list). Fetches many records in one request instead of one request per id.",
            "name": "filter[promo_id.in]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by promo_id (excluding a comma-separated list)"
            },
            "required": false,
            "description": "Filter by promo_id (excluding a comma-separated list)",
            "name": "filter[promo_id.nin]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by created_at (exact match)."
            },
            "required": false,
            "description": "Filter by created_at (exact match).",
            "name": "filter[created_at]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by created_at (greater than or equal)"
            },
            "required": false,
            "description": "Filter by created_at (greater than or equal)",
            "name": "filter[created_at.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by created_at (less than or equal)"
            },
            "required": false,
            "description": "Filter by created_at (less than or equal)",
            "name": "filter[created_at.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by updated_at (exact match)."
            },
            "required": false,
            "description": "Filter by updated_at (exact match).",
            "name": "filter[updated_at]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by updated_at (greater than or equal)"
            },
            "required": false,
            "description": "Filter by updated_at (greater than or equal)",
            "name": "filter[updated_at.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by updated_at (less than or equal)"
            },
            "required": false,
            "description": "Filter by updated_at (less than or equal)",
            "name": "filter[updated_at.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Sort field (prefix with - for descending)",
              "example": "-created_at"
            },
            "required": false,
            "description": "Sort field (prefix with - for descending)",
            "name": "sort",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response with paginated list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Order"
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Current page number",
                          "example": 1
                        },
                        "limit": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Items per page",
                          "example": 25
                        },
                        "total": {
                          "type": "integer",
                          "description": "Total number of items",
                          "example": 150
                        },
                        "pages": {
                          "type": "integer",
                          "description": "Total number of pages",
                          "example": 6
                        }
                      },
                      "required": [
                        "page",
                        "limit",
                        "total",
                        "pages"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "pagination"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/orders/{id}": {
      "get": {
        "tags": [
          "orders"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "orders"
            ]
          }
        ],
        "summary": "Get orders",
        "description": "Retrieve a single orders by ID",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "description": "orders ID",
              "example": 12345
            },
            "required": true,
            "description": "orders ID",
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Comma-separated list of expansions: fields, integrations, items, payments, subscriptions, paymentplans, customer, affiliate, checkout, attribution, checkoutview",
              "example": "fields,integrations"
            },
            "required": false,
            "description": "Comma-separated list of expansions: fields, integrations, items, payments, subscriptions, paymentplans, customer, affiliate, checkout, attribution, checkoutview",
            "name": "include",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Order"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "orders"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "orders"
            ]
          }
        ],
        "summary": "Update order fields",
        "description": "Update order core and custom fields",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "fields": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "field_id": {
                          "type": "string"
                        },
                        "field_name": {
                          "type": "string"
                        },
                        "field_type": {
                          "type": "string"
                        },
                        "value": {
                          "nullable": true
                        }
                      },
                      "required": [
                        "field_id",
                        "field_name",
                        "field_type"
                      ]
                    }
                  }
                },
                "required": [
                  "fields"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - The request conflicts with the current state of the resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error409"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/orders/{id}/refund": {
      "post": {
        "tags": [
          "orders"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "orders"
            ]
          }
        ],
        "summary": "Refund an order",
        "description": "Refund all payments on an order. For partial refunds of a specific payment, use refund_payment.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "do_affiliate_adjustment": {
                    "type": "boolean"
                  },
                  "skip_integration_actions": {
                    "type": "boolean",
                    "description": "Skip the merchant's own automations for every refund made by this call. The refunds are still recorded and order-sync integrations (tax, CRM deal and contact sync) still run. Developer-platform Event Webhooks are still delivered; the merchant's own \"Send Webhook\" automation action is an automation and does NOT run. The choice is stored on each payment, so a later refund of one of them made outside Spiffy inherits it — the last choice made through Spiffy wins."
                  },
                  "notes": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/orders/{id}/notes": {
      "post": {
        "tags": [
          "order_note"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "account"
            ]
          }
        ],
        "summary": "Add note to order",
        "description": "Add a note to order activity history",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "notes": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "notes"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - The request conflicts with the current state of the resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error409"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/orders/{order_id}/items/{item_id}/canceled": {
      "patch": {
        "tags": [
          "orders"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "orders"
            ]
          }
        ],
        "summary": "Cancel order item",
        "description": "Mark an order item as canceled",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Order ID"
            },
            "required": true,
            "description": "Order ID",
            "name": "order_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Order item ID to cancel"
            },
            "required": true,
            "description": "Order item ID to cancel",
            "name": "item_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "is_refunded_by_spiffy": {
                    "type": "boolean"
                  },
                  "notes": {
                    "type": "string"
                  }
                },
                "required": [
                  "is_refunded_by_spiffy"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - The request conflicts with the current state of the resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error409"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/orders/{order_id}/affiliate/{affiliate_id}/program/{program_id}": {
      "get": {
        "tags": [
          "order_affiliate_commissions"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "account"
            ]
          }
        ],
        "summary": "Get affiliate commissions",
        "description": "Get commission details for an affiliate on an order",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Order ID"
            },
            "required": true,
            "description": "Order ID",
            "name": "order_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Affiliate ID"
            },
            "required": true,
            "description": "Affiliate ID",
            "name": "affiliate_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Affiliate program ID"
            },
            "required": true,
            "description": "Affiliate program ID",
            "name": "program_id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "orders"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "orders"
            ]
          }
        ],
        "summary": "Update order affiliate",
        "description": "Update affiliate commission settings for an order",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Order ID"
            },
            "required": true,
            "description": "Order ID",
            "name": "order_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Affiliate ID"
            },
            "required": true,
            "description": "Affiliate ID",
            "name": "affiliate_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Affiliate program ID"
            },
            "required": true,
            "description": "Affiliate program ID",
            "name": "program_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "no_retro_commissions": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - The request conflicts with the current state of the resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error409"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/orders/{order_id}/affiliate": {
      "delete": {
        "tags": [
          "orders"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "orders"
            ]
          }
        ],
        "summary": "Remove order affiliate",
        "description": "Remove affiliate attribution from an order",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Order ID"
            },
            "required": true,
            "description": "Order ID",
            "name": "order_id",
            "in": "path"
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted successfully"
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/affiliates": {
      "get": {
        "tags": [
          "affiliates"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "affiliates"
            ]
          }
        ],
        "summary": "List affiliates",
        "description": "Retrieve a paginated list of affiliates",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "description": "Page number",
              "example": 1
            },
            "required": false,
            "description": "Page number",
            "name": "page",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "maximum": 100,
              "description": "Items per page (max 100)",
              "example": 25
            },
            "required": false,
            "description": "Items per page (max 100)",
            "name": "per_page",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Search across: name_first, name_last, email, slug, paypal_email",
              "example": "search term"
            },
            "required": false,
            "description": "Search across: name_first, name_last, email, slug, paypal_email",
            "name": "search",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by id (exact match)."
            },
            "required": false,
            "description": "Filter by id (exact match).",
            "name": "filter[id]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by id (greater than or equal)"
            },
            "required": false,
            "description": "Filter by id (greater than or equal)",
            "name": "filter[id.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by id (less than or equal)"
            },
            "required": false,
            "description": "Filter by id (less than or equal)",
            "name": "filter[id.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by id (comma-separated list). Fetches many records in one request instead of one request per id.",
              "example": "101,102,103"
            },
            "required": false,
            "description": "Filter by id (comma-separated list). Fetches many records in one request instead of one request per id.",
            "name": "filter[id.in]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by id (excluding a comma-separated list)"
            },
            "required": false,
            "description": "Filter by id (excluding a comma-separated list)",
            "name": "filter[id.nin]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by email (exact match)."
            },
            "required": false,
            "description": "Filter by email (exact match).",
            "name": "filter[email]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by email (contains)"
            },
            "required": false,
            "description": "Filter by email (contains)",
            "name": "filter[email.contains]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by name_first (exact match)."
            },
            "required": false,
            "description": "Filter by name_first (exact match).",
            "name": "filter[name_first]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by name_first (contains)"
            },
            "required": false,
            "description": "Filter by name_first (contains)",
            "name": "filter[name_first.contains]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by name_last (exact match)."
            },
            "required": false,
            "description": "Filter by name_last (exact match).",
            "name": "filter[name_last]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by name_last (contains)"
            },
            "required": false,
            "description": "Filter by name_last (contains)",
            "name": "filter[name_last.contains]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by slug (exact match)."
            },
            "required": false,
            "description": "Filter by slug (exact match).",
            "name": "filter[slug]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by slug (contains)"
            },
            "required": false,
            "description": "Filter by slug (contains)",
            "name": "filter[slug.contains]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by paypal_email (exact match)."
            },
            "required": false,
            "description": "Filter by paypal_email (exact match).",
            "name": "filter[paypal_email]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by paypal_email (contains)"
            },
            "required": false,
            "description": "Filter by paypal_email (contains)",
            "name": "filter[paypal_email.contains]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by is_ready_for_payout (exact match)."
            },
            "required": false,
            "description": "Filter by is_ready_for_payout (exact match).",
            "name": "filter[is_ready_for_payout]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by performance_digest_frequency_days (exact match). Valid values: 0, 1, 7, 30."
            },
            "required": false,
            "description": "Filter by performance_digest_frequency_days (exact match). Valid values: 0, 1, 7, 30.",
            "name": "filter[performance_digest_frequency_days]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by performance_digest_frequency_days (greater than or equal)"
            },
            "required": false,
            "description": "Filter by performance_digest_frequency_days (greater than or equal)",
            "name": "filter[performance_digest_frequency_days.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by performance_digest_frequency_days (less than or equal)"
            },
            "required": false,
            "description": "Filter by performance_digest_frequency_days (less than or equal)",
            "name": "filter[performance_digest_frequency_days.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by performance_digest_frequency_days (comma-separated list). Fetches many records in one request instead of one request per id.",
              "example": "0,1"
            },
            "required": false,
            "description": "Filter by performance_digest_frequency_days (comma-separated list). Fetches many records in one request instead of one request per id.",
            "name": "filter[performance_digest_frequency_days.in]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by performance_digest_frequency_days (excluding a comma-separated list)"
            },
            "required": false,
            "description": "Filter by performance_digest_frequency_days (excluding a comma-separated list)",
            "name": "filter[performance_digest_frequency_days.nin]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by created_at (exact match)."
            },
            "required": false,
            "description": "Filter by created_at (exact match).",
            "name": "filter[created_at]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by created_at (greater than or equal)"
            },
            "required": false,
            "description": "Filter by created_at (greater than or equal)",
            "name": "filter[created_at.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by created_at (less than or equal)"
            },
            "required": false,
            "description": "Filter by created_at (less than or equal)",
            "name": "filter[created_at.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by updated_at (exact match)."
            },
            "required": false,
            "description": "Filter by updated_at (exact match).",
            "name": "filter[updated_at]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by updated_at (greater than or equal)"
            },
            "required": false,
            "description": "Filter by updated_at (greater than or equal)",
            "name": "filter[updated_at.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by updated_at (less than or equal)"
            },
            "required": false,
            "description": "Filter by updated_at (less than or equal)",
            "name": "filter[updated_at.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Sort field (prefix with - for descending)",
              "example": "-created_at"
            },
            "required": false,
            "description": "Sort field (prefix with - for descending)",
            "name": "sort",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response with paginated list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "nullable": true
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Current page number",
                          "example": 1
                        },
                        "limit": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Items per page",
                          "example": 25
                        },
                        "total": {
                          "type": "integer",
                          "description": "Total number of items",
                          "example": 150
                        },
                        "pages": {
                          "type": "integer",
                          "description": "Total number of pages",
                          "example": 6
                        }
                      },
                      "required": [
                        "page",
                        "limit",
                        "total",
                        "pages"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "pagination"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "affiliates"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "affiliates"
            ]
          }
        ],
        "summary": "Create affiliates",
        "description": "Create one or more affiliates (batch). Optionally assign them to programs via program_ids.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "affiliates": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name_first": {
                          "type": "string"
                        },
                        "name_last": {
                          "type": "string"
                        },
                        "email": {
                          "type": "string"
                        },
                        "paypal_email": {
                          "type": "string"
                        },
                        "slug": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "name_first",
                        "name_last",
                        "email"
                      ]
                    }
                  },
                  "program_ids": {
                    "type": "array",
                    "items": {
                      "type": "number"
                    }
                  }
                },
                "required": [
                  "affiliates"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - The request conflicts with the current state of the resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error409"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/affiliates/checkslugs": {
      "put": {
        "tags": [
          "affiliates"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "affiliates"
            ]
          }
        ],
        "summary": "Check affiliate slug availability",
        "description": "Check whether one or more affiliate slugs are available.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "slugs": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "slugs"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/affiliates/programs": {
      "get": {
        "tags": [
          "affiliate-programs"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "affiliates"
            ]
          }
        ],
        "summary": "List affiliate-programs",
        "description": "List and search affiliate programs in a Spiffy account.",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "description": "Page number",
              "example": 1
            },
            "required": false,
            "description": "Page number",
            "name": "page",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "maximum": 100,
              "description": "Items per page (max 100)",
              "example": 25
            },
            "required": false,
            "description": "Items per page (max 100)",
            "name": "per_page",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Sort field (prefix with - for descending)",
              "example": "-created_at"
            },
            "required": false,
            "description": "Sort field (prefix with - for descending)",
            "name": "sort",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response with paginated list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "nullable": true
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Current page number",
                          "example": 1
                        },
                        "limit": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Items per page",
                          "example": 25
                        },
                        "total": {
                          "type": "integer",
                          "description": "Total number of items",
                          "example": 150
                        },
                        "pages": {
                          "type": "integer",
                          "description": "Total number of pages",
                          "example": 6
                        }
                      },
                      "required": [
                        "page",
                        "limit",
                        "total",
                        "pages"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "pagination"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "affiliate-programs"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "affiliates"
            ]
          }
        ],
        "summary": "Create an affiliate program",
        "description": "Create a new affiliate program with commission settings.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string"
                  },
                  "resources_url": {
                    "type": "string"
                  },
                  "btn_text": {
                    "type": "string"
                  },
                  "onetime_commission_percent": {
                    "type": "number"
                  },
                  "subscription_commission_percent": {
                    "type": "number"
                  },
                  "subscription_duration_in_payments": {
                    "type": "number"
                  },
                  "commission_flat_amount": {
                    "type": "number",
                    "description": "Flat commission amount in the smallest currency unit ($10.00 USD = 1000; ¥1500 JPY = 1500)."
                  },
                  "is_default_registration": {
                    "type": "boolean"
                  },
                  "is_lead_tracking_enabled": {
                    "type": "boolean"
                  },
                  "is_lead_sharing_enabled": {
                    "type": "boolean"
                  },
                  "is_purchase_sharing_enabled": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "name",
                  "onetime_commission_percent",
                  "subscription_commission_percent",
                  "subscription_duration_in_payments",
                  "commission_flat_amount",
                  "is_default_registration",
                  "is_lead_tracking_enabled",
                  "is_lead_sharing_enabled",
                  "is_purchase_sharing_enabled"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "integer"
                    },
                    "account_id": {
                      "type": "integer"
                    },
                    "name": {
                      "type": "string",
                      "nullable": true,
                      "maxLength": 255
                    },
                    "onetime_commission_percent": {
                      "type": "number",
                      "nullable": true
                    },
                    "subscription_commission_percent": {
                      "type": "number",
                      "nullable": true
                    },
                    "subscription_duration_in_payments": {
                      "type": "integer"
                    },
                    "is_default_registration": {
                      "type": "boolean"
                    },
                    "status": {
                      "type": "string",
                      "nullable": true,
                      "enum": [
                        "active",
                        "expired",
                        "deleted",
                        null
                      ]
                    },
                    "description": {
                      "type": "string",
                      "nullable": true
                    },
                    "resources_url": {
                      "type": "string",
                      "nullable": true,
                      "maxLength": 255
                    },
                    "btn_text": {
                      "type": "string",
                      "nullable": true,
                      "maxLength": 255
                    },
                    "commission_flat_amount": {
                      "type": "integer",
                      "nullable": true
                    },
                    "is_lead_tracking_enabled": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "is_lead_sharing_enabled": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "is_purchase_sharing_enabled": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "created_at": {
                      "type": "string",
                      "nullable": true,
                      "format": "date-time"
                    },
                    "updated_at": {
                      "type": "string",
                      "nullable": true,
                      "format": "date-time"
                    },
                    "stats": {
                      "type": "object",
                      "nullable": true,
                      "additionalProperties": {
                        "nullable": true
                      }
                    }
                  },
                  "required": [
                    "id",
                    "account_id",
                    "subscription_duration_in_payments"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - The request conflicts with the current state of the resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error409"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/affiliates/programs/{program_id}": {
      "get": {
        "tags": [
          "affiliate-programs"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "affiliates"
            ]
          }
        ],
        "summary": "Get affiliate-programs",
        "description": "Retrieve a single affiliate-programs by ID",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "description": "affiliate-programs ID",
              "example": 12345
            },
            "required": true,
            "description": "affiliate-programs ID",
            "name": "program_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Comma-separated list of expansions: stats",
              "example": "stats"
            },
            "required": false,
            "description": "Comma-separated list of expansions: stats",
            "name": "include",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "integer"
                    },
                    "account_id": {
                      "type": "integer"
                    },
                    "name": {
                      "type": "string",
                      "nullable": true,
                      "maxLength": 255
                    },
                    "onetime_commission_percent": {
                      "type": "number",
                      "nullable": true
                    },
                    "subscription_commission_percent": {
                      "type": "number",
                      "nullable": true
                    },
                    "subscription_duration_in_payments": {
                      "type": "integer"
                    },
                    "is_default_registration": {
                      "type": "boolean"
                    },
                    "status": {
                      "type": "string",
                      "nullable": true,
                      "enum": [
                        "active",
                        "expired",
                        "deleted",
                        null
                      ]
                    },
                    "description": {
                      "type": "string",
                      "nullable": true
                    },
                    "resources_url": {
                      "type": "string",
                      "nullable": true,
                      "maxLength": 255
                    },
                    "btn_text": {
                      "type": "string",
                      "nullable": true,
                      "maxLength": 255
                    },
                    "commission_flat_amount": {
                      "type": "integer",
                      "nullable": true
                    },
                    "is_lead_tracking_enabled": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "is_lead_sharing_enabled": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "is_purchase_sharing_enabled": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "created_at": {
                      "type": "string",
                      "nullable": true,
                      "format": "date-time"
                    },
                    "updated_at": {
                      "type": "string",
                      "nullable": true,
                      "format": "date-time"
                    },
                    "stats": {
                      "type": "object",
                      "nullable": true,
                      "additionalProperties": {
                        "nullable": true
                      }
                    }
                  },
                  "required": [
                    "id",
                    "account_id",
                    "subscription_duration_in_payments"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "affiliate-programs"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "affiliates"
            ]
          }
        ],
        "summary": "Update an affiliate program",
        "description": "Update an existing affiliate program.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Program ID"
            },
            "required": true,
            "description": "Program ID",
            "name": "program_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string"
                  },
                  "resources_url": {
                    "type": "string"
                  },
                  "btn_text": {
                    "type": "string"
                  },
                  "onetime_commission_percent": {
                    "type": "number"
                  },
                  "subscription_commission_percent": {
                    "type": "number"
                  },
                  "subscription_duration_in_payments": {
                    "type": "number"
                  },
                  "commission_flat_amount": {
                    "type": "number",
                    "description": "Flat commission amount in the smallest currency unit ($10.00 USD = 1000; ¥1500 JPY = 1500)."
                  },
                  "is_default_registration": {
                    "type": "boolean"
                  },
                  "is_lead_tracking_enabled": {
                    "type": "boolean"
                  },
                  "is_lead_sharing_enabled": {
                    "type": "boolean"
                  },
                  "is_purchase_sharing_enabled": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "status",
                  "name",
                  "onetime_commission_percent",
                  "subscription_commission_percent",
                  "subscription_duration_in_payments",
                  "commission_flat_amount",
                  "is_default_registration",
                  "is_lead_tracking_enabled",
                  "is_lead_sharing_enabled",
                  "is_purchase_sharing_enabled"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "integer"
                    },
                    "account_id": {
                      "type": "integer"
                    },
                    "name": {
                      "type": "string",
                      "nullable": true,
                      "maxLength": 255
                    },
                    "onetime_commission_percent": {
                      "type": "number",
                      "nullable": true
                    },
                    "subscription_commission_percent": {
                      "type": "number",
                      "nullable": true
                    },
                    "subscription_duration_in_payments": {
                      "type": "integer"
                    },
                    "is_default_registration": {
                      "type": "boolean"
                    },
                    "status": {
                      "type": "string",
                      "nullable": true,
                      "enum": [
                        "active",
                        "expired",
                        "deleted",
                        null
                      ]
                    },
                    "description": {
                      "type": "string",
                      "nullable": true
                    },
                    "resources_url": {
                      "type": "string",
                      "nullable": true,
                      "maxLength": 255
                    },
                    "btn_text": {
                      "type": "string",
                      "nullable": true,
                      "maxLength": 255
                    },
                    "commission_flat_amount": {
                      "type": "integer",
                      "nullable": true
                    },
                    "is_lead_tracking_enabled": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "is_lead_sharing_enabled": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "is_purchase_sharing_enabled": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "created_at": {
                      "type": "string",
                      "nullable": true,
                      "format": "date-time"
                    },
                    "updated_at": {
                      "type": "string",
                      "nullable": true,
                      "format": "date-time"
                    },
                    "stats": {
                      "type": "object",
                      "nullable": true,
                      "additionalProperties": {
                        "nullable": true
                      }
                    }
                  },
                  "required": [
                    "id",
                    "account_id",
                    "subscription_duration_in_payments"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - The request conflicts with the current state of the resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error409"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "affiliate-programs"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "affiliates"
            ]
          }
        ],
        "summary": "Delete an affiliate program",
        "description": "Soft delete an affiliate program (sets status to deleted).",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Program ID"
            },
            "required": true,
            "description": "Program ID",
            "name": "program_id",
            "in": "path"
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted successfully"
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/affiliates/programs/{program_id}/affiliates": {
      "get": {
        "tags": [
          "affiliate-programs"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "affiliates"
            ]
          }
        ],
        "summary": "List affiliate-programs",
        "description": "List affiliates enrolled in a specific affiliate program. Requires program_id in the path.",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "description": "Page number",
              "example": 1
            },
            "required": false,
            "description": "Page number",
            "name": "page",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "maximum": 100,
              "description": "Items per page (max 100)",
              "example": 25
            },
            "required": false,
            "description": "Items per page (max 100)",
            "name": "per_page",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Sort field (prefix with - for descending)",
              "example": "-created_at"
            },
            "required": false,
            "description": "Sort field (prefix with - for descending)",
            "name": "sort",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response with paginated list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "nullable": true
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Current page number",
                          "example": 1
                        },
                        "limit": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Items per page",
                          "example": 25
                        },
                        "total": {
                          "type": "integer",
                          "description": "Total number of items",
                          "example": 150
                        },
                        "pages": {
                          "type": "integer",
                          "description": "Total number of pages",
                          "example": 6
                        }
                      },
                      "required": [
                        "page",
                        "limit",
                        "total",
                        "pages"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "pagination"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "affiliates"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "affiliates"
            ]
          }
        ],
        "summary": "Add affiliates to a program",
        "description": "Create one or more affiliates (batch) and add them to the program in the path. Existing affiliates matched by email are added to the program. program_ids may list additional programs to add them to.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "ID of the affiliate program to add the affiliates to"
            },
            "required": true,
            "description": "ID of the affiliate program to add the affiliates to",
            "name": "program_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "affiliates": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name_first": {
                          "type": "string"
                        },
                        "name_last": {
                          "type": "string"
                        },
                        "email": {
                          "type": "string"
                        },
                        "paypal_email": {
                          "type": "string"
                        },
                        "slug": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "name_first",
                        "name_last",
                        "email"
                      ]
                    }
                  },
                  "program_ids": {
                    "type": "array",
                    "items": {
                      "type": "number"
                    }
                  }
                },
                "required": [
                  "affiliates"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - The request conflicts with the current state of the resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error409"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/affiliates/programs/{program_id}/affiliates/{affiliate_id}": {
      "delete": {
        "tags": [
          "affiliate-programs"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "affiliates"
            ]
          }
        ],
        "summary": "Remove affiliate from program",
        "description": "Deactivate an affiliate within a program.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Program ID"
            },
            "required": true,
            "description": "Program ID",
            "name": "program_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Affiliate ID"
            },
            "required": true,
            "description": "Affiliate ID",
            "name": "affiliate_id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/affiliates/programs/{program_id}/affiliates/{affiliate_id}/adjustments": {
      "post": {
        "tags": [
          "affiliate-programs"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "affiliates"
            ]
          }
        ],
        "summary": "Create program affiliate adjustment",
        "description": "Create a commission adjustment for an affiliate within a program.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Program ID"
            },
            "required": true,
            "description": "Program ID",
            "name": "program_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Affiliate ID"
            },
            "required": true,
            "description": "Affiliate ID",
            "name": "affiliate_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "description": {
                    "type": "string"
                  },
                  "amount": {
                    "type": "number",
                    "description": "Adjustment amount in the smallest currency unit ($10.00 USD = 1000; ¥1500 JPY = 1500)."
                  }
                },
                "required": [
                  "description",
                  "amount"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - The request conflicts with the current state of the resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error409"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/affiliates/payouts": {
      "post": {
        "tags": [
          "affiliate-payouts"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "affiliates"
            ]
          }
        ],
        "summary": "Create a payout",
        "description": "Create a new affiliate payout from unpaid commissions matching the provided filters.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "filters": {
                    "nullable": true,
                    "description": "Report filters for selecting commissions"
                  },
                  "search": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - The request conflicts with the current state of the resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error409"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "affiliate-payouts"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "affiliates"
            ]
          }
        ],
        "summary": "List affiliate-payouts",
        "description": "Retrieve a paginated list of affiliate-payouts",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "description": "Page number",
              "example": 1
            },
            "required": false,
            "description": "Page number",
            "name": "page",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "maximum": 100,
              "description": "Items per page (max 100)",
              "example": 25
            },
            "required": false,
            "description": "Items per page (max 100)",
            "name": "per_page",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Sort field (prefix with - for descending)",
              "example": "-created_at"
            },
            "required": false,
            "description": "Sort field (prefix with - for descending)",
            "name": "sort",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response with paginated list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "nullable": true
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Current page number",
                          "example": 1
                        },
                        "limit": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Items per page",
                          "example": 25
                        },
                        "total": {
                          "type": "integer",
                          "description": "Total number of items",
                          "example": 150
                        },
                        "pages": {
                          "type": "integer",
                          "description": "Total number of pages",
                          "example": 6
                        }
                      },
                      "required": [
                        "page",
                        "limit",
                        "total",
                        "pages"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "pagination"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/affiliates/payouts/current": {
      "get": {
        "tags": [
          "affiliate-payouts"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "affiliates"
            ]
          }
        ],
        "summary": "Get the current unpaid payout",
        "description": "Get an unpaid affiliate payout for the account: one that has been created but not yet marked paid. Takes no payout ID. If several unpaid payouts exist, one of them is returned. The response has the same shape as get_affiliate_payout (commissions grouped by affiliate). Returns not found when the account has no unpaid payout.",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/affiliates/payouts/{payout_id}": {
      "get": {
        "tags": [
          "affiliate-payouts"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "affiliates"
            ]
          }
        ],
        "summary": "Get a payout",
        "description": "Get one affiliate payout by its ID. The response lists the payout's commissions grouped by affiliate: each affiliate's name, email, PayPal email, total amount and currency, plus the IDs of the commission payments and adjustments included. Use list_affiliate_payouts to find payout IDs, or get_current_affiliate_payout for an unpaid payout.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "ID of the payout to fetch"
            },
            "required": true,
            "description": "ID of the payout to fetch",
            "name": "payout_id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "affiliate-payouts"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "affiliates"
            ]
          }
        ],
        "summary": "Complete a payout",
        "description": "Mark a payout as paid. Provide which commissions are being paid.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Payout ID"
            },
            "required": true,
            "description": "Payout ID",
            "name": "payout_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "commissions": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "affiliate_id": {
                          "type": "number"
                        },
                        "is_paid": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "affiliate_id",
                        "is_paid"
                      ]
                    }
                  }
                },
                "required": [
                  "commissions"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - The request conflicts with the current state of the resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error409"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "affiliate-payouts"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "affiliates"
            ]
          }
        ],
        "summary": "Delete a payout",
        "description": "Delete an unpaid payout. Paid payouts cannot be deleted.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Payout ID"
            },
            "required": true,
            "description": "Payout ID",
            "name": "payout_id",
            "in": "path"
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted successfully"
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/affiliates/payouts/{payout_id}/download": {
      "get": {
        "tags": [
          "affiliate-payouts"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "affiliates"
            ]
          }
        ],
        "summary": "Download payout CSV",
        "description": "Download the payout commissions as a CSV file.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Payout ID"
            },
            "required": true,
            "description": "Payout ID",
            "name": "payout_id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/affiliates/programs/{program_id}/checkouts": {
      "post": {
        "tags": [
          "affiliate-programs"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "affiliates"
            ]
          }
        ],
        "summary": "Add checkouts to program",
        "description": "Add one or more checkouts to an affiliate program.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Program ID"
            },
            "required": true,
            "description": "Program ID",
            "name": "program_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "checkouts": {
                    "type": "array",
                    "items": {
                      "type": "number"
                    },
                    "description": "Array of checkout IDs"
                  }
                },
                "required": [
                  "checkouts"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - The request conflicts with the current state of the resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error409"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/affiliates/programs/{program_id}/checkouts/{checkout_id}": {
      "put": {
        "tags": [
          "affiliate-programs"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "affiliates"
            ]
          }
        ],
        "summary": "Update program checkout items",
        "description": "Update commission settings for checkout items and block items within a program checkout.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Program ID"
            },
            "required": true,
            "description": "Program ID",
            "name": "program_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Checkout ID"
            },
            "required": true,
            "description": "Checkout ID",
            "name": "checkout_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "commission_percent": {
                    "type": "number"
                  },
                  "commission_flat_amount": {
                    "type": "number",
                    "description": "Flat commission amount in the smallest currency unit ($10.00 USD = 1000; ¥1500 JPY = 1500)."
                  },
                  "checkout_items": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "checkout_item_id": {
                          "type": "number"
                        },
                        "is_active": {
                          "type": "boolean"
                        },
                        "commission_percent": {
                          "type": "number"
                        },
                        "duration_in_payments": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "checkout_item_id",
                        "is_active"
                      ]
                    }
                  },
                  "block_items": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "block_item_id": {
                          "type": "number"
                        },
                        "is_active": {
                          "type": "boolean"
                        },
                        "commission_percent": {
                          "type": "number"
                        },
                        "duration_in_payments": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "block_item_id",
                        "is_active"
                      ]
                    }
                  }
                },
                "required": [
                  "checkout_items",
                  "block_items"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - The request conflicts with the current state of the resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error409"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "affiliate-programs"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "affiliates"
            ]
          }
        ],
        "summary": "Remove checkout from program",
        "description": "Soft delete a checkout from an affiliate program.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Program ID"
            },
            "required": true,
            "description": "Program ID",
            "name": "program_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Checkout ID"
            },
            "required": true,
            "description": "Checkout ID",
            "name": "checkout_id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/affiliates/programs/{program_id}/checkouts/{checkout_id}/items": {
      "get": {
        "tags": [
          "affiliate-programs"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "affiliates"
            ]
          }
        ],
        "summary": "Get program checkout items",
        "description": "Get checkout items with program-specific commission overrides.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Program ID"
            },
            "required": true,
            "description": "Program ID",
            "name": "program_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Checkout ID"
            },
            "required": true,
            "description": "Checkout ID",
            "name": "checkout_id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/affiliates/programs/{program_id}/prices": {
      "get": {
        "tags": [
          "affiliate-programs"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "affiliates"
            ]
          }
        ],
        "summary": "List affiliate-programs",
        "description": "List the product prices attached to one affiliate program, with any per-price commission override (commission_percent, duration_in_payments). Each row links the program to a product price via product_option_price_id; is_active is false for prices that were removed from the program. Requires program_id in the path.",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "description": "Page number",
              "example": 1
            },
            "required": false,
            "description": "Page number",
            "name": "page",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "maximum": 100,
              "description": "Items per page (max 100)",
              "example": 25
            },
            "required": false,
            "description": "Items per page (max 100)",
            "name": "per_page",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Sort field (prefix with - for descending)",
              "example": "-created_at"
            },
            "required": false,
            "description": "Sort field (prefix with - for descending)",
            "name": "sort",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response with paginated list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "nullable": true
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Current page number",
                          "example": 1
                        },
                        "limit": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Items per page",
                          "example": 25
                        },
                        "total": {
                          "type": "integer",
                          "description": "Total number of items",
                          "example": 150
                        },
                        "pages": {
                          "type": "integer",
                          "description": "Total number of pages",
                          "example": 6
                        }
                      },
                      "required": [
                        "page",
                        "limit",
                        "total",
                        "pages"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "pagination"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "affiliate-programs"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "affiliates"
            ]
          }
        ],
        "summary": "Add prices to program",
        "description": "Add one or more product option prices to an affiliate program.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Program ID"
            },
            "required": true,
            "description": "Program ID",
            "name": "program_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "prices": {
                    "type": "array",
                    "items": {
                      "type": "number"
                    },
                    "description": "Array of product_option_price IDs"
                  }
                },
                "required": [
                  "prices"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - The request conflicts with the current state of the resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error409"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/affiliates/programs/{program_id}/prices/{price_id}": {
      "put": {
        "tags": [
          "affiliate-programs"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "affiliates"
            ]
          }
        ],
        "summary": "Update program price",
        "description": "Update commission settings for a price within an affiliate program.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Program ID"
            },
            "required": true,
            "description": "Program ID",
            "name": "program_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The product_option_price_id (from list_affiliate_program_prices), not the link row id"
            },
            "required": true,
            "description": "The product_option_price_id (from list_affiliate_program_prices), not the link row id",
            "name": "price_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "commission_percent": {
                    "type": "number"
                  },
                  "duration_in_payments": {
                    "type": "number"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - The request conflicts with the current state of the resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error409"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "affiliate-programs"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "affiliates"
            ]
          }
        ],
        "summary": "Remove price from program",
        "description": "Soft delete a price from an affiliate program.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Program ID"
            },
            "required": true,
            "description": "Program ID",
            "name": "program_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The product_option_price_id (from list_affiliate_program_prices), not the link row id"
            },
            "required": true,
            "description": "The product_option_price_id (from list_affiliate_program_prices), not the link row id",
            "name": "price_id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/affiliates/programs/{program_id}/options": {
      "get": {
        "tags": [
          "affiliate-programs"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "affiliates"
            ]
          }
        ],
        "summary": "List affiliate-programs",
        "description": "List the product options attached to one affiliate program, with any per-option commission override (commission_percent). Each row links the program to a product option via product_option_id; is_active is false for options that were removed from the program. Requires program_id in the path.",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "description": "Page number",
              "example": 1
            },
            "required": false,
            "description": "Page number",
            "name": "page",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "maximum": 100,
              "description": "Items per page (max 100)",
              "example": 25
            },
            "required": false,
            "description": "Items per page (max 100)",
            "name": "per_page",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Sort field (prefix with - for descending)",
              "example": "-created_at"
            },
            "required": false,
            "description": "Sort field (prefix with - for descending)",
            "name": "sort",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response with paginated list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "nullable": true
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Current page number",
                          "example": 1
                        },
                        "limit": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Items per page",
                          "example": 25
                        },
                        "total": {
                          "type": "integer",
                          "description": "Total number of items",
                          "example": 150
                        },
                        "pages": {
                          "type": "integer",
                          "description": "Total number of pages",
                          "example": 6
                        }
                      },
                      "required": [
                        "page",
                        "limit",
                        "total",
                        "pages"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "pagination"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "affiliate-programs"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "affiliates"
            ]
          }
        ],
        "summary": "Add options to program",
        "description": "Add one or more product options to an affiliate program.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Program ID"
            },
            "required": true,
            "description": "Program ID",
            "name": "program_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "options": {
                    "type": "array",
                    "items": {
                      "type": "number"
                    },
                    "description": "Array of product_option IDs"
                  }
                },
                "required": [
                  "options"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - The request conflicts with the current state of the resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error409"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/affiliates/programs/{program_id}/options/{option_id}": {
      "put": {
        "tags": [
          "affiliate-programs"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "affiliates"
            ]
          }
        ],
        "summary": "Update program option",
        "description": "Update commission settings for an option within an affiliate program.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Program ID"
            },
            "required": true,
            "description": "Program ID",
            "name": "program_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The product_option_id (from list_affiliate_program_options), not the link row id"
            },
            "required": true,
            "description": "The product_option_id (from list_affiliate_program_options), not the link row id",
            "name": "option_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "commission_percent": {
                    "type": "number"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - The request conflicts with the current state of the resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error409"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "affiliate-programs"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "affiliates"
            ]
          }
        ],
        "summary": "Remove option from program",
        "description": "Soft delete an option from an affiliate program.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Program ID"
            },
            "required": true,
            "description": "Program ID",
            "name": "program_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "The product_option_id (from list_affiliate_program_options), not the link row id"
            },
            "required": true,
            "description": "The product_option_id (from list_affiliate_program_options), not the link row id",
            "name": "option_id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/affiliates/programs/{program_id}/links": {
      "get": {
        "tags": [
          "affiliate-programs"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "affiliates"
            ]
          }
        ],
        "summary": "List affiliate-programs",
        "description": "List tracking links within a specific affiliate program. Requires program_id in the path.",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "description": "Page number",
              "example": 1
            },
            "required": false,
            "description": "Page number",
            "name": "page",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "maximum": 100,
              "description": "Items per page (max 100)",
              "example": 25
            },
            "required": false,
            "description": "Items per page (max 100)",
            "name": "per_page",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by sort_order (exact match)."
            },
            "required": false,
            "description": "Filter by sort_order (exact match).",
            "name": "filter[sort_order]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by created_at (exact match)."
            },
            "required": false,
            "description": "Filter by created_at (exact match).",
            "name": "filter[created_at]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by name (exact match)."
            },
            "required": false,
            "description": "Filter by name (exact match).",
            "name": "filter[name]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Sort field (prefix with - for descending)",
              "example": "-created_at"
            },
            "required": false,
            "description": "Sort field (prefix with - for descending)",
            "name": "sort",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response with paginated list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "nullable": true
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Current page number",
                          "example": 1
                        },
                        "limit": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Items per page",
                          "example": 25
                        },
                        "total": {
                          "type": "integer",
                          "description": "Total number of items",
                          "example": 150
                        },
                        "pages": {
                          "type": "integer",
                          "description": "Total number of pages",
                          "example": 6
                        }
                      },
                      "required": [
                        "page",
                        "limit",
                        "total",
                        "pages"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "pagination"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "affiliate-programs"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "affiliates"
            ]
          }
        ],
        "summary": "Create a program link",
        "description": "Create a tracking link for an affiliate program.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Program ID"
            },
            "required": true,
            "description": "Program ID",
            "name": "program_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "to_url": {
                    "type": "string"
                  },
                  "slug": {
                    "type": "string"
                  },
                  "is_included_in_portal": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "name",
                  "to_url",
                  "is_included_in_portal"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - The request conflicts with the current state of the resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error409"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/affiliates/programs/{program_id}/links/checkslugs": {
      "put": {
        "tags": [
          "affiliate-programs"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "affiliates"
            ]
          }
        ],
        "summary": "Check link slug availability",
        "description": "Check whether one or more link slugs are available within a program.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Program ID"
            },
            "required": true,
            "description": "Program ID",
            "name": "program_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "slugs": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "slugs"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/affiliates/programs/{program_id}/links/order": {
      "put": {
        "tags": [
          "affiliate-programs"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "affiliates"
            ]
          }
        ],
        "summary": "Reorder a program's links",
        "description": "Reorder an affiliate program's tracking links. The submitted links are rearranged among the display positions they already occupy, so a request can permute the ids it contains but cannot move a link past a link it omits — send the full list to reorder a whole program. Returns 204.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Program ID"
            },
            "required": true,
            "description": "Program ID",
            "name": "program_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "link_ids": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    }
                  }
                },
                "required": [
                  "link_ids"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/affiliates/programs/{program_id}/links/{link_id}": {
      "put": {
        "tags": [
          "affiliate-programs"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "affiliates"
            ]
          }
        ],
        "summary": "Update a program link",
        "description": "Update a tracking link for an affiliate program.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Program ID"
            },
            "required": true,
            "description": "Program ID",
            "name": "program_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Link ID"
            },
            "required": true,
            "description": "Link ID",
            "name": "link_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "to_url": {
                    "type": "string"
                  },
                  "slug": {
                    "type": "string"
                  },
                  "is_included_in_portal": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - The request conflicts with the current state of the resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error409"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "affiliate-programs"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "affiliates"
            ]
          }
        ],
        "summary": "Delete a program link",
        "description": "Soft delete a tracking link from an affiliate program.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Program ID"
            },
            "required": true,
            "description": "Program ID",
            "name": "program_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Link ID"
            },
            "required": true,
            "description": "Link ID",
            "name": "link_id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/affiliates/programs/{program_id}/links/{link_id}/checkslugs": {
      "put": {
        "tags": [
          "affiliate-programs"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "affiliates"
            ]
          }
        ],
        "summary": "Check link slug availability",
        "description": "Check whether one or more link slugs are available within a program.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Program ID"
            },
            "required": true,
            "description": "Program ID",
            "name": "program_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "slugs": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "slugs"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/affiliates/{id}": {
      "get": {
        "tags": [
          "affiliates"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "affiliates"
            ]
          }
        ],
        "summary": "Get affiliates",
        "description": "Retrieve a single affiliates by ID",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "description": "affiliates ID",
              "example": 12345
            },
            "required": true,
            "description": "affiliates ID",
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Comma-separated list of expansions: stats, gravatar, customer, cards",
              "example": "stats,gravatar"
            },
            "required": false,
            "description": "Comma-separated list of expansions: stats, gravatar, customer, cards",
            "name": "include",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "integer"
                    },
                    "customer_id": {
                      "type": "integer"
                    },
                    "paypal_email": {
                      "type": "string",
                      "nullable": true,
                      "maxLength": 255
                    },
                    "slug": {
                      "type": "string",
                      "nullable": true,
                      "maxLength": 255
                    },
                    "performance_digest_frequency_days": {
                      "type": "integer",
                      "nullable": true
                    },
                    "last_performance_digest_sent_at": {
                      "type": "string",
                      "nullable": true,
                      "format": "date-time"
                    },
                    "is_ready_for_payout": {
                      "type": "boolean"
                    },
                    "created_at": {
                      "type": "string",
                      "nullable": true,
                      "format": "date-time"
                    },
                    "updated_at": {
                      "type": "string",
                      "nullable": true,
                      "format": "date-time"
                    },
                    "customer": {
                      "type": "object",
                      "nullable": true,
                      "additionalProperties": {
                        "nullable": true
                      }
                    },
                    "stats": {
                      "type": "object",
                      "nullable": true,
                      "additionalProperties": {
                        "nullable": true
                      }
                    },
                    "gravatar": {
                      "type": "string",
                      "nullable": true
                    },
                    "cards": {
                      "type": "array",
                      "nullable": true,
                      "items": {
                        "type": "object",
                        "additionalProperties": {
                          "nullable": true
                        }
                      }
                    }
                  },
                  "required": [
                    "id",
                    "customer_id",
                    "is_ready_for_payout"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "affiliates"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "affiliates"
            ]
          }
        ],
        "summary": "Update an affiliate",
        "description": "Update affiliate fields such as email, name, paypal_email, slug, payout readiness, and performance digest cadence.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Affiliate ID"
            },
            "required": true,
            "description": "Affiliate ID",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string"
                  },
                  "paypal_email": {
                    "type": "string"
                  },
                  "name_first": {
                    "type": "string"
                  },
                  "name_last": {
                    "type": "string"
                  },
                  "slug": {
                    "type": "string"
                  },
                  "is_ready_for_payout": {
                    "type": "boolean"
                  },
                  "performance_digest_frequency_days": {
                    "type": "integer",
                    "description": "How often this affiliate is emailed their performance digest, in days. One of 0, 1, 7, 30, where 0 means never. The affiliate can also change this themselves from their portal, so this is their current preference rather than a merchant-only setting."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "integer"
                    },
                    "customer_id": {
                      "type": "integer"
                    },
                    "paypal_email": {
                      "type": "string",
                      "nullable": true,
                      "maxLength": 255
                    },
                    "slug": {
                      "type": "string",
                      "nullable": true,
                      "maxLength": 255
                    },
                    "performance_digest_frequency_days": {
                      "type": "integer",
                      "nullable": true
                    },
                    "last_performance_digest_sent_at": {
                      "type": "string",
                      "nullable": true,
                      "format": "date-time"
                    },
                    "is_ready_for_payout": {
                      "type": "boolean"
                    },
                    "created_at": {
                      "type": "string",
                      "nullable": true,
                      "format": "date-time"
                    },
                    "updated_at": {
                      "type": "string",
                      "nullable": true,
                      "format": "date-time"
                    },
                    "customer": {
                      "type": "object",
                      "nullable": true,
                      "additionalProperties": {
                        "nullable": true
                      }
                    },
                    "stats": {
                      "type": "object",
                      "nullable": true,
                      "additionalProperties": {
                        "nullable": true
                      }
                    },
                    "gravatar": {
                      "type": "string",
                      "nullable": true
                    },
                    "cards": {
                      "type": "array",
                      "nullable": true,
                      "items": {
                        "type": "object",
                        "additionalProperties": {
                          "nullable": true
                        }
                      }
                    }
                  },
                  "required": [
                    "id",
                    "customer_id",
                    "is_ready_for_payout"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - The request conflicts with the current state of the resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error409"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/affiliates/{id}/checkslugs": {
      "put": {
        "tags": [
          "affiliates"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "affiliates"
            ]
          }
        ],
        "summary": "Check affiliate slug availability",
        "description": "Check whether one or more affiliate slugs are available.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "slugs": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "slugs"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/analytics/query": {
      "post": {
        "tags": [
          "analytics"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "analytics"
            ]
          }
        ],
        "summary": "Query analytics: revenue, orders, AOV, LTV, conversion rate, MRR, subscriptions, refunds — as totals, time series, or attribution breakdowns",
        "description": "Runs an analytics query for the merchant account.\n\ngroupBy 'interval' returns a day/week/month time series.\ngroupBy a dimension breaks orders-family metrics down by attribution source.\n\nMetrics (13 total):\n  Orders family (support dimension breakdowns): revenue, orders, aov, customers, conversion_rate, ltv\n  Subscriptions family (interval only): active_subscriptions, new_subscriptions, churned_subscriptions, mrr\n  Billing family (interval only): refunds, refund_count, failed_payments\n\nDimensions (7): channel, utm_source, utm_medium, utm_campaign, utm_term, utm_content, referring_domain\n\ncompare: pass 'previous_period' for automatic period-over-period comparison,\nor a custom { start, end } object for an explicit comparison window.\n\nDates must be UTC ISO 8601 (e.g. '2026-04-13T00:00:00Z').\nCall get_analytics_capabilities for the full metric/dimension/groupBy compatibility matrix.\n\nExample — revenue last month vs previous period:\n  { \"object\":\"account\", \"groupBy\":\"interval\", \"grouping\":\"day\",\n    \"metrics\":[\"revenue\"], \"period\":{\"start\":\"2026-06-01T00:00:00Z\",\"end\":\"2026-06-30T23:59:59Z\"},\n    \"compare\":\"previous_period\" }",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AnalyticsQueryRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnalyticsQueryResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/analytics/capabilities": {
      "get": {
        "tags": [
          "analytics"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "analytics"
            ]
          }
        ],
        "summary": "List available analytics metrics, dimensions, and groupings",
        "description": "Returns the analytics catalog as data: every metric with its family, kind (flow/stock/derived), date anchor, and compatible groupBy values, plus dimensions, intervals, and comparison modes. Call this before query_analytics to construct valid queries.",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnalyticsCapabilitiesResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/products": {
      "get": {
        "tags": [
          "products"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "products"
            ]
          }
        ],
        "summary": "List products",
        "description": "Retrieve a paginated list of products",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "description": "Page number",
              "example": 1
            },
            "required": false,
            "description": "Page number",
            "name": "page",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "maximum": 100,
              "description": "Items per page (max 100)",
              "example": 25
            },
            "required": false,
            "description": "Items per page (max 100)",
            "name": "per_page",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Search across: name, description",
              "example": "search term"
            },
            "required": false,
            "description": "Search across: name, description",
            "name": "search",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by id (exact match)."
            },
            "required": false,
            "description": "Filter by id (exact match).",
            "name": "filter[id]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by id (greater than or equal)"
            },
            "required": false,
            "description": "Filter by id (greater than or equal)",
            "name": "filter[id.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by id (less than or equal)"
            },
            "required": false,
            "description": "Filter by id (less than or equal)",
            "name": "filter[id.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by id (comma-separated list). Fetches many records in one request instead of one request per id.",
              "example": "101,102,103"
            },
            "required": false,
            "description": "Filter by id (comma-separated list). Fetches many records in one request instead of one request per id.",
            "name": "filter[id.in]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by id (excluding a comma-separated list)"
            },
            "required": false,
            "description": "Filter by id (excluding a comma-separated list)",
            "name": "filter[id.nin]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by name (exact match)."
            },
            "required": false,
            "description": "Filter by name (exact match).",
            "name": "filter[name]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by name (contains)"
            },
            "required": false,
            "description": "Filter by name (contains)",
            "name": "filter[name.contains]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by stripe_product_id (exact match)."
            },
            "required": false,
            "description": "Filter by stripe_product_id (exact match).",
            "name": "filter[stripe_product_id]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by stripe_product_id (contains)"
            },
            "required": false,
            "description": "Filter by stripe_product_id (contains)",
            "name": "filter[stripe_product_id.contains]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by is_taxable (exact match)."
            },
            "required": false,
            "description": "Filter by is_taxable (exact match).",
            "name": "filter[is_taxable]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by is_commissionable (exact match)."
            },
            "required": false,
            "description": "Filter by is_commissionable (exact match).",
            "name": "filter[is_commissionable]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by is_subscription (exact match)."
            },
            "required": false,
            "description": "Filter by is_subscription (exact match).",
            "name": "filter[is_subscription]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by use_options (exact match)."
            },
            "required": false,
            "description": "Filter by use_options (exact match).",
            "name": "filter[use_options]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by created_at (exact match)."
            },
            "required": false,
            "description": "Filter by created_at (exact match).",
            "name": "filter[created_at]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by created_at (greater than or equal)"
            },
            "required": false,
            "description": "Filter by created_at (greater than or equal)",
            "name": "filter[created_at.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by created_at (less than or equal)"
            },
            "required": false,
            "description": "Filter by created_at (less than or equal)",
            "name": "filter[created_at.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by updated_at (exact match)."
            },
            "required": false,
            "description": "Filter by updated_at (exact match).",
            "name": "filter[updated_at]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by updated_at (greater than or equal)"
            },
            "required": false,
            "description": "Filter by updated_at (greater than or equal)",
            "name": "filter[updated_at.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by updated_at (less than or equal)"
            },
            "required": false,
            "description": "Filter by updated_at (less than or equal)",
            "name": "filter[updated_at.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Sort field (prefix with - for descending)",
              "example": "-created_at"
            },
            "required": false,
            "description": "Sort field (prefix with - for descending)",
            "name": "sort",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response with paginated list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "nullable": true
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Current page number",
                          "example": 1
                        },
                        "limit": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Items per page",
                          "example": 25
                        },
                        "total": {
                          "type": "integer",
                          "description": "Total number of items",
                          "example": 150
                        },
                        "pages": {
                          "type": "integer",
                          "description": "Total number of pages",
                          "example": 6
                        }
                      },
                      "required": [
                        "page",
                        "limit",
                        "total",
                        "pages"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "pagination"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "products"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "products"
            ]
          }
        ],
        "summary": "Create a product",
        "description": "Create a new product with optional options and prices.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string"
                  },
                  "is_taxable": {
                    "type": "boolean"
                  },
                  "is_subscription": {
                    "type": "boolean"
                  },
                  "use_options": {
                    "type": "boolean"
                  },
                  "default_amount": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Default price amount in the smallest currency unit ($10.00 USD = 1000; ¥1500 JPY = 1500)."
                  },
                  "options": {
                    "type": "array",
                    "items": {
                      "nullable": true
                    }
                  }
                },
                "required": [
                  "name",
                  "description",
                  "is_taxable",
                  "is_subscription"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "integer"
                    },
                    "account_id": {
                      "type": "integer"
                    },
                    "is_active": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "stripe_product_id": {
                      "type": "string",
                      "nullable": true
                    },
                    "name": {
                      "type": "string",
                      "nullable": true,
                      "maxLength": 255
                    },
                    "is_taxable": {
                      "type": "boolean"
                    },
                    "is_commissionable": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "is_subscription": {
                      "type": "boolean"
                    },
                    "use_options": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "description": {
                      "type": "string",
                      "nullable": true
                    },
                    "created_at": {
                      "type": "string",
                      "nullable": true,
                      "format": "date-time"
                    },
                    "updated_at": {
                      "type": "string",
                      "nullable": true,
                      "format": "date-time"
                    },
                    "options": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "integer"
                          },
                          "product_id": {
                            "type": "integer"
                          },
                          "is_active": {
                            "type": "boolean",
                            "nullable": true
                          },
                          "name": {
                            "type": "string",
                            "nullable": true,
                            "maxLength": 255
                          },
                          "sort_order": {
                            "type": "integer",
                            "nullable": true
                          },
                          "is_uncategorized": {
                            "type": "boolean",
                            "nullable": true
                          },
                          "default_amount": {
                            "type": "integer",
                            "nullable": true
                          },
                          "created_at": {
                            "type": "string",
                            "nullable": true,
                            "format": "date-time"
                          },
                          "updated_at": {
                            "type": "string",
                            "nullable": true,
                            "format": "date-time"
                          },
                          "prices": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "integer"
                                },
                                "product_option_id": {
                                  "type": "integer",
                                  "nullable": true
                                },
                                "is_active": {
                                  "type": "boolean",
                                  "nullable": true
                                },
                                "stripe_plan_id": {
                                  "type": "string",
                                  "nullable": true
                                },
                                "name": {
                                  "type": "string",
                                  "nullable": true,
                                  "maxLength": 255
                                },
                                "amount": {
                                  "type": "integer"
                                },
                                "frequency": {
                                  "type": "string",
                                  "nullable": true,
                                  "enum": [
                                    "day",
                                    "week",
                                    "month",
                                    "year",
                                    null
                                  ]
                                },
                                "frequency_count": {
                                  "type": "integer"
                                },
                                "currency": {
                                  "type": "string",
                                  "nullable": true,
                                  "enum": [
                                    "aud",
                                    "cad",
                                    "usd",
                                    "gbp",
                                    "eur",
                                    "sgd",
                                    "aed",
                                    "afn",
                                    "all",
                                    "amd",
                                    "ang",
                                    "aoa",
                                    "ars",
                                    "awg",
                                    "azn",
                                    "bam",
                                    "bbd",
                                    "bdt",
                                    "bgn",
                                    "bif",
                                    "bmd",
                                    "bnd",
                                    "bob",
                                    "brl",
                                    "bsd",
                                    "bwp",
                                    "bzd",
                                    "cdf",
                                    "chf",
                                    "clp",
                                    "cny",
                                    "cop",
                                    "crc",
                                    "cve",
                                    "czk",
                                    "djf",
                                    "dkk",
                                    "dop",
                                    "dzd",
                                    "egp",
                                    "etb",
                                    "fjd",
                                    "fkp",
                                    "gel",
                                    "gip",
                                    "gmd",
                                    "gnf",
                                    "gtq",
                                    "gyd",
                                    "hkd",
                                    "hnl",
                                    "hrk",
                                    "htg",
                                    "huf",
                                    "idr",
                                    "ils",
                                    "inr",
                                    "isk",
                                    "jmd",
                                    "jpy",
                                    "kes",
                                    "kgs",
                                    "khr",
                                    "kmf",
                                    "krw",
                                    "kyd",
                                    "kzt",
                                    "lak",
                                    "lbp",
                                    "lkr",
                                    "lrd",
                                    "lsl",
                                    "mad",
                                    "mdl",
                                    "mga",
                                    "mkd",
                                    "mmk",
                                    "mnt",
                                    "mop",
                                    "mro",
                                    "mur",
                                    "mvr",
                                    "mwk",
                                    "mxn",
                                    "myr",
                                    "mzn",
                                    "nad",
                                    "ngn",
                                    "nio",
                                    "nok",
                                    "npr",
                                    "nzd",
                                    "pab",
                                    "pen",
                                    "pgk",
                                    "php",
                                    "pkr",
                                    "pln",
                                    "pyg",
                                    "qar",
                                    "ron",
                                    "rsd",
                                    "rub",
                                    "rwf",
                                    "sar",
                                    "sbd",
                                    "scr",
                                    "sek",
                                    "shp",
                                    "sll",
                                    "sos",
                                    "srd",
                                    "std",
                                    "szl",
                                    "thb",
                                    "tjs",
                                    "top",
                                    "try",
                                    "ttd",
                                    "twd",
                                    "tzs",
                                    "uah",
                                    "ugx",
                                    "uyu",
                                    "uzs",
                                    "vnd",
                                    "vuv",
                                    "wst",
                                    "xaf",
                                    "xcd",
                                    "xof",
                                    "xpf",
                                    "yer",
                                    "zar",
                                    "zmw",
                                    null
                                  ]
                                },
                                "is_metered": {
                                  "type": "boolean"
                                },
                                "keep_alive": {
                                  "type": "boolean",
                                  "nullable": true
                                },
                                "created_at": {
                                  "type": "string",
                                  "nullable": true,
                                  "format": "date-time"
                                },
                                "updated_at": {
                                  "type": "string",
                                  "nullable": true,
                                  "format": "date-time"
                                }
                              },
                              "required": [
                                "id"
                              ]
                            }
                          }
                        },
                        "required": [
                          "id",
                          "product_id"
                        ]
                      }
                    },
                    "currency": {
                      "type": "string",
                      "nullable": true,
                      "enum": [
                        "aud",
                        "cad",
                        "usd",
                        "gbp",
                        "eur",
                        "sgd",
                        "aed",
                        "afn",
                        "all",
                        "amd",
                        "ang",
                        "aoa",
                        "ars",
                        "awg",
                        "azn",
                        "bam",
                        "bbd",
                        "bdt",
                        "bgn",
                        "bif",
                        "bmd",
                        "bnd",
                        "bob",
                        "brl",
                        "bsd",
                        "bwp",
                        "bzd",
                        "cdf",
                        "chf",
                        "clp",
                        "cny",
                        "cop",
                        "crc",
                        "cve",
                        "czk",
                        "djf",
                        "dkk",
                        "dop",
                        "dzd",
                        "egp",
                        "etb",
                        "fjd",
                        "fkp",
                        "gel",
                        "gip",
                        "gmd",
                        "gnf",
                        "gtq",
                        "gyd",
                        "hkd",
                        "hnl",
                        "hrk",
                        "htg",
                        "huf",
                        "idr",
                        "ils",
                        "inr",
                        "isk",
                        "jmd",
                        "jpy",
                        "kes",
                        "kgs",
                        "khr",
                        "kmf",
                        "krw",
                        "kyd",
                        "kzt",
                        "lak",
                        "lbp",
                        "lkr",
                        "lrd",
                        "lsl",
                        "mad",
                        "mdl",
                        "mga",
                        "mkd",
                        "mmk",
                        "mnt",
                        "mop",
                        "mro",
                        "mur",
                        "mvr",
                        "mwk",
                        "mxn",
                        "myr",
                        "mzn",
                        "nad",
                        "ngn",
                        "nio",
                        "nok",
                        "npr",
                        "nzd",
                        "pab",
                        "pen",
                        "pgk",
                        "php",
                        "pkr",
                        "pln",
                        "pyg",
                        "qar",
                        "ron",
                        "rsd",
                        "rub",
                        "rwf",
                        "sar",
                        "sbd",
                        "scr",
                        "sek",
                        "shp",
                        "sll",
                        "sos",
                        "srd",
                        "std",
                        "szl",
                        "thb",
                        "tjs",
                        "top",
                        "try",
                        "ttd",
                        "twd",
                        "tzs",
                        "uah",
                        "ugx",
                        "uyu",
                        "uzs",
                        "vnd",
                        "vuv",
                        "wst",
                        "xaf",
                        "xcd",
                        "xof",
                        "xpf",
                        "yer",
                        "zar",
                        "zmw",
                        null
                      ]
                    },
                    "uncategorized_id": {
                      "type": "integer",
                      "nullable": true
                    },
                    "checkouts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": {
                          "nullable": true
                        }
                      }
                    },
                    "integration_mappings": {
                      "type": "array",
                      "nullable": true,
                      "items": {
                        "type": "object",
                        "additionalProperties": {
                          "nullable": true
                        }
                      }
                    }
                  },
                  "required": [
                    "id",
                    "account_id"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - The request conflicts with the current state of the resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error409"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/products/counts": {
      "get": {
        "tags": [
          "products"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "products"
            ]
          }
        ],
        "summary": "Get product counts",
        "description": "Get product counts grouped by type (subscription vs one-time).",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/products/{id}": {
      "get": {
        "tags": [
          "products"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "products"
            ]
          }
        ],
        "summary": "Get products",
        "description": "Retrieve a single products by ID",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "description": "products ID",
              "example": 12345
            },
            "required": true,
            "description": "products ID",
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Comma-separated list of expansions: checkouts, integration_mappings",
              "example": "checkouts,integration_mappings"
            },
            "required": false,
            "description": "Comma-separated list of expansions: checkouts, integration_mappings",
            "name": "include",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "integer"
                    },
                    "account_id": {
                      "type": "integer"
                    },
                    "is_active": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "stripe_product_id": {
                      "type": "string",
                      "nullable": true
                    },
                    "name": {
                      "type": "string",
                      "nullable": true,
                      "maxLength": 255
                    },
                    "is_taxable": {
                      "type": "boolean"
                    },
                    "is_commissionable": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "is_subscription": {
                      "type": "boolean"
                    },
                    "use_options": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "description": {
                      "type": "string",
                      "nullable": true
                    },
                    "created_at": {
                      "type": "string",
                      "nullable": true,
                      "format": "date-time"
                    },
                    "updated_at": {
                      "type": "string",
                      "nullable": true,
                      "format": "date-time"
                    },
                    "options": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "integer"
                          },
                          "product_id": {
                            "type": "integer"
                          },
                          "is_active": {
                            "type": "boolean",
                            "nullable": true
                          },
                          "name": {
                            "type": "string",
                            "nullable": true,
                            "maxLength": 255
                          },
                          "sort_order": {
                            "type": "integer",
                            "nullable": true
                          },
                          "is_uncategorized": {
                            "type": "boolean",
                            "nullable": true
                          },
                          "default_amount": {
                            "type": "integer",
                            "nullable": true
                          },
                          "created_at": {
                            "type": "string",
                            "nullable": true,
                            "format": "date-time"
                          },
                          "updated_at": {
                            "type": "string",
                            "nullable": true,
                            "format": "date-time"
                          },
                          "prices": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "integer"
                                },
                                "product_option_id": {
                                  "type": "integer",
                                  "nullable": true
                                },
                                "is_active": {
                                  "type": "boolean",
                                  "nullable": true
                                },
                                "stripe_plan_id": {
                                  "type": "string",
                                  "nullable": true
                                },
                                "name": {
                                  "type": "string",
                                  "nullable": true,
                                  "maxLength": 255
                                },
                                "amount": {
                                  "type": "integer"
                                },
                                "frequency": {
                                  "type": "string",
                                  "nullable": true,
                                  "enum": [
                                    "day",
                                    "week",
                                    "month",
                                    "year",
                                    null
                                  ]
                                },
                                "frequency_count": {
                                  "type": "integer"
                                },
                                "currency": {
                                  "type": "string",
                                  "nullable": true,
                                  "enum": [
                                    "aud",
                                    "cad",
                                    "usd",
                                    "gbp",
                                    "eur",
                                    "sgd",
                                    "aed",
                                    "afn",
                                    "all",
                                    "amd",
                                    "ang",
                                    "aoa",
                                    "ars",
                                    "awg",
                                    "azn",
                                    "bam",
                                    "bbd",
                                    "bdt",
                                    "bgn",
                                    "bif",
                                    "bmd",
                                    "bnd",
                                    "bob",
                                    "brl",
                                    "bsd",
                                    "bwp",
                                    "bzd",
                                    "cdf",
                                    "chf",
                                    "clp",
                                    "cny",
                                    "cop",
                                    "crc",
                                    "cve",
                                    "czk",
                                    "djf",
                                    "dkk",
                                    "dop",
                                    "dzd",
                                    "egp",
                                    "etb",
                                    "fjd",
                                    "fkp",
                                    "gel",
                                    "gip",
                                    "gmd",
                                    "gnf",
                                    "gtq",
                                    "gyd",
                                    "hkd",
                                    "hnl",
                                    "hrk",
                                    "htg",
                                    "huf",
                                    "idr",
                                    "ils",
                                    "inr",
                                    "isk",
                                    "jmd",
                                    "jpy",
                                    "kes",
                                    "kgs",
                                    "khr",
                                    "kmf",
                                    "krw",
                                    "kyd",
                                    "kzt",
                                    "lak",
                                    "lbp",
                                    "lkr",
                                    "lrd",
                                    "lsl",
                                    "mad",
                                    "mdl",
                                    "mga",
                                    "mkd",
                                    "mmk",
                                    "mnt",
                                    "mop",
                                    "mro",
                                    "mur",
                                    "mvr",
                                    "mwk",
                                    "mxn",
                                    "myr",
                                    "mzn",
                                    "nad",
                                    "ngn",
                                    "nio",
                                    "nok",
                                    "npr",
                                    "nzd",
                                    "pab",
                                    "pen",
                                    "pgk",
                                    "php",
                                    "pkr",
                                    "pln",
                                    "pyg",
                                    "qar",
                                    "ron",
                                    "rsd",
                                    "rub",
                                    "rwf",
                                    "sar",
                                    "sbd",
                                    "scr",
                                    "sek",
                                    "shp",
                                    "sll",
                                    "sos",
                                    "srd",
                                    "std",
                                    "szl",
                                    "thb",
                                    "tjs",
                                    "top",
                                    "try",
                                    "ttd",
                                    "twd",
                                    "tzs",
                                    "uah",
                                    "ugx",
                                    "uyu",
                                    "uzs",
                                    "vnd",
                                    "vuv",
                                    "wst",
                                    "xaf",
                                    "xcd",
                                    "xof",
                                    "xpf",
                                    "yer",
                                    "zar",
                                    "zmw",
                                    null
                                  ]
                                },
                                "is_metered": {
                                  "type": "boolean"
                                },
                                "keep_alive": {
                                  "type": "boolean",
                                  "nullable": true
                                },
                                "created_at": {
                                  "type": "string",
                                  "nullable": true,
                                  "format": "date-time"
                                },
                                "updated_at": {
                                  "type": "string",
                                  "nullable": true,
                                  "format": "date-time"
                                }
                              },
                              "required": [
                                "id"
                              ]
                            }
                          }
                        },
                        "required": [
                          "id",
                          "product_id"
                        ]
                      }
                    },
                    "currency": {
                      "type": "string",
                      "nullable": true,
                      "enum": [
                        "aud",
                        "cad",
                        "usd",
                        "gbp",
                        "eur",
                        "sgd",
                        "aed",
                        "afn",
                        "all",
                        "amd",
                        "ang",
                        "aoa",
                        "ars",
                        "awg",
                        "azn",
                        "bam",
                        "bbd",
                        "bdt",
                        "bgn",
                        "bif",
                        "bmd",
                        "bnd",
                        "bob",
                        "brl",
                        "bsd",
                        "bwp",
                        "bzd",
                        "cdf",
                        "chf",
                        "clp",
                        "cny",
                        "cop",
                        "crc",
                        "cve",
                        "czk",
                        "djf",
                        "dkk",
                        "dop",
                        "dzd",
                        "egp",
                        "etb",
                        "fjd",
                        "fkp",
                        "gel",
                        "gip",
                        "gmd",
                        "gnf",
                        "gtq",
                        "gyd",
                        "hkd",
                        "hnl",
                        "hrk",
                        "htg",
                        "huf",
                        "idr",
                        "ils",
                        "inr",
                        "isk",
                        "jmd",
                        "jpy",
                        "kes",
                        "kgs",
                        "khr",
                        "kmf",
                        "krw",
                        "kyd",
                        "kzt",
                        "lak",
                        "lbp",
                        "lkr",
                        "lrd",
                        "lsl",
                        "mad",
                        "mdl",
                        "mga",
                        "mkd",
                        "mmk",
                        "mnt",
                        "mop",
                        "mro",
                        "mur",
                        "mvr",
                        "mwk",
                        "mxn",
                        "myr",
                        "mzn",
                        "nad",
                        "ngn",
                        "nio",
                        "nok",
                        "npr",
                        "nzd",
                        "pab",
                        "pen",
                        "pgk",
                        "php",
                        "pkr",
                        "pln",
                        "pyg",
                        "qar",
                        "ron",
                        "rsd",
                        "rub",
                        "rwf",
                        "sar",
                        "sbd",
                        "scr",
                        "sek",
                        "shp",
                        "sll",
                        "sos",
                        "srd",
                        "std",
                        "szl",
                        "thb",
                        "tjs",
                        "top",
                        "try",
                        "ttd",
                        "twd",
                        "tzs",
                        "uah",
                        "ugx",
                        "uyu",
                        "uzs",
                        "vnd",
                        "vuv",
                        "wst",
                        "xaf",
                        "xcd",
                        "xof",
                        "xpf",
                        "yer",
                        "zar",
                        "zmw",
                        null
                      ]
                    },
                    "uncategorized_id": {
                      "type": "integer",
                      "nullable": true
                    },
                    "checkouts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": {
                          "nullable": true
                        }
                      }
                    },
                    "integration_mappings": {
                      "type": "array",
                      "nullable": true,
                      "items": {
                        "type": "object",
                        "additionalProperties": {
                          "nullable": true
                        }
                      }
                    }
                  },
                  "required": [
                    "id",
                    "account_id"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "products"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "products"
            ]
          }
        ],
        "summary": "Update a product",
        "description": "Update product settings.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Product ID"
            },
            "required": true,
            "description": "Product ID",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string"
                  },
                  "is_taxable": {
                    "type": "boolean"
                  },
                  "use_options": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "name",
                  "is_taxable"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - The request conflicts with the current state of the resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error409"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "products"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "products"
            ]
          }
        ],
        "summary": "Delete a product",
        "description": "Soft delete a product and all its options and prices.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Product ID"
            },
            "required": true,
            "description": "Product ID",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted successfully"
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/products/{id}/actions": {
      "get": {
        "tags": [
          "products"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "products"
            ]
          }
        ],
        "summary": "Get product automation actions",
        "description": "Get automation event actions for a product and its options.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Product ID"
            },
            "required": true,
            "description": "Product ID",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "product_event_actions"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "account"
            ]
          }
        ],
        "summary": "Update product automation actions",
        "description": "Save automation event actions for a product.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Product ID"
            },
            "required": true,
            "description": "Product ID",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "event_actions": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": {
                          "nullable": true
                        }
                      }
                    },
                    "description": "Map of event name to an array of action config objects, e.g. { \"subscription:started\": [ { ...action } ] }. Keys must be valid event names for the entity — call the corresponding GET (list_product_actions / list_product_option_actions) to discover the full set; an unknown event name returns 400. Partial maps are accepted (only the events you include are touched)."
                  }
                },
                "required": [
                  "event_actions"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/products/{id}/options": {
      "post": {
        "tags": [
          "product_options"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "account"
            ]
          }
        ],
        "summary": "Create a product option",
        "description": "Create a new option on a product.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Product ID"
            },
            "required": true,
            "description": "Product ID",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "default_amount": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Default price amount for this option in the smallest currency unit ($10.00 USD = 1000; ¥1500 JPY = 1500)."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - The request conflicts with the current state of the resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error409"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "products"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "products"
            ]
          }
        ],
        "summary": "Sort product options",
        "description": "Reorder product options by providing an ordered array of option IDs.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Product ID"
            },
            "required": true,
            "description": "Product ID",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "options": {
                    "type": "array",
                    "items": {
                      "type": "number"
                    },
                    "description": "Ordered array of option IDs"
                  }
                },
                "required": [
                  "options"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/products/{id}/options/{option_id}": {
      "put": {
        "tags": [
          "product_options"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "account"
            ]
          }
        ],
        "summary": "Update a product option",
        "description": "Update an option on a product.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Product ID"
            },
            "required": true,
            "description": "Product ID",
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Option ID"
            },
            "required": true,
            "description": "Option ID",
            "name": "option_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "default_amount": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Default price amount for this option in the smallest currency unit ($10.00 USD = 1000; ¥1500 JPY = 1500)."
                  },
                  "integration_mappings": {
                    "nullable": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - The request conflicts with the current state of the resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error409"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "products"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "products"
            ]
          }
        ],
        "summary": "Delete a product option",
        "description": "Soft delete an option and its prices.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Product ID"
            },
            "required": true,
            "description": "Product ID",
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Option ID"
            },
            "required": true,
            "description": "Option ID",
            "name": "option_id",
            "in": "path"
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted successfully"
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/products/{id}/options/{option_id}/actions": {
      "get": {
        "tags": [
          "product_option_event_actions"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "account"
            ]
          }
        ],
        "summary": "Get option automation actions",
        "description": "Get automation event actions for a product option.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Product ID"
            },
            "required": true,
            "description": "Product ID",
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Option ID"
            },
            "required": true,
            "description": "Option ID",
            "name": "option_id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "product_option_event_actions"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "account"
            ]
          }
        ],
        "summary": "Update option automation actions",
        "description": "Save automation event actions for a product option.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Product ID"
            },
            "required": true,
            "description": "Product ID",
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Option ID"
            },
            "required": true,
            "description": "Option ID",
            "name": "option_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "event_actions": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": {
                          "nullable": true
                        }
                      }
                    },
                    "description": "Map of event name to an array of action config objects, e.g. { \"subscription:started\": [ { ...action } ] }. Keys must be valid event names for the entity — call the corresponding GET (list_product_actions / list_product_option_actions) to discover the full set; an unknown event name returns 400. Partial maps are accepted (only the events you include are touched)."
                  }
                },
                "required": [
                  "event_actions"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/products/{id}/prices": {
      "post": {
        "tags": [
          "product_option_prices"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "account"
            ]
          }
        ],
        "summary": "Create a price (optionless)",
        "description": "Create a price on the uncategorized option (for subscriptions or products without options).",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Product ID"
            },
            "required": true,
            "description": "Product ID",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "amount": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Price amount in the smallest currency unit ($10.00 USD = 1000; ¥1500 JPY = 1500). Must be a non-negative integer; 0 is allowed for free products."
                  },
                  "frequency": {
                    "type": "string",
                    "enum": [
                      "day",
                      "week",
                      "month",
                      "year"
                    ],
                    "description": "Billing unit for a recurring price. Omit entirely for a one-time price. For \"every 2 weeks\" pass frequency: \"week\" with frequency_count: 2."
                  },
                  "frequency_count": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "Number of frequency units per billing cycle (e.g. frequency: \"month\", frequency_count: 3 = quarterly). Defaults to 1."
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "amount"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - The request conflicts with the current state of the resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error409"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/products/{id}/options/{option_id}/prices": {
      "post": {
        "tags": [
          "product_option_prices"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "account"
            ]
          }
        ],
        "summary": "Create a price on an option",
        "description": "Create a new price on a product option. Omit frequency for a one-time (non-recurring) price; pass a frequency string (e.g. \"month\", \"year\") for a recurring price.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Product ID"
            },
            "required": true,
            "description": "Product ID",
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Option ID"
            },
            "required": true,
            "description": "Option ID",
            "name": "option_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "amount": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Price amount in the smallest currency unit ($10.00 USD = 1000; ¥1500 JPY = 1500). Must be a non-negative integer; 0 is allowed for free products."
                  },
                  "frequency": {
                    "type": "string",
                    "enum": [
                      "day",
                      "week",
                      "month",
                      "year"
                    ],
                    "description": "Billing unit for a recurring price. Omit entirely for a one-time price. For \"every 2 weeks\" pass frequency: \"week\" with frequency_count: 2."
                  },
                  "frequency_count": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "Number of frequency units per billing cycle (e.g. frequency: \"month\", frequency_count: 3 = quarterly). Defaults to 1."
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "amount"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - The request conflicts with the current state of the resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error409"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/products/{id}/options/{option_id}/prices/{price_id}": {
      "post": {
        "tags": [
          "products"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "products"
            ]
          }
        ],
        "summary": "Move a price to another option",
        "description": "Move a price from one product option to another.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Product ID"
            },
            "required": true,
            "description": "Product ID",
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Option ID"
            },
            "required": true,
            "description": "Option ID",
            "name": "option_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Price ID"
            },
            "required": true,
            "description": "Price ID",
            "name": "price_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "product_option_id": {
                    "type": "number",
                    "description": "Target option ID to move the price to"
                  }
                },
                "required": [
                  "product_option_id"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "product_option_prices"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "account"
            ]
          }
        ],
        "summary": "Update a price",
        "description": "Rename a price on a product option. Price amount and frequency are immutable — to change either, create a new price (POST /v2/products/:id/options/:option_id/prices) and optionally delete the old one. Mutable fields: name only.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Product ID"
            },
            "required": true,
            "description": "Product ID",
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Option ID"
            },
            "required": true,
            "description": "Option ID",
            "name": "option_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Price ID"
            },
            "required": true,
            "description": "Price ID",
            "name": "price_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "integration_mappings": {
                    "nullable": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - The request conflicts with the current state of the resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error409"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "products"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "products"
            ]
          }
        ],
        "summary": "Delete a price",
        "description": "Soft delete a price from a product option.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Product ID"
            },
            "required": true,
            "description": "Product ID",
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Option ID"
            },
            "required": true,
            "description": "Option ID",
            "name": "option_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Price ID"
            },
            "required": true,
            "description": "Price ID",
            "name": "price_id",
            "in": "path"
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted successfully"
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/payments": {
      "get": {
        "tags": [
          "payments"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "payments"
            ]
          }
        ],
        "summary": "List payments",
        "description": "Retrieve a paginated list of payments",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "description": "Page number",
              "example": 1
            },
            "required": false,
            "description": "Page number",
            "name": "page",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "maximum": 100,
              "description": "Items per page (max 100)",
              "example": 25
            },
            "required": false,
            "description": "Items per page (max 100)",
            "name": "per_page",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Comma-separated list of expansions: customer, order",
              "example": "customer,order"
            },
            "required": false,
            "description": "Comma-separated list of expansions: customer, order",
            "name": "include",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by status (exact match). Valid values: pending, succeeded, failed, refunded, disputed, dispute_refunded."
            },
            "required": false,
            "description": "Filter by status (exact match). Valid values: pending, succeeded, failed, refunded, disputed, dispute_refunded.",
            "name": "filter[status]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by status (comma-separated list). Fetches many records in one request instead of one request per id.",
              "example": "pending,succeeded"
            },
            "required": false,
            "description": "Filter by status (comma-separated list). Fetches many records in one request instead of one request per id.",
            "name": "filter[status.in]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by status (excluding a comma-separated list)"
            },
            "required": false,
            "description": "Filter by status (excluding a comma-separated list)",
            "name": "filter[status.nin]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by order_id (exact match)."
            },
            "required": false,
            "description": "Filter by order_id (exact match).",
            "name": "filter[order_id]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by order_id (greater than or equal)"
            },
            "required": false,
            "description": "Filter by order_id (greater than or equal)",
            "name": "filter[order_id.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by order_id (less than or equal)"
            },
            "required": false,
            "description": "Filter by order_id (less than or equal)",
            "name": "filter[order_id.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by order_id (comma-separated list). Fetches many records in one request instead of one request per id.",
              "example": "101,102,103"
            },
            "required": false,
            "description": "Filter by order_id (comma-separated list). Fetches many records in one request instead of one request per id.",
            "name": "filter[order_id.in]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by order_id (excluding a comma-separated list)"
            },
            "required": false,
            "description": "Filter by order_id (excluding a comma-separated list)",
            "name": "filter[order_id.nin]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by customer_id (exact match)."
            },
            "required": false,
            "description": "Filter by customer_id (exact match).",
            "name": "filter[customer_id]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by customer_id (greater than or equal)"
            },
            "required": false,
            "description": "Filter by customer_id (greater than or equal)",
            "name": "filter[customer_id.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by customer_id (less than or equal)"
            },
            "required": false,
            "description": "Filter by customer_id (less than or equal)",
            "name": "filter[customer_id.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by customer_id (comma-separated list). Fetches many records in one request instead of one request per id.",
              "example": "101,102,103"
            },
            "required": false,
            "description": "Filter by customer_id (comma-separated list). Fetches many records in one request instead of one request per id.",
            "name": "filter[customer_id.in]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by customer_id (excluding a comma-separated list)"
            },
            "required": false,
            "description": "Filter by customer_id (excluding a comma-separated list)",
            "name": "filter[customer_id.nin]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by gateway_id (exact match)."
            },
            "required": false,
            "description": "Filter by gateway_id (exact match).",
            "name": "filter[gateway_id]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by gateway_id (greater than or equal)"
            },
            "required": false,
            "description": "Filter by gateway_id (greater than or equal)",
            "name": "filter[gateway_id.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by gateway_id (less than or equal)"
            },
            "required": false,
            "description": "Filter by gateway_id (less than or equal)",
            "name": "filter[gateway_id.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by gateway_id (comma-separated list). Fetches many records in one request instead of one request per id.",
              "example": "101,102,103"
            },
            "required": false,
            "description": "Filter by gateway_id (comma-separated list). Fetches many records in one request instead of one request per id.",
            "name": "filter[gateway_id.in]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by gateway_id (excluding a comma-separated list)"
            },
            "required": false,
            "description": "Filter by gateway_id (excluding a comma-separated list)",
            "name": "filter[gateway_id.nin]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by currency (exact match)."
            },
            "required": false,
            "description": "Filter by currency (exact match).",
            "name": "filter[currency]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by currency (contains)"
            },
            "required": false,
            "description": "Filter by currency (contains)",
            "name": "filter[currency.contains]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by created_at (exact match)."
            },
            "required": false,
            "description": "Filter by created_at (exact match).",
            "name": "filter[created_at]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by created_at (greater than or equal)"
            },
            "required": false,
            "description": "Filter by created_at (greater than or equal)",
            "name": "filter[created_at.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by created_at (less than or equal)"
            },
            "required": false,
            "description": "Filter by created_at (less than or equal)",
            "name": "filter[created_at.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by updated_at (exact match)."
            },
            "required": false,
            "description": "Filter by updated_at (exact match).",
            "name": "filter[updated_at]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by updated_at (greater than or equal)"
            },
            "required": false,
            "description": "Filter by updated_at (greater than or equal)",
            "name": "filter[updated_at.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by updated_at (less than or equal)"
            },
            "required": false,
            "description": "Filter by updated_at (less than or equal)",
            "name": "filter[updated_at.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Sort field (prefix with - for descending)",
              "example": "-created_at"
            },
            "required": false,
            "description": "Sort field (prefix with - for descending)",
            "name": "sort",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response with paginated list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/OrderPayment"
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Current page number",
                          "example": 1
                        },
                        "limit": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Items per page",
                          "example": 25
                        },
                        "total": {
                          "type": "integer",
                          "description": "Total number of items",
                          "example": 150
                        },
                        "pages": {
                          "type": "integer",
                          "description": "Total number of pages",
                          "example": 6
                        }
                      },
                      "required": [
                        "page",
                        "limit",
                        "total",
                        "pages"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "pagination"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/payments/{id}": {
      "get": {
        "tags": [
          "payments"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "payments"
            ]
          }
        ],
        "summary": "Get payments",
        "description": "Retrieve a single payments by ID",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "description": "payments ID",
              "example": 12345
            },
            "required": true,
            "description": "payments ID",
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Comma-separated list of expansions: customer, order",
              "example": "customer,order"
            },
            "required": false,
            "description": "Comma-separated list of expansions: customer, order",
            "name": "include",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderPayment"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/payments/{id}/refund": {
      "post": {
        "tags": [
          "payments"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "payments"
            ]
          }
        ],
        "summary": "Refund a payment",
        "description": "Refund a payment on an order. `refund_amount` is required — pass the payment's full remaining refundable balance for a full refund.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Payment ID"
            },
            "required": true,
            "description": "Payment ID",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "refund_amount": {
                    "type": "integer",
                    "minimum": 0,
                    "exclusiveMinimum": true,
                    "description": "Amount to refund as a whole number of the smallest currency unit ($10.00 USD = 1000; ¥1500 JPY = 1500). Fractions are rejected. Must not exceed the payment's remaining refundable balance."
                  },
                  "items": {
                    "type": "array",
                    "items": {
                      "type": "number"
                    },
                    "description": "Array of order item IDs to mark as refunded"
                  },
                  "do_affiliate_adjustment": {
                    "type": "boolean",
                    "description": "Whether to adjust affiliate commissions"
                  },
                  "skip_integration_actions": {
                    "type": "boolean",
                    "description": "Skip the merchant's own automations for this refund. The refund is still recorded and order-sync integrations (tax, CRM deal and contact sync) still run. Developer-platform Event Webhooks are still delivered; the merchant's own \"Send Webhook\" automation action is an automation and does NOT run. The choice is stored on the payment, so a later refund of the same payment made outside Spiffy inherits it — the last choice made through Spiffy wins."
                  },
                  "notes": {
                    "type": "string",
                    "description": "Internal notes for the refund"
                  }
                },
                "required": [
                  "refund_amount"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/payments/{id}/retry": {
      "post": {
        "tags": [
          "payments"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "payments"
            ]
          }
        ],
        "summary": "Retry a failed payment",
        "description": "Queue a retry for a failed payment. Only the original failed payment (not subsequent attempts) can be retried.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Payment ID"
            },
            "required": true,
            "description": "Payment ID",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/paymentplans": {
      "get": {
        "tags": [
          "paymentplans"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "paymentplans"
            ]
          }
        ],
        "summary": "List paymentplans",
        "description": "Retrieve a paginated list of paymentplans",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "description": "Page number",
              "example": 1
            },
            "required": false,
            "description": "Page number",
            "name": "page",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "maximum": 100,
              "description": "Items per page (max 100)",
              "example": 25
            },
            "required": false,
            "description": "Items per page (max 100)",
            "name": "per_page",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Comma-separated list of expansions: items, payments, order, customer, custom_fields, card, gateway",
              "example": "items,payments"
            },
            "required": false,
            "description": "Comma-separated list of expansions: items, payments, order, customer, custom_fields, card, gateway",
            "name": "include",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by id (exact match)."
            },
            "required": false,
            "description": "Filter by id (exact match).",
            "name": "filter[id]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by id (greater than or equal)"
            },
            "required": false,
            "description": "Filter by id (greater than or equal)",
            "name": "filter[id.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by id (less than or equal)"
            },
            "required": false,
            "description": "Filter by id (less than or equal)",
            "name": "filter[id.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by id (comma-separated list). Fetches many records in one request instead of one request per id.",
              "example": "101,102,103"
            },
            "required": false,
            "description": "Filter by id (comma-separated list). Fetches many records in one request instead of one request per id.",
            "name": "filter[id.in]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by id (excluding a comma-separated list)"
            },
            "required": false,
            "description": "Filter by id (excluding a comma-separated list)",
            "name": "filter[id.nin]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by status (exact match). Valid values: active, past_due, unpaid, completed, defaulted."
            },
            "required": false,
            "description": "Filter by status (exact match). Valid values: active, past_due, unpaid, completed, defaulted.",
            "name": "filter[status]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by status (comma-separated list). Fetches many records in one request instead of one request per id.",
              "example": "active,past_due"
            },
            "required": false,
            "description": "Filter by status (comma-separated list). Fetches many records in one request instead of one request per id.",
            "name": "filter[status.in]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by status (excluding a comma-separated list)"
            },
            "required": false,
            "description": "Filter by status (excluding a comma-separated list)",
            "name": "filter[status.nin]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by order_id (exact match)."
            },
            "required": false,
            "description": "Filter by order_id (exact match).",
            "name": "filter[order_id]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by order_id (greater than or equal)"
            },
            "required": false,
            "description": "Filter by order_id (greater than or equal)",
            "name": "filter[order_id.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by order_id (less than or equal)"
            },
            "required": false,
            "description": "Filter by order_id (less than or equal)",
            "name": "filter[order_id.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by order_id (comma-separated list). Fetches many records in one request instead of one request per id.",
              "example": "101,102,103"
            },
            "required": false,
            "description": "Filter by order_id (comma-separated list). Fetches many records in one request instead of one request per id.",
            "name": "filter[order_id.in]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by order_id (excluding a comma-separated list)"
            },
            "required": false,
            "description": "Filter by order_id (excluding a comma-separated list)",
            "name": "filter[order_id.nin]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by customer_id (exact match)."
            },
            "required": false,
            "description": "Filter by customer_id (exact match).",
            "name": "filter[customer_id]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by customer_id (greater than or equal)"
            },
            "required": false,
            "description": "Filter by customer_id (greater than or equal)",
            "name": "filter[customer_id.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by customer_id (less than or equal)"
            },
            "required": false,
            "description": "Filter by customer_id (less than or equal)",
            "name": "filter[customer_id.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by customer_id (comma-separated list). Fetches many records in one request instead of one request per id.",
              "example": "101,102,103"
            },
            "required": false,
            "description": "Filter by customer_id (comma-separated list). Fetches many records in one request instead of one request per id.",
            "name": "filter[customer_id.in]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by customer_id (excluding a comma-separated list)"
            },
            "required": false,
            "description": "Filter by customer_id (excluding a comma-separated list)",
            "name": "filter[customer_id.nin]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by email (exact match)."
            },
            "required": false,
            "description": "Filter by email (exact match).",
            "name": "filter[email]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by email (contains)"
            },
            "required": false,
            "description": "Filter by email (contains)",
            "name": "filter[email.contains]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by created_at (exact match)."
            },
            "required": false,
            "description": "Filter by created_at (exact match).",
            "name": "filter[created_at]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by created_at (greater than or equal)"
            },
            "required": false,
            "description": "Filter by created_at (greater than or equal)",
            "name": "filter[created_at.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by created_at (less than or equal)"
            },
            "required": false,
            "description": "Filter by created_at (less than or equal)",
            "name": "filter[created_at.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by updated_at (exact match)."
            },
            "required": false,
            "description": "Filter by updated_at (exact match).",
            "name": "filter[updated_at]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by updated_at (greater than or equal)"
            },
            "required": false,
            "description": "Filter by updated_at (greater than or equal)",
            "name": "filter[updated_at.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by updated_at (less than or equal)"
            },
            "required": false,
            "description": "Filter by updated_at (less than or equal)",
            "name": "filter[updated_at.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by next_payment_at (exact match)."
            },
            "required": false,
            "description": "Filter by next_payment_at (exact match).",
            "name": "filter[next_payment_at]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by next_payment_at (greater than or equal)"
            },
            "required": false,
            "description": "Filter by next_payment_at (greater than or equal)",
            "name": "filter[next_payment_at.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by next_payment_at (less than or equal)"
            },
            "required": false,
            "description": "Filter by next_payment_at (less than or equal)",
            "name": "filter[next_payment_at.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Sort field (prefix with - for descending)",
              "example": "-created_at"
            },
            "required": false,
            "description": "Sort field (prefix with - for descending)",
            "name": "sort",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response with paginated list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Paymentplan"
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Current page number",
                          "example": 1
                        },
                        "limit": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Items per page",
                          "example": 25
                        },
                        "total": {
                          "type": "integer",
                          "description": "Total number of items",
                          "example": 150
                        },
                        "pages": {
                          "type": "integer",
                          "description": "Total number of pages",
                          "example": 6
                        }
                      },
                      "required": [
                        "page",
                        "limit",
                        "total",
                        "pages"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "pagination"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/paymentplans/{id}": {
      "get": {
        "tags": [
          "paymentplans"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "paymentplans"
            ]
          }
        ],
        "summary": "Get paymentplans",
        "description": "Retrieve a single paymentplans by ID",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "description": "paymentplans ID",
              "example": 12345
            },
            "required": true,
            "description": "paymentplans ID",
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Comma-separated list of expansions: items, payments, order, customer, custom_fields, card, gateway",
              "example": "items,payments"
            },
            "required": false,
            "description": "Comma-separated list of expansions: items, payments, order, customer, custom_fields, card, gateway",
            "name": "include",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Paymentplan"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/paymentplans/{id}/cancel": {
      "put": {
        "tags": [
          "paymentplans"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "paymentplans"
            ]
          }
        ],
        "summary": "Cancel a payment plan",
        "description": "Cancel a payment plan by setting its status to unpaid.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Payment plan ID"
            },
            "required": true,
            "description": "Payment plan ID",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "notes": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/paymentplans/{id}/notes": {
      "post": {
        "tags": [
          "paymentplans"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "paymentplans"
            ]
          }
        ],
        "summary": "Add notes to payment plan",
        "description": "Add a note to a payment plan. Notes are stored as user events.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Payment plan ID"
            },
            "required": true,
            "description": "Payment plan ID",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "notes": {
                    "type": "string"
                  }
                },
                "required": [
                  "notes"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/paymentplans/{id}/card": {
      "post": {
        "tags": [
          "paymentplans"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "paymentplans"
            ]
          }
        ],
        "summary": "Add new card to payment plan",
        "description": "Create a new payment card and assign it to the payment plan.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Payment plan ID"
            },
            "required": true,
            "description": "Payment plan ID",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "token": {
                    "nullable": true,
                    "description": "Payment token from the gateway (e.g. Stripe payment method)"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "paymentplans"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "paymentplans"
            ]
          }
        ],
        "summary": "Update payment plan card",
        "description": "Update a payment plan to use an existing card on file.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Payment Plan ID"
            },
            "required": true,
            "description": "Payment Plan ID",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "card_id": {
                    "type": "number",
                    "description": "ID of the existing card to use"
                  }
                },
                "required": [
                  "card_id"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/paymentplans/{id}/nextbillingdate": {
      "put": {
        "tags": [
          "paymentplans"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "paymentplans"
            ]
          }
        ],
        "summary": "Update next billing date",
        "description": "Update the next billing date for a payment plan. Date must be in the future.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Payment plan ID"
            },
            "required": true,
            "description": "Payment plan ID",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "next_payment_at": {
                    "type": "string",
                    "description": "Next billing date (ISO 8601)"
                  },
                  "notes": {
                    "type": "string"
                  }
                },
                "required": [
                  "next_payment_at"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/paymentplans/{id}/terms": {
      "put": {
        "tags": [
          "paymentplans"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "paymentplans"
            ]
          }
        ],
        "summary": "Update payment plan terms",
        "description": "Update the payment amount, remaining balance, and/or frequency of a payment plan.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Payment plan ID"
            },
            "required": true,
            "description": "Payment plan ID",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "payment_amount": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "New payment amount per cycle in the smallest currency unit ($10.00 USD = 1000; ¥1500 JPY = 1500). Must be a non-negative integer."
                  },
                  "remaining_balance": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "New remaining balance in the smallest currency unit ($10.00 USD = 1000; ¥1500 JPY = 1500). Must be a non-negative integer."
                  },
                  "frequency": {
                    "type": "string",
                    "enum": [
                      "day",
                      "week",
                      "month",
                      "year"
                    ],
                    "description": "Billing unit. For \"every 2 weeks\" pass frequency: \"week\" with frequency_count: 2."
                  },
                  "frequency_count": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "Number of frequency units per billing cycle. Defaults to 1."
                  },
                  "notes": {
                    "type": "string"
                  }
                },
                "required": [
                  "payment_amount",
                  "remaining_balance"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/paymentplans/{id}/pay": {
      "post": {
        "tags": [
          "paymentplans"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "paymentplans"
            ]
          }
        ],
        "summary": "Make a payment on payment plan",
        "description": "Process a manual payment on a payment plan. Can be a partial payment or a full payoff.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Payment plan ID"
            },
            "required": true,
            "description": "Payment plan ID",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "amount": {
                    "type": "number",
                    "description": "Payment amount in the smallest currency unit ($10.00 USD = 1000; ¥1500 JPY = 1500)."
                  },
                  "payoff_outcome": {
                    "type": "string",
                    "nullable": true,
                    "enum": [
                      "completed",
                      "defaulted",
                      null
                    ],
                    "description": "If set, treats this request as a payoff: 'completed' marks the plan paid in full, 'defaulted' marks it as a write-off. When null/omitted, this is a regular partial payment."
                  },
                  "notes": {
                    "type": "string"
                  }
                },
                "required": [
                  "amount"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/promos": {
      "get": {
        "tags": [
          "promos"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "promos"
            ]
          }
        ],
        "summary": "List promos",
        "description": "List all active promo codes for the account. Returns all active promos (no pagination).",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "integer"
                          },
                          "code": {
                            "type": "string"
                          },
                          "discount_type": {
                            "type": "string",
                            "description": "flat or percent"
                          },
                          "discount_amount": {
                            "type": "number"
                          },
                          "duration": {
                            "type": "string",
                            "nullable": true,
                            "description": "once, repeating, or forever"
                          },
                          "duration_count": {
                            "type": "number",
                            "nullable": true
                          },
                          "order_limit": {
                            "type": "number",
                            "nullable": true
                          },
                          "expire_at": {
                            "type": "string",
                            "nullable": true
                          },
                          "ordered_count": {
                            "type": "integer"
                          },
                          "is_expired": {
                            "type": "boolean"
                          },
                          "created_at": {
                            "type": "string"
                          },
                          "updated_at": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "code",
                          "discount_type",
                          "discount_amount",
                          "duration",
                          "duration_count",
                          "order_limit",
                          "expire_at",
                          "ordered_count",
                          "is_expired",
                          "created_at",
                          "updated_at"
                        ]
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "promos"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "promos"
            ]
          }
        ],
        "summary": "Create a promo",
        "description": "Create a new promo/discount code. Fields you omit take their default (no discount, no expiry, no limits).",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "description": "Promo code. Letters and numbers only — no spaces or punctuation. Trimmed and uppercased before saving."
                  },
                  "onetime_discount_type": {
                    "type": "string",
                    "nullable": true,
                    "enum": [
                      "amount",
                      "percent",
                      null
                    ],
                    "description": "Discount type for one-time items."
                  },
                  "onetime_discount_offset": {
                    "type": "number",
                    "nullable": true,
                    "description": "Discount value for one-time items. Cannot be negative. When type is \"percent\", a percent value from 0 to 100 (20 = 20%). When type is \"amount\", a monetary value in the smallest currency unit ($5.00 USD = 500; ¥500 JPY = 500)."
                  },
                  "subscription_discount_type": {
                    "type": "string",
                    "nullable": true,
                    "enum": [
                      "amount",
                      "percent",
                      null
                    ],
                    "description": "Discount type for subscriptions."
                  },
                  "subscription_discount_offset": {
                    "type": "number",
                    "nullable": true,
                    "description": "Discount value for subscriptions. Cannot be negative. When type is \"percent\", a percent value from 0 to 100 (20 = 20%). When type is \"amount\", a monetary value in the smallest currency unit ($5.00 USD = 500; ¥500 JPY = 500)."
                  },
                  "subscription_duration_in_months": {
                    "type": "number",
                    "nullable": true,
                    "description": "Duration of subscription discount in months (0 = forever). null is treated as 0."
                  },
                  "expire_at": {
                    "type": "string",
                    "nullable": true,
                    "description": "Expiration date"
                  },
                  "order_limit": {
                    "type": "number",
                    "nullable": true,
                    "description": "Maximum number of orders (0 = unlimited). null is treated as 0."
                  },
                  "per_customer_limit": {
                    "type": "number",
                    "nullable": true,
                    "description": "Maximum uses per customer (0 = unlimited). null is treated as 0."
                  }
                },
                "required": [
                  "code"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - The request conflicts with the current state of the resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error409"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/promos/{id}": {
      "get": {
        "tags": [
          "promos"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "promos"
            ]
          }
        ],
        "summary": "Get a promo",
        "description": "Retrieve a single promo code by ID.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Promo ID"
            },
            "required": true,
            "description": "Promo ID",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "integer"
                    },
                    "code": {
                      "type": "string"
                    },
                    "discount_type": {
                      "type": "string"
                    },
                    "discount_amount": {
                      "type": "number"
                    },
                    "duration": {
                      "type": "string",
                      "nullable": true
                    },
                    "duration_count": {
                      "type": "number",
                      "nullable": true
                    },
                    "order_limit": {
                      "type": "number",
                      "nullable": true
                    },
                    "expire_at": {
                      "type": "string",
                      "nullable": true
                    },
                    "ordered_count": {
                      "type": "integer"
                    },
                    "is_expired": {
                      "type": "boolean"
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "updated_at": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "code",
                    "discount_type",
                    "discount_amount",
                    "duration",
                    "duration_count",
                    "order_limit",
                    "expire_at",
                    "ordered_count",
                    "is_expired",
                    "created_at",
                    "updated_at"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "promos"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "promos"
            ]
          }
        ],
        "summary": "Update a promo",
        "description": "Update an existing promo/discount code. This is a PARTIAL update: only the fields you send are changed, and anything you leave out keeps its current value. Send expire_at or either discount type as null to clear it; the numeric fields treat null as 0 (unlimited / forever). The code cannot be cleared.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Promo ID"
            },
            "required": true,
            "description": "Promo ID",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "description": "Promo code. Letters and numbers only — no spaces or punctuation. Trimmed and uppercased before saving."
                  },
                  "onetime_discount_type": {
                    "type": "string",
                    "nullable": true,
                    "enum": [
                      "amount",
                      "percent",
                      null
                    ],
                    "description": "Discount type for one-time items. Send null to remove the one-time discount."
                  },
                  "onetime_discount_offset": {
                    "type": "number",
                    "nullable": true,
                    "description": "Discount value for one-time items. Cannot be negative. When type is \"percent\", a percent value from 0 to 100 (20 = 20%). When type is \"amount\", a monetary value in the smallest currency unit ($5.00 USD = 500; ¥500 JPY = 500)."
                  },
                  "subscription_discount_type": {
                    "type": "string",
                    "nullable": true,
                    "enum": [
                      "amount",
                      "percent",
                      null
                    ],
                    "description": "Discount type for subscriptions. Send null to remove the subscription discount."
                  },
                  "subscription_discount_offset": {
                    "type": "number",
                    "nullable": true,
                    "description": "Discount value for subscriptions. Cannot be negative. When type is \"percent\", a percent value from 0 to 100 (20 = 20%). When type is \"amount\", a monetary value in the smallest currency unit ($5.00 USD = 500; ¥500 JPY = 500)."
                  },
                  "subscription_duration_in_months": {
                    "type": "number",
                    "nullable": true,
                    "description": "Duration in months (0 = forever). null is treated as 0."
                  },
                  "expire_at": {
                    "type": "string",
                    "nullable": true,
                    "description": "Expiration date. Send null to remove the expiry."
                  },
                  "order_limit": {
                    "type": "number",
                    "nullable": true,
                    "description": "Maximum number of orders (0 = unlimited). null is treated as 0."
                  },
                  "per_customer_limit": {
                    "type": "number",
                    "nullable": true,
                    "description": "Maximum uses per customer (0 = unlimited). null is treated as 0."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - The request conflicts with the current state of the resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error409"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "promos"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "promos"
            ]
          }
        ],
        "summary": "Delete a promo",
        "description": "Soft delete a promo code.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Promo ID"
            },
            "required": true,
            "description": "Promo ID",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted successfully"
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/promos/{id}/actions": {
      "get": {
        "tags": [
          "promos"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "promos"
            ]
          }
        ],
        "summary": "Get promo automation actions",
        "description": "Get automation event actions for a promo code.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Promo ID"
            },
            "required": true,
            "description": "Promo ID",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "promos"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "promos"
            ]
          }
        ],
        "summary": "Update promo automation actions",
        "description": "Save automation event actions for a promo code.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Promo ID"
            },
            "required": true,
            "description": "Promo ID",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "event_actions": {
                    "nullable": true,
                    "description": "Map of event name to array of action configs"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/subscriptions": {
      "get": {
        "tags": [
          "subscriptions"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "subscriptions"
            ]
          }
        ],
        "summary": "List subscriptions",
        "description": "Retrieve a paginated list of subscriptions",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "description": "Page number",
              "example": 1
            },
            "required": false,
            "description": "Page number",
            "name": "page",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "maximum": 100,
              "description": "Items per page (max 100)",
              "example": 25
            },
            "required": false,
            "description": "Items per page (max 100)",
            "name": "per_page",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Comma-separated list of expansions: payments, usage, custom_fields, customer, order",
              "example": "payments,usage"
            },
            "required": false,
            "description": "Comma-separated list of expansions: payments, usage, custom_fields, customer, order",
            "name": "include",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by id (exact match)."
            },
            "required": false,
            "description": "Filter by id (exact match).",
            "name": "filter[id]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by id (greater than or equal)"
            },
            "required": false,
            "description": "Filter by id (greater than or equal)",
            "name": "filter[id.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by id (less than or equal)"
            },
            "required": false,
            "description": "Filter by id (less than or equal)",
            "name": "filter[id.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by id (comma-separated list). Fetches many records in one request instead of one request per id.",
              "example": "101,102,103"
            },
            "required": false,
            "description": "Filter by id (comma-separated list). Fetches many records in one request instead of one request per id.",
            "name": "filter[id.in]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by id (excluding a comma-separated list)"
            },
            "required": false,
            "description": "Filter by id (excluding a comma-separated list)",
            "name": "filter[id.nin]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by status (exact match). Valid values: pending, trialing, active, past_due, canceling, canceled, unpaid, swapped."
            },
            "required": false,
            "description": "Filter by status (exact match). Valid values: pending, trialing, active, past_due, canceling, canceled, unpaid, swapped.",
            "name": "filter[status]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by status (comma-separated list). Fetches many records in one request instead of one request per id.",
              "example": "pending,trialing"
            },
            "required": false,
            "description": "Filter by status (comma-separated list). Fetches many records in one request instead of one request per id.",
            "name": "filter[status.in]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by status (excluding a comma-separated list)"
            },
            "required": false,
            "description": "Filter by status (excluding a comma-separated list)",
            "name": "filter[status.nin]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by order_id (exact match)."
            },
            "required": false,
            "description": "Filter by order_id (exact match).",
            "name": "filter[order_id]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by order_id (greater than or equal)"
            },
            "required": false,
            "description": "Filter by order_id (greater than or equal)",
            "name": "filter[order_id.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by order_id (less than or equal)"
            },
            "required": false,
            "description": "Filter by order_id (less than or equal)",
            "name": "filter[order_id.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by order_id (comma-separated list). Fetches many records in one request instead of one request per id.",
              "example": "101,102,103"
            },
            "required": false,
            "description": "Filter by order_id (comma-separated list). Fetches many records in one request instead of one request per id.",
            "name": "filter[order_id.in]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by order_id (excluding a comma-separated list)"
            },
            "required": false,
            "description": "Filter by order_id (excluding a comma-separated list)",
            "name": "filter[order_id.nin]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by customer_id (exact match)."
            },
            "required": false,
            "description": "Filter by customer_id (exact match).",
            "name": "filter[customer_id]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by customer_id (greater than or equal)"
            },
            "required": false,
            "description": "Filter by customer_id (greater than or equal)",
            "name": "filter[customer_id.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by customer_id (less than or equal)"
            },
            "required": false,
            "description": "Filter by customer_id (less than or equal)",
            "name": "filter[customer_id.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by customer_id (comma-separated list). Fetches many records in one request instead of one request per id.",
              "example": "101,102,103"
            },
            "required": false,
            "description": "Filter by customer_id (comma-separated list). Fetches many records in one request instead of one request per id.",
            "name": "filter[customer_id.in]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by customer_id (excluding a comma-separated list)"
            },
            "required": false,
            "description": "Filter by customer_id (excluding a comma-separated list)",
            "name": "filter[customer_id.nin]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by email (exact match)."
            },
            "required": false,
            "description": "Filter by email (exact match).",
            "name": "filter[email]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by email (contains)"
            },
            "required": false,
            "description": "Filter by email (contains)",
            "name": "filter[email.contains]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by product_id (exact match)."
            },
            "required": false,
            "description": "Filter by product_id (exact match).",
            "name": "filter[product_id]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by product_id (greater than or equal)"
            },
            "required": false,
            "description": "Filter by product_id (greater than or equal)",
            "name": "filter[product_id.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by product_id (less than or equal)"
            },
            "required": false,
            "description": "Filter by product_id (less than or equal)",
            "name": "filter[product_id.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by product_id (comma-separated list). Fetches many records in one request instead of one request per id.",
              "example": "101,102,103"
            },
            "required": false,
            "description": "Filter by product_id (comma-separated list). Fetches many records in one request instead of one request per id.",
            "name": "filter[product_id.in]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by product_id (excluding a comma-separated list)"
            },
            "required": false,
            "description": "Filter by product_id (excluding a comma-separated list)",
            "name": "filter[product_id.nin]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by product_option_price_id (exact match)."
            },
            "required": false,
            "description": "Filter by product_option_price_id (exact match).",
            "name": "filter[product_option_price_id]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by product_option_price_id (greater than or equal)"
            },
            "required": false,
            "description": "Filter by product_option_price_id (greater than or equal)",
            "name": "filter[product_option_price_id.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by product_option_price_id (less than or equal)"
            },
            "required": false,
            "description": "Filter by product_option_price_id (less than or equal)",
            "name": "filter[product_option_price_id.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by product_option_price_id (comma-separated list). Fetches many records in one request instead of one request per id.",
              "example": "101,102,103"
            },
            "required": false,
            "description": "Filter by product_option_price_id (comma-separated list). Fetches many records in one request instead of one request per id.",
            "name": "filter[product_option_price_id.in]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by product_option_price_id (excluding a comma-separated list)"
            },
            "required": false,
            "description": "Filter by product_option_price_id (excluding a comma-separated list)",
            "name": "filter[product_option_price_id.nin]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by created_at (exact match)."
            },
            "required": false,
            "description": "Filter by created_at (exact match).",
            "name": "filter[created_at]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by created_at (greater than or equal)"
            },
            "required": false,
            "description": "Filter by created_at (greater than or equal)",
            "name": "filter[created_at.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by created_at (less than or equal)"
            },
            "required": false,
            "description": "Filter by created_at (less than or equal)",
            "name": "filter[created_at.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by updated_at (exact match)."
            },
            "required": false,
            "description": "Filter by updated_at (exact match).",
            "name": "filter[updated_at]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by updated_at (greater than or equal)"
            },
            "required": false,
            "description": "Filter by updated_at (greater than or equal)",
            "name": "filter[updated_at.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by updated_at (less than or equal)"
            },
            "required": false,
            "description": "Filter by updated_at (less than or equal)",
            "name": "filter[updated_at.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by next_payment_at (exact match)."
            },
            "required": false,
            "description": "Filter by next_payment_at (exact match).",
            "name": "filter[next_payment_at]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by next_payment_at (greater than or equal)"
            },
            "required": false,
            "description": "Filter by next_payment_at (greater than or equal)",
            "name": "filter[next_payment_at.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by next_payment_at (less than or equal)"
            },
            "required": false,
            "description": "Filter by next_payment_at (less than or equal)",
            "name": "filter[next_payment_at.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Sort field (prefix with - for descending)",
              "example": "-created_at"
            },
            "required": false,
            "description": "Sort field (prefix with - for descending)",
            "name": "sort",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response with paginated list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Subscription"
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Current page number",
                          "example": 1
                        },
                        "limit": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Items per page",
                          "example": 25
                        },
                        "total": {
                          "type": "integer",
                          "description": "Total number of items",
                          "example": 150
                        },
                        "pages": {
                          "type": "integer",
                          "description": "Total number of pages",
                          "example": 6
                        }
                      },
                      "required": [
                        "page",
                        "limit",
                        "total",
                        "pages"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "pagination"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/subscriptions/{id}": {
      "get": {
        "tags": [
          "subscriptions"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "subscriptions"
            ]
          }
        ],
        "summary": "Get subscriptions",
        "description": "Retrieve a single subscriptions by ID",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "description": "subscriptions ID",
              "example": 12345
            },
            "required": true,
            "description": "subscriptions ID",
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Comma-separated list of expansions: payments, usage, custom_fields, customer, order",
              "example": "payments,usage"
            },
            "required": false,
            "description": "Comma-separated list of expansions: payments, usage, custom_fields, customer, order",
            "name": "include",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Subscription"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/subscriptions/{id}/price/{price_id}/proration": {
      "get": {
        "tags": [
          "subscriptions"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "subscriptions"
            ]
          }
        ],
        "summary": "Preview proration for a plan change",
        "description": "Suggested first payment for swapping this subscription onto a different price, based on the unused remainder of the current billing period. Read-only.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Subscription ID"
            },
            "required": true,
            "description": "Subscription ID",
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "New Price ID"
            },
            "required": true,
            "description": "New Price ID",
            "name": "price_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": {
                "def": {
                  "type": "optional",
                  "innerType": {
                    "def": {
                      "type": "string"
                    },
                    "type": "string",
                    "format": null,
                    "minLength": null,
                    "maxLength": null
                  }
                },
                "type": "optional"
              }
            },
            "required": false,
            "description": {
              "def": {
                "type": "optional",
                "innerType": {
                  "def": {
                    "type": "string"
                  },
                  "type": "string",
                  "format": null,
                  "minLength": null,
                  "maxLength": null
                }
              },
              "type": "optional"
            },
            "name": "with_discount",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": {
                "def": {
                  "type": "optional",
                  "innerType": {
                    "def": {
                      "type": "string"
                    },
                    "type": "string",
                    "format": null,
                    "minLength": null,
                    "maxLength": null
                  }
                },
                "type": "optional"
              }
            },
            "required": false,
            "description": {
              "def": {
                "type": "optional",
                "innerType": {
                  "def": {
                    "type": "string"
                  },
                  "type": "string",
                  "format": null,
                  "minLength": null,
                  "maxLength": null
                }
              },
              "type": "optional"
            },
            "name": "do_recalculate_taxes",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/subscriptions/{id}/price/{price_id}": {
      "put": {
        "tags": [
          "subscriptions"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "subscriptions"
            ]
          }
        ],
        "summary": "Change subscription price",
        "description": "Swap a subscription to a different price/plan. Optionally charge or refund the balance difference, or set the new plan's first payment directly.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Subscription ID"
            },
            "required": true,
            "description": "Subscription ID",
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "New Price ID"
            },
            "required": true,
            "description": "New Price ID",
            "name": "price_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "is_changed_immediately": {
                    "type": "boolean",
                    "description": "Whether to bill immediately or at next cycle"
                  },
                  "subscription_start_at": {
                    "type": "string",
                    "description": "Future start date for the new subscription"
                  },
                  "balance_impact_type": {
                    "type": "string",
                    "enum": [
                      "charge",
                      "refund",
                      "prorate"
                    ],
                    "description": "`charge` and `refund` are one-time adjustments made alongside the swap, on top of whatever the new plan bills. `prorate` instead REPLACES the new plan's first payment with `balance_impact_amount`, leaving the next payment a full cycle away; it requires `is_changed_immediately` and is not available with `subscription_start_at`. Use GET /v2/subscriptions/{id}/price/{price_id}/proration for a suggested amount."
                  },
                  "balance_impact_amount": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Amount in the smallest currency unit ($10.00 USD = 1000; ¥1500 JPY = 1500). For `charge` and `refund` this is the adjustment and must be positive. For `prorate` it is the new plan's first payment: 0 is allowed (collect nothing now) and it may not exceed what the new plan's first payment would otherwise have been."
                  },
                  "with_discount": {
                    "type": "boolean",
                    "description": "Pull forward existing discount to new subscription"
                  },
                  "do_recalculate_taxes": {
                    "type": "boolean",
                    "description": "Recalculate taxes based on current addresses"
                  },
                  "notes": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/subscriptions/{id}/notes": {
      "post": {
        "tags": [
          "subscriptions"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "subscriptions"
            ]
          }
        ],
        "summary": "Add notes to subscription",
        "description": "Add a note to a subscription, saved as an event.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Subscription ID"
            },
            "required": true,
            "description": "Subscription ID",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "notes": {
                    "type": "string",
                    "description": "Notes to add"
                  }
                },
                "required": [
                  "notes"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/subscriptions/{id}/cancel": {
      "put": {
        "tags": [
          "subscriptions"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "subscriptions"
            ]
          }
        ],
        "summary": "Cancel a subscription",
        "description": "Cancel a subscription. Can cancel immediately or at the end of the current billing period.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Subscription ID"
            },
            "required": true,
            "description": "Subscription ID",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "is_canceled_immediately": {
                    "type": "boolean",
                    "description": "Cancel immediately (true) or at end of billing period (false)"
                  },
                  "skip_integration_actions": {
                    "type": "boolean",
                    "description": "Skip triggering integration cancellation actions"
                  },
                  "notes": {
                    "type": "string",
                    "description": "Internal notes for the cancellation"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/subscriptions/{id}/uncancel": {
      "put": {
        "tags": [
          "subscriptions"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "subscriptions"
            ]
          }
        ],
        "summary": "Uncancel a subscription",
        "description": "Reverse a pending cancellation and reactivate the subscription.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Subscription ID"
            },
            "required": true,
            "description": "Subscription ID",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "notes": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/subscriptions/{id}/card": {
      "post": {
        "tags": [
          "subscriptions"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "subscriptions"
            ]
          }
        ],
        "summary": "Add a new card to subscription",
        "description": "Create a new payment method and assign it to the subscription.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Subscription ID"
            },
            "required": true,
            "description": "Subscription ID",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "token": {
                    "nullable": true,
                    "description": "Payment gateway token (e.g. Stripe payment method, PayPal token)"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "subscriptions"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "subscriptions"
            ]
          }
        ],
        "summary": "Update subscription card",
        "description": "Update a subscription to use an existing card on file.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Subscription ID"
            },
            "required": true,
            "description": "Subscription ID",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "card_id": {
                    "type": "number",
                    "description": "ID of the existing card to use"
                  }
                },
                "required": [
                  "card_id"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/subscriptions/{id}/nextbillingdate": {
      "put": {
        "tags": [
          "subscriptions"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "subscriptions"
            ]
          }
        ],
        "summary": "Update next billing date",
        "description": "Update the next billing date for a subscription. Must be in the future. Refused for canceled, swapped or pending subscriptions (resume it first), and for a Stripe-gateway subscription with no Stripe subscription behind it. For a Stripe subscription the date must also be within 730 days (Stripe's trial_end ceiling). A past_due or unpaid subscription is reactivated by the new date; any other status is left as it is.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Subscription ID"
            },
            "required": true,
            "description": "Subscription ID",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "next_payment_at": {
                    "type": "string",
                    "description": "New next billing date (ISO 8601)"
                  },
                  "notes": {
                    "type": "string"
                  }
                },
                "required": [
                  "next_payment_at"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/subscriptions/{id}/hardresume": {
      "put": {
        "tags": [
          "subscriptions"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "subscriptions"
            ]
          }
        ],
        "summary": "Hard resume a subscription",
        "description": "Resume a canceled or unpaid subscription by creating a new subscription at the same price.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Subscription ID"
            },
            "required": true,
            "description": "Subscription ID",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "subscription_start_at": {
                    "type": "string",
                    "description": "Future start date"
                  },
                  "with_discount": {
                    "type": "boolean",
                    "description": "Pull forward existing discount"
                  },
                  "do_recalculate_taxes": {
                    "type": "boolean",
                    "description": "Recalculate taxes"
                  },
                  "notes": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/subscriptions/{id}/earlyrenewal": {
      "put": {
        "tags": [
          "subscriptions"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "subscriptions"
            ]
          }
        ],
        "summary": "Process early renewal",
        "description": "Charge the subscription immediately and extend the billing period. Refused, before anything is charged, when the resulting next payment date would be more than 730 days out — Stripe will not accept a trial_end that far ahead, so a subscription renewed a full cycle early (an annual plan across a leap day, or any two-year plan) has to wait until closer to its current billing date.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Subscription ID"
            },
            "required": true,
            "description": "Subscription ID",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "do_recalculate_taxes": {
                    "type": "boolean",
                    "description": "Recalculate taxes"
                  },
                  "notes": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/subscriptions/{id}/payment": {
      "post": {
        "tags": [
          "subscriptions"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "subscriptions"
            ]
          }
        ],
        "summary": "Make a manual payment",
        "description": "Process a manual one-time payment on a subscription.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Subscription ID"
            },
            "required": true,
            "description": "Subscription ID",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "amount": {
                    "type": "number",
                    "description": "Payment amount in the smallest currency unit ($10.00 USD = 1000; ¥1500 JPY = 1500)."
                  },
                  "notes": {
                    "type": "string"
                  }
                },
                "required": [
                  "amount"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/subscriptions/{id}/discount": {
      "put": {
        "tags": [
          "subscriptions"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "subscriptions"
            ]
          }
        ],
        "summary": "Apply a discount",
        "description": "Apply a promo code discount to a subscription. Replaces any existing discount.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Subscription ID"
            },
            "required": true,
            "description": "Subscription ID",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "promo_id": {
                    "type": "number",
                    "description": "ID of the promo code to apply"
                  },
                  "notes": {
                    "type": "string"
                  }
                },
                "required": [
                  "promo_id"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "subscriptions"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "subscriptions"
            ]
          }
        ],
        "summary": "Remove discount",
        "description": "Remove the active discount from a subscription.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Subscription ID"
            },
            "required": true,
            "description": "Subscription ID",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "notes": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/webhook-endpoints": {
      "post": {
        "tags": [
          "webhook-endpoints"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "webhooks"
            ]
          }
        ],
        "summary": "Create webhook endpoint",
        "description": "Create a new webhook endpoint for the authenticated OAuth client",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEndpointCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - The request conflicts with the current state of the resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error409"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "webhook-endpoints"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "webhooks"
            ]
          }
        ],
        "summary": "List webhook-endpoints",
        "description": "List webhook endpoints",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "description": "Page number",
              "example": 1
            },
            "required": false,
            "description": "Page number",
            "name": "page",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "maximum": 100,
              "description": "Items per page (max 100)",
              "example": 25
            },
            "required": false,
            "description": "Items per page (max 100)",
            "name": "per_page",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Sort field (prefix with - for descending)",
              "example": "-created_at"
            },
            "required": false,
            "description": "Sort field (prefix with - for descending)",
            "name": "sort",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response with paginated list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "nullable": true
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Current page number",
                          "example": 1
                        },
                        "limit": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Items per page",
                          "example": 25
                        },
                        "total": {
                          "type": "integer",
                          "description": "Total number of items",
                          "example": 150
                        },
                        "pages": {
                          "type": "integer",
                          "description": "Total number of pages",
                          "example": 6
                        }
                      },
                      "required": [
                        "page",
                        "limit",
                        "total",
                        "pages"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "pagination"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/webhook-endpoints/{id}": {
      "get": {
        "tags": [
          "webhook-endpoints"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "webhooks"
            ]
          }
        ],
        "summary": "Get webhook-endpoints",
        "description": "Retrieve a single webhook-endpoints by ID",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "webhook-endpoints"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "webhooks"
            ]
          }
        ],
        "summary": "Update webhook endpoint",
        "description": "Update a webhook endpoint configuration",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEndpointUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - The request conflicts with the current state of the resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error409"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "webhook-endpoints"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "webhooks"
            ]
          }
        ],
        "summary": "Delete webhook endpoint",
        "description": "Delete a webhook endpoint",
        "responses": {
          "204": {
            "description": "Deleted successfully"
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/webhook-endpoints/{id}/rotate-secret": {
      "post": {
        "tags": [
          "webhook-endpoints"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "webhooks"
            ]
          }
        ],
        "summary": "POST /v2/webhook-endpoints/:id/rotate-secret",
        "description": "Endpoint: POST /v2/webhook-endpoints/:id/rotate-secret",
        "responses": {
          "200": {
            "description": "Successful response"
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/webhook-endpoints/{id}/test": {
      "post": {
        "tags": [
          "webhook-endpoints"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "webhooks"
            ]
          }
        ],
        "summary": "POST /v2/webhook-endpoints/:id/test",
        "description": "Endpoint: POST /v2/webhook-endpoints/:id/test",
        "responses": {
          "200": {
            "description": "Successful response"
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/webhook-endpoints/{id}/events": {
      "get": {
        "tags": [
          "webhook-events"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "webhooks"
            ]
          }
        ],
        "summary": "List webhook-events",
        "description": "List endpoint events",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "description": "Page number",
              "example": 1
            },
            "required": false,
            "description": "Page number",
            "name": "page",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "maximum": 100,
              "description": "Items per page (max 100)",
              "example": 25
            },
            "required": false,
            "description": "Items per page (max 100)",
            "name": "per_page",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Sort field (prefix with - for descending)",
              "example": "-created_at"
            },
            "required": false,
            "description": "Sort field (prefix with - for descending)",
            "name": "sort",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response with paginated list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "nullable": true
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Current page number",
                          "example": 1
                        },
                        "limit": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Items per page",
                          "example": 25
                        },
                        "total": {
                          "type": "integer",
                          "description": "Total number of items",
                          "example": 150
                        },
                        "pages": {
                          "type": "integer",
                          "description": "Total number of pages",
                          "example": 6
                        }
                      },
                      "required": [
                        "page",
                        "limit",
                        "total",
                        "pages"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "pagination"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/webhook-endpoints/{id}/events/{event_id}": {
      "get": {
        "tags": [
          "webhook-events"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "webhooks"
            ]
          }
        ],
        "summary": "Get webhook-events",
        "description": "Retrieve a single webhook-events by ID",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/webhook-endpoints/{id}/events/{event_id}/retry": {
      "post": {
        "tags": [
          "webhook-events"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "webhooks"
            ]
          }
        ],
        "summary": "POST /v2/webhook-endpoints/:id/events/:event_id/retry",
        "description": "Endpoint: POST /v2/webhook-endpoints/:id/events/:event_id/retry",
        "responses": {
          "200": {
            "description": "Successful response"
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/webhook-events": {
      "get": {
        "tags": [
          "webhook-events"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "webhooks"
            ]
          }
        ],
        "summary": "List webhook-events",
        "description": "List all webhook events",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "description": "Page number",
              "example": 1
            },
            "required": false,
            "description": "Page number",
            "name": "page",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "maximum": 100,
              "description": "Items per page (max 100)",
              "example": 25
            },
            "required": false,
            "description": "Items per page (max 100)",
            "name": "per_page",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Sort field (prefix with - for descending)",
              "example": "-created_at"
            },
            "required": false,
            "description": "Sort field (prefix with - for descending)",
            "name": "sort",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response with paginated list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "nullable": true
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Current page number",
                          "example": 1
                        },
                        "limit": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Items per page",
                          "example": 25
                        },
                        "total": {
                          "type": "integer",
                          "description": "Total number of items",
                          "example": 150
                        },
                        "pages": {
                          "type": "integer",
                          "description": "Total number of pages",
                          "example": 6
                        }
                      },
                      "required": [
                        "page",
                        "limit",
                        "total",
                        "pages"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "pagination"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/webhook-event-types": {
      "get": {
        "tags": [
          "webhook-event-types"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "webhooks"
            ]
          }
        ],
        "summary": "List webhook-event-types",
        "description": "List webhook event types",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "description": "Page number",
              "example": 1
            },
            "required": false,
            "description": "Page number",
            "name": "page",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "maximum": 100,
              "description": "Items per page (max 100)",
              "example": 25
            },
            "required": false,
            "description": "Items per page (max 100)",
            "name": "per_page",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Sort field (prefix with - for descending)",
              "example": "-created_at"
            },
            "required": false,
            "description": "Sort field (prefix with - for descending)",
            "name": "sort",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response with paginated list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "nullable": true
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Current page number",
                          "example": 1
                        },
                        "limit": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Items per page",
                          "example": 25
                        },
                        "total": {
                          "type": "integer",
                          "description": "Total number of items",
                          "example": 150
                        },
                        "pages": {
                          "type": "integer",
                          "description": "Total number of pages",
                          "example": 6
                        }
                      },
                      "required": [
                        "page",
                        "limit",
                        "total",
                        "pages"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "pagination"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/reports/types": {
      "get": {
        "tags": [
          "reports"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "reports"
            ]
          }
        ],
        "summary": "List available report types with their filters, datasets, columns, and date presets",
        "description": "Discovery for the reports API: each of the six report types with the filters it accepts\n(names, data types, options), its result datasets and columns, grouping options, and the\nrelative_date presets. Call this before create_report to construct a valid report.\n\nReport types: affiliate_performance, attribution_performance, checkout_performance,\ncustomer_cohort_ltv, payment_plan_performance, product_sales.\n\nFilter note: static options arrays are included where available. Dynamic / account-specific\noptions (e.g. product lists, checkout lists) are omitted from this endpoint — pass the\nlister object's `object` field to understand what entity type drives the search.\n\nNote: reports bucket dates in the report's own timezone field (legacy semantics),\nunlike /v2/analytics which is UTC-only.",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReportTypeV2"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/reports/exports/{token}": {
      "get": {
        "tags": [
          "reports"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "reports"
            ]
          }
        ],
        "summary": "Download a report run export as CSV",
        "description": "Streams the full dataset for a completed run as `text/csv`, with no pagination\nand no row cap.\n\nThis endpoint requires no authentication — the signed token in the path is the\ncredential — and it does **not** count against your monthly API quota. It is the\ncheapest way to pull a large dataset: create the run, poll until it completes,\nmint a URL with `POST /v2/reports/{report_id}/runs/{run_id}/exports`, then\ndownload here.\n\nTokens expire 15 minutes after they are minted.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Signed download token from the create-export response"
            },
            "required": true,
            "description": "Signed download token from the create-export response",
            "name": "token",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/reports": {
      "get": {
        "tags": [
          "reports"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "reports"
            ]
          }
        ],
        "summary": "List reports",
        "description": "List saved reports",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "description": "Page number",
              "example": 1
            },
            "required": false,
            "description": "Page number",
            "name": "page",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "maximum": 100,
              "description": "Items per page (max 100)",
              "example": 25
            },
            "required": false,
            "description": "Items per page (max 100)",
            "name": "per_page",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by type (exact match)."
            },
            "required": false,
            "description": "Filter by type (exact match).",
            "name": "filter[type]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by type (contains)"
            },
            "required": false,
            "description": "Filter by type (contains)",
            "name": "filter[type.contains]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by is_active (exact match). Valid values: true, false."
            },
            "required": false,
            "description": "Filter by is_active (exact match). Valid values: true, false.",
            "name": "filter[is_active]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by is_active (comma-separated list). Fetches many records in one request instead of one request per id.",
              "example": "true,false"
            },
            "required": false,
            "description": "Filter by is_active (comma-separated list). Fetches many records in one request instead of one request per id.",
            "name": "filter[is_active.in]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by is_active (excluding a comma-separated list)"
            },
            "required": false,
            "description": "Filter by is_active (excluding a comma-separated list)",
            "name": "filter[is_active.nin]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by created_at (exact match)."
            },
            "required": false,
            "description": "Filter by created_at (exact match).",
            "name": "filter[created_at]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by created_at (greater than or equal)"
            },
            "required": false,
            "description": "Filter by created_at (greater than or equal)",
            "name": "filter[created_at.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by created_at (less than or equal)"
            },
            "required": false,
            "description": "Filter by created_at (less than or equal)",
            "name": "filter[created_at.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Sort field (prefix with - for descending)",
              "example": "-created_at"
            },
            "required": false,
            "description": "Sort field (prefix with - for descending)",
            "name": "sort",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response with paginated list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ReportV2"
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Current page number",
                          "example": 1
                        },
                        "limit": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Items per page",
                          "example": 25
                        },
                        "total": {
                          "type": "integer",
                          "description": "Total number of items",
                          "example": 150
                        },
                        "pages": {
                          "type": "integer",
                          "description": "Total number of pages",
                          "example": 6
                        }
                      },
                      "required": [
                        "page",
                        "limit",
                        "total",
                        "pages"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "pagination"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "reports"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "reports"
            ]
          }
        ],
        "summary": "Create a saved report",
        "description": "Create a new saved report. Call GET /v2/reports/types (list_report_types) first to\ndiscover valid type values, filter names, and relative_date presets.\n\nScheduling: when frequency and relative_date are set, the report is emailed to its\nusers on the computed schedule — exactly as dashboard-created scheduled reports are.\nfrequency requires relative_date (a rolling window such as \"Last Month\").\nusers[] is optional — each entry takes {user_id} OR {email} (account users with\nreport access). When scheduling and users is omitted, it defaults to YOU (the\nauthorizing user), so \"schedule this and email me\" needs no ids at all.\n\nnext_run_at is computed automatically from frequency + frequency_count; do not set it manually.\n\nReports are created active (is_active=true, no draft state — unlike the dashboard).\nWhen name is omitted, a descriptive name is auto-generated from the type and filters\n(same as the dashboard) — but pass an explicit name when you want a predictable one.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReportV2Create"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReportV2"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - The request conflicts with the current state of the resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error409"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/reports/{report_id}": {
      "get": {
        "tags": [
          "reports"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "reports"
            ]
          }
        ],
        "summary": "Get reports",
        "description": "Retrieve a single reports by ID",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "description": "reports ID",
              "example": 12345
            },
            "required": true,
            "description": "reports ID",
            "name": "report_id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReportV2"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "reports"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "reports"
            ]
          }
        ],
        "summary": "Update a saved report",
        "description": "Update an existing saved report. Only the provided fields are changed (partial update). Set name, relative_date, frequency, or frequency_count to null to clear them — clearing frequency turns the schedule off (next_run_at becomes null). Set is_active=true to reactivate a soft-deleted report. Supplying users replaces the entire recipient list ({user_id} or {email} per entry; [] clears it); when a patch introduces frequency on a report with no recipients and users is omitted, the authorizing user is defaulted. Changing the cadence recomputes next_run_at; resending an unchanged frequency leaves the send date where it is.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Report ID"
            },
            "required": true,
            "description": "Report ID",
            "name": "report_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReportV2Update"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReportV2"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - The request was invalid or malformed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error400"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - The request conflicts with the current state of the resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error409"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "reports"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "reports"
            ]
          }
        ],
        "summary": "Delete a saved report",
        "description": "Soft-delete a saved report (sets is_active=false). The report is no longer returned by the default list. Returns 204 on success.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Report ID"
            },
            "required": true,
            "description": "Report ID",
            "name": "report_id",
            "in": "path"
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted successfully"
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/reports/{report_id}/runs": {
      "post": {
        "tags": [
          "reports"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "reports"
            ]
          }
        ],
        "summary": "Create a report run (queued for background execution)",
        "description": "Create a new report run. Returns 202 Accepted with the run in \"pending\" status.\nExecution is asynchronous: a background worker picks up pending runs, so runs\ntypically START within about 30 seconds of creation, then take a few seconds to\na few minutes to finish depending on data volume.\n\nPolling: call get_report_run until status is \"completed\" or \"failed\". Each poll\ncounts against the monthly API quota — poll no faster than every ~30 seconds\n(matches the worker pickup cadence); typical runs complete within a couple of minutes.\n\nReading results: when completed, the run includes a stats block (flat_stats) that\nanswers most questions — total revenue, count, etc. — without fetching rows.\nRead stats first; only fetch rows via list_report_run_results if you need detail.\n\nThe run inherits the report's filters, timezone, and date range. For relative_date\npresets (e.g. \"Last Month\"), the start/end dates are resolved at run time.\nThe report must have a date range — relative_date or a report_date filter —\nor this returns 400 (every report type date-filters its results).",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Report ID"
            },
            "required": true,
            "description": "Report ID",
            "name": "report_id",
            "in": "path"
          }
        ],
        "responses": {
          "201": {
            "description": "Created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReportRunV2"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - The request conflicts with the current state of the resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error409"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "reports"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "reports"
            ]
          }
        ],
        "summary": "List reports",
        "description": "List runs for a report",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "description": "Page number",
              "example": 1
            },
            "required": false,
            "description": "Page number",
            "name": "page",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "maximum": 100,
              "description": "Items per page (max 100)",
              "example": 25
            },
            "required": false,
            "description": "Items per page (max 100)",
            "name": "per_page",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Sort field (prefix with - for descending)",
              "example": "-created_at"
            },
            "required": false,
            "description": "Sort field (prefix with - for descending)",
            "name": "sort",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response with paginated list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ReportRunV2"
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Current page number",
                          "example": 1
                        },
                        "limit": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Items per page",
                          "example": 25
                        },
                        "total": {
                          "type": "integer",
                          "description": "Total number of items",
                          "example": 150
                        },
                        "pages": {
                          "type": "integer",
                          "description": "Total number of pages",
                          "example": 6
                        }
                      },
                      "required": [
                        "page",
                        "limit",
                        "total",
                        "pages"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "pagination"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/reports/{report_id}/runs/{run_id}": {
      "get": {
        "tags": [
          "reports"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "reports"
            ]
          }
        ],
        "summary": "Get reports",
        "description": "Retrieve a single reports by ID",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReportRunV2"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/reports/{report_id}/runs/{run_id}/results": {
      "get": {
        "tags": [
          "reports"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "reports"
            ]
          }
        ],
        "summary": "List reports",
        "description": "Get paginated tabular results for a completed report run",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "description": "Page number",
              "example": 1
            },
            "required": false,
            "description": "Page number",
            "name": "page",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "maximum": 100,
              "description": "Items per page (max 100)",
              "example": 25
            },
            "required": false,
            "description": "Items per page (max 100)",
            "name": "per_page",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Sort field (prefix with - for descending)",
              "example": "-created_at"
            },
            "required": false,
            "description": "Sort field (prefix with - for descending)",
            "name": "sort",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response with paginated list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ReportRunResultsV2"
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Current page number",
                          "example": 1
                        },
                        "limit": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Items per page",
                          "example": 25
                        },
                        "total": {
                          "type": "integer",
                          "description": "Total number of items",
                          "example": 150
                        },
                        "pages": {
                          "type": "integer",
                          "description": "Total number of pages",
                          "example": 6
                        }
                      },
                      "required": [
                        "page",
                        "limit",
                        "total",
                        "pages"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "pagination"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/reports/{report_id}/runs/{run_id}/exports": {
      "post": {
        "tags": [
          "reports"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "reports"
            ]
          }
        ],
        "summary": "Create a short-lived signed CSV download URL for a completed report run",
        "description": "Generates a signed download URL for the full dataset of a completed run.\nOne quota call, zero context — the URL is handed to the user or fetched with local\ntooling (e.g. curl). The URL requires no authentication (the signed token IS the\ncredential). Expires in 15 minutes.\n\nRun must be completed (status=completed) — 409 otherwise; poll get_report_run first.\n\nQuery/body param:\n  dataset — which dataset to download (default: \"default\"); 400 lists available datasets.\n\nResponse: { data: { url: string, expires_at: ISO8601 } }",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Report ID"
            },
            "required": true,
            "description": "Report ID",
            "name": "report_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Run ID"
            },
            "required": true,
            "description": "Run ID",
            "name": "run_id",
            "in": "path"
          }
        ],
        "responses": {
          "201": {
            "description": "Created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReportExportV2"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - The request conflicts with the current state of the resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error409"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/events": {
      "get": {
        "tags": [
          "events"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "account"
            ]
          }
        ],
        "summary": "List events",
        "description": "List audit events — the account activity log. Each event records an action taken by a user (dashboard staff), a customer, or the system (automated billing): subscription changes, payments, card updates, notes, and more. `name` identifies the action (see the name filter for valid values), `data` carries action-specific detail, and the *_id fields link to the related customer, order, subscription, payment plan, or payment.",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "description": "Page number",
              "example": 1
            },
            "required": false,
            "description": "Page number",
            "name": "page",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "maximum": 100,
              "description": "Items per page (max 100)",
              "example": 25
            },
            "required": false,
            "description": "Items per page (max 100)",
            "name": "per_page",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by id (exact match)."
            },
            "required": false,
            "description": "Filter by id (exact match).",
            "name": "filter[id]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by id (greater than or equal)"
            },
            "required": false,
            "description": "Filter by id (greater than or equal)",
            "name": "filter[id.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by id (less than or equal)"
            },
            "required": false,
            "description": "Filter by id (less than or equal)",
            "name": "filter[id.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by id (comma-separated list). Fetches many records in one request instead of one request per id.",
              "example": "101,102,103"
            },
            "required": false,
            "description": "Filter by id (comma-separated list). Fetches many records in one request instead of one request per id.",
            "name": "filter[id.in]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by id (excluding a comma-separated list)"
            },
            "required": false,
            "description": "Filter by id (excluding a comma-separated list)",
            "name": "filter[id.nin]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by type (exact match). Valid values: user, customer, system."
            },
            "required": false,
            "description": "Filter by type (exact match). Valid values: user, customer, system.",
            "name": "filter[type]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by type (comma-separated list). Fetches many records in one request instead of one request per id.",
              "example": "user,customer"
            },
            "required": false,
            "description": "Filter by type (comma-separated list). Fetches many records in one request instead of one request per id.",
            "name": "filter[type.in]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by type (excluding a comma-separated list)"
            },
            "required": false,
            "description": "Filter by type (excluding a comma-separated list)",
            "name": "filter[type.nin]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by name (exact match). Valid values: notes, login, update_account_whop_fee, general_notes, change_customer_email, update_customer, merge_customer, customer_magic_link, change_subscription_card, auto_change_subscription_card, cancel_subscription, uncancel_subscription, pause_subscription, resume_subscription, swap_subscription, order_placed, start_subscription, trialing_subscription, update_subscription, early_renewal_subscription, change_paymentplan_card, auto_change_paymentplan_card, update_paymentplan, update_paymentplan_terms, cancel_paymentplan, payment_upcoming, complete_paymentplan, payment_failed, payment_success, payment_disputed, payment_dispute_refunded, payment_reinstated, payment_action_required, payment_action_resolved, payment_action_denied, create_payment, delete_payment, refund_payment, send_payment_receipt, resend_order_confirmation, manual_payment, retry_payment, skip_payment, create_adjustment, cancel_order_item, change_card, delete_card, hotswap_card, card_expired, card_expiring, affiliate_magic_link, affiliate_signup, update_order, update_order_affiliate, remove_order_affiliate, update_template, apply_subscription_discount, remove_subscription_discount, update_subscription_discount, create_oauth_client, update_oauth_client, delete_oauth_client, regenerate_oauth_client_secret, add_oauth_redirect_uri, remove_oauth_redirect_uri, add_oauth_scope, remove_oauth_scope, create_webhook_endpoint, update_webhook_endpoint, delete_webhook_endpoint, rotate_webhook_secret, oauth_app_connected, oauth_app_disconnected, create_api_key, delete_api_key, regenerate_api_key."
            },
            "required": false,
            "description": "Filter by name (exact match). Valid values: notes, login, update_account_whop_fee, general_notes, change_customer_email, update_customer, merge_customer, customer_magic_link, change_subscription_card, auto_change_subscription_card, cancel_subscription, uncancel_subscription, pause_subscription, resume_subscription, swap_subscription, order_placed, start_subscription, trialing_subscription, update_subscription, early_renewal_subscription, change_paymentplan_card, auto_change_paymentplan_card, update_paymentplan, update_paymentplan_terms, cancel_paymentplan, payment_upcoming, complete_paymentplan, payment_failed, payment_success, payment_disputed, payment_dispute_refunded, payment_reinstated, payment_action_required, payment_action_resolved, payment_action_denied, create_payment, delete_payment, refund_payment, send_payment_receipt, resend_order_confirmation, manual_payment, retry_payment, skip_payment, create_adjustment, cancel_order_item, change_card, delete_card, hotswap_card, card_expired, card_expiring, affiliate_magic_link, affiliate_signup, update_order, update_order_affiliate, remove_order_affiliate, update_template, apply_subscription_discount, remove_subscription_discount, update_subscription_discount, create_oauth_client, update_oauth_client, delete_oauth_client, regenerate_oauth_client_secret, add_oauth_redirect_uri, remove_oauth_redirect_uri, add_oauth_scope, remove_oauth_scope, create_webhook_endpoint, update_webhook_endpoint, delete_webhook_endpoint, rotate_webhook_secret, oauth_app_connected, oauth_app_disconnected, create_api_key, delete_api_key, regenerate_api_key.",
            "name": "filter[name]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by name (comma-separated list). Fetches many records in one request instead of one request per id.",
              "example": "notes,login"
            },
            "required": false,
            "description": "Filter by name (comma-separated list). Fetches many records in one request instead of one request per id.",
            "name": "filter[name.in]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by name (excluding a comma-separated list)"
            },
            "required": false,
            "description": "Filter by name (excluding a comma-separated list)",
            "name": "filter[name.nin]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by user_id (exact match)."
            },
            "required": false,
            "description": "Filter by user_id (exact match).",
            "name": "filter[user_id]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by user_id (greater than or equal)"
            },
            "required": false,
            "description": "Filter by user_id (greater than or equal)",
            "name": "filter[user_id.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by user_id (less than or equal)"
            },
            "required": false,
            "description": "Filter by user_id (less than or equal)",
            "name": "filter[user_id.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by user_id (comma-separated list). Fetches many records in one request instead of one request per id.",
              "example": "101,102,103"
            },
            "required": false,
            "description": "Filter by user_id (comma-separated list). Fetches many records in one request instead of one request per id.",
            "name": "filter[user_id.in]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by user_id (excluding a comma-separated list)"
            },
            "required": false,
            "description": "Filter by user_id (excluding a comma-separated list)",
            "name": "filter[user_id.nin]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by customer_id (exact match)."
            },
            "required": false,
            "description": "Filter by customer_id (exact match).",
            "name": "filter[customer_id]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by customer_id (greater than or equal)"
            },
            "required": false,
            "description": "Filter by customer_id (greater than or equal)",
            "name": "filter[customer_id.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by customer_id (less than or equal)"
            },
            "required": false,
            "description": "Filter by customer_id (less than or equal)",
            "name": "filter[customer_id.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by customer_id (comma-separated list). Fetches many records in one request instead of one request per id.",
              "example": "101,102,103"
            },
            "required": false,
            "description": "Filter by customer_id (comma-separated list). Fetches many records in one request instead of one request per id.",
            "name": "filter[customer_id.in]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by customer_id (excluding a comma-separated list)"
            },
            "required": false,
            "description": "Filter by customer_id (excluding a comma-separated list)",
            "name": "filter[customer_id.nin]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by order_id (exact match)."
            },
            "required": false,
            "description": "Filter by order_id (exact match).",
            "name": "filter[order_id]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by order_id (greater than or equal)"
            },
            "required": false,
            "description": "Filter by order_id (greater than or equal)",
            "name": "filter[order_id.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by order_id (less than or equal)"
            },
            "required": false,
            "description": "Filter by order_id (less than or equal)",
            "name": "filter[order_id.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by order_id (comma-separated list). Fetches many records in one request instead of one request per id.",
              "example": "101,102,103"
            },
            "required": false,
            "description": "Filter by order_id (comma-separated list). Fetches many records in one request instead of one request per id.",
            "name": "filter[order_id.in]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by order_id (excluding a comma-separated list)"
            },
            "required": false,
            "description": "Filter by order_id (excluding a comma-separated list)",
            "name": "filter[order_id.nin]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by order_item_id (exact match)."
            },
            "required": false,
            "description": "Filter by order_item_id (exact match).",
            "name": "filter[order_item_id]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by order_item_id (greater than or equal)"
            },
            "required": false,
            "description": "Filter by order_item_id (greater than or equal)",
            "name": "filter[order_item_id.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by order_item_id (less than or equal)"
            },
            "required": false,
            "description": "Filter by order_item_id (less than or equal)",
            "name": "filter[order_item_id.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by order_item_id (comma-separated list). Fetches many records in one request instead of one request per id.",
              "example": "101,102,103"
            },
            "required": false,
            "description": "Filter by order_item_id (comma-separated list). Fetches many records in one request instead of one request per id.",
            "name": "filter[order_item_id.in]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by order_item_id (excluding a comma-separated list)"
            },
            "required": false,
            "description": "Filter by order_item_id (excluding a comma-separated list)",
            "name": "filter[order_item_id.nin]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by subscription_id (exact match)."
            },
            "required": false,
            "description": "Filter by subscription_id (exact match).",
            "name": "filter[subscription_id]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by subscription_id (greater than or equal)"
            },
            "required": false,
            "description": "Filter by subscription_id (greater than or equal)",
            "name": "filter[subscription_id.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by subscription_id (less than or equal)"
            },
            "required": false,
            "description": "Filter by subscription_id (less than or equal)",
            "name": "filter[subscription_id.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by subscription_id (comma-separated list). Fetches many records in one request instead of one request per id.",
              "example": "101,102,103"
            },
            "required": false,
            "description": "Filter by subscription_id (comma-separated list). Fetches many records in one request instead of one request per id.",
            "name": "filter[subscription_id.in]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by subscription_id (excluding a comma-separated list)"
            },
            "required": false,
            "description": "Filter by subscription_id (excluding a comma-separated list)",
            "name": "filter[subscription_id.nin]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by paymentplan_id (exact match)."
            },
            "required": false,
            "description": "Filter by paymentplan_id (exact match).",
            "name": "filter[paymentplan_id]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by paymentplan_id (greater than or equal)"
            },
            "required": false,
            "description": "Filter by paymentplan_id (greater than or equal)",
            "name": "filter[paymentplan_id.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by paymentplan_id (less than or equal)"
            },
            "required": false,
            "description": "Filter by paymentplan_id (less than or equal)",
            "name": "filter[paymentplan_id.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by paymentplan_id (comma-separated list). Fetches many records in one request instead of one request per id.",
              "example": "101,102,103"
            },
            "required": false,
            "description": "Filter by paymentplan_id (comma-separated list). Fetches many records in one request instead of one request per id.",
            "name": "filter[paymentplan_id.in]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by paymentplan_id (excluding a comma-separated list)"
            },
            "required": false,
            "description": "Filter by paymentplan_id (excluding a comma-separated list)",
            "name": "filter[paymentplan_id.nin]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by payment_id (exact match)."
            },
            "required": false,
            "description": "Filter by payment_id (exact match).",
            "name": "filter[payment_id]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by payment_id (greater than or equal)"
            },
            "required": false,
            "description": "Filter by payment_id (greater than or equal)",
            "name": "filter[payment_id.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by payment_id (less than or equal)"
            },
            "required": false,
            "description": "Filter by payment_id (less than or equal)",
            "name": "filter[payment_id.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by payment_id (comma-separated list). Fetches many records in one request instead of one request per id.",
              "example": "101,102,103"
            },
            "required": false,
            "description": "Filter by payment_id (comma-separated list). Fetches many records in one request instead of one request per id.",
            "name": "filter[payment_id.in]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by payment_id (excluding a comma-separated list)"
            },
            "required": false,
            "description": "Filter by payment_id (excluding a comma-separated list)",
            "name": "filter[payment_id.nin]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by notification_id (exact match)."
            },
            "required": false,
            "description": "Filter by notification_id (exact match).",
            "name": "filter[notification_id]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by notification_id (greater than or equal)"
            },
            "required": false,
            "description": "Filter by notification_id (greater than or equal)",
            "name": "filter[notification_id.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by notification_id (less than or equal)"
            },
            "required": false,
            "description": "Filter by notification_id (less than or equal)",
            "name": "filter[notification_id.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by notification_id (comma-separated list). Fetches many records in one request instead of one request per id.",
              "example": "101,102,103"
            },
            "required": false,
            "description": "Filter by notification_id (comma-separated list). Fetches many records in one request instead of one request per id.",
            "name": "filter[notification_id.in]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by notification_id (excluding a comma-separated list)"
            },
            "required": false,
            "description": "Filter by notification_id (excluding a comma-separated list)",
            "name": "filter[notification_id.nin]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by created_at (exact match)."
            },
            "required": false,
            "description": "Filter by created_at (exact match).",
            "name": "filter[created_at]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by created_at (greater than or equal)"
            },
            "required": false,
            "description": "Filter by created_at (greater than or equal)",
            "name": "filter[created_at.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by created_at (less than or equal)"
            },
            "required": false,
            "description": "Filter by created_at (less than or equal)",
            "name": "filter[created_at.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Sort field (prefix with - for descending)",
              "example": "-created_at"
            },
            "required": false,
            "description": "Sort field (prefix with - for descending)",
            "name": "sort",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response with paginated list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "integer"
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "user",
                              "customer",
                              "system"
                            ]
                          },
                          "user_id": {
                            "type": "integer",
                            "nullable": true
                          },
                          "account_id": {
                            "type": "integer",
                            "nullable": true
                          },
                          "customer_id": {
                            "type": "integer",
                            "nullable": true
                          },
                          "order_id": {
                            "type": "integer",
                            "nullable": true
                          },
                          "subscription_id": {
                            "type": "integer",
                            "nullable": true
                          },
                          "order_paymentplan_id": {
                            "type": "integer",
                            "nullable": true
                          },
                          "order_item_id": {
                            "type": "integer",
                            "nullable": true
                          },
                          "payment_id": {
                            "type": "integer",
                            "nullable": true
                          },
                          "adjustment_id": {
                            "type": "integer",
                            "nullable": true
                          },
                          "old_card_id": {
                            "type": "integer",
                            "nullable": true
                          },
                          "new_card_id": {
                            "type": "integer",
                            "nullable": true
                          },
                          "integration_id": {
                            "type": "integer",
                            "nullable": true
                          },
                          "name": {
                            "type": "string",
                            "nullable": true,
                            "maxLength": 255
                          },
                          "data": {
                            "nullable": true
                          },
                          "notes": {
                            "type": "string",
                            "nullable": true
                          },
                          "api_request_id": {
                            "type": "integer",
                            "nullable": true
                          },
                          "notification_id": {
                            "type": "integer",
                            "nullable": true
                          },
                          "created_at": {
                            "type": "string",
                            "nullable": true,
                            "format": "date-time"
                          },
                          "updated_at": {
                            "type": "string",
                            "nullable": true,
                            "format": "date-time"
                          },
                          "name_label": {
                            "type": "string",
                            "nullable": true
                          }
                        },
                        "required": [
                          "id",
                          "type"
                        ]
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Current page number",
                          "example": 1
                        },
                        "limit": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Items per page",
                          "example": 25
                        },
                        "total": {
                          "type": "integer",
                          "description": "Total number of items",
                          "example": 150
                        },
                        "pages": {
                          "type": "integer",
                          "description": "Total number of pages",
                          "example": 6
                        }
                      },
                      "required": [
                        "page",
                        "limit",
                        "total",
                        "pages"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "pagination"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/checkouts": {
      "get": {
        "tags": [
          "checkouts"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "checkouts"
            ]
          }
        ],
        "summary": "List checkouts",
        "description": "List and search checkouts. Returns active checkouts by default; filter by product_id (matches products attached as line items OR block items), status, or search internal_name/offer_name.",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "description": "Page number",
              "example": 1
            },
            "required": false,
            "description": "Page number",
            "name": "page",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "maximum": 100,
              "description": "Items per page (max 100)",
              "example": 25
            },
            "required": false,
            "description": "Items per page (max 100)",
            "name": "per_page",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Search across: internal_name, offer_name",
              "example": "search term"
            },
            "required": false,
            "description": "Search across: internal_name, offer_name",
            "name": "search",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by status (exact match)."
            },
            "required": false,
            "description": "Filter by status (exact match).",
            "name": "filter[status]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by product_id (exact match)."
            },
            "required": false,
            "description": "Filter by product_id (exact match).",
            "name": "filter[product_id]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by created_at (exact match)."
            },
            "required": false,
            "description": "Filter by created_at (exact match).",
            "name": "filter[created_at]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by created_at (greater than or equal)"
            },
            "required": false,
            "description": "Filter by created_at (greater than or equal)",
            "name": "filter[created_at.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by created_at (less than or equal)"
            },
            "required": false,
            "description": "Filter by created_at (less than or equal)",
            "name": "filter[created_at.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by updated_at (exact match)."
            },
            "required": false,
            "description": "Filter by updated_at (exact match).",
            "name": "filter[updated_at]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by updated_at (greater than or equal)"
            },
            "required": false,
            "description": "Filter by updated_at (greater than or equal)",
            "name": "filter[updated_at.gte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by updated_at (less than or equal)"
            },
            "required": false,
            "description": "Filter by updated_at (less than or equal)",
            "name": "filter[updated_at.lte]",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Sort field (prefix with - for descending)",
              "example": "-created_at"
            },
            "required": false,
            "description": "Sort field (prefix with - for descending)",
            "name": "sort",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response with paginated list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "nullable": true
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "page": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Current page number",
                          "example": 1
                        },
                        "limit": {
                          "type": "integer",
                          "minimum": 0,
                          "exclusiveMinimum": true,
                          "description": "Items per page",
                          "example": 25
                        },
                        "total": {
                          "type": "integer",
                          "description": "Total number of items",
                          "example": 150
                        },
                        "pages": {
                          "type": "integer",
                          "description": "Total number of pages",
                          "example": 6
                        }
                      },
                      "required": [
                        "page",
                        "limit",
                        "total",
                        "pages"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "pagination"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v2/checkouts/{id}": {
      "get": {
        "tags": [
          "checkouts"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "checkouts"
            ]
          }
        ],
        "summary": "Get checkouts",
        "description": "Retrieve a single checkouts by ID",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "description": "checkouts ID",
              "example": 12345
            },
            "required": true,
            "description": "checkouts ID",
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Comma-separated list of expansions: items",
              "example": "items"
            },
            "required": false,
            "description": "Comma-separated list of expansions: items",
            "name": "include",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Authentication is required or has failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error401"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - You do not have permission to access this resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found - The requested resource does not exist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error404"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error500"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orders": {
      "get": {
        "tags": [
          "v1-orders"
        ],
        "summary": "List orders",
        "description": "List orders with filtering and pagination.\n\nAdditional filter query parameters are available depending on the resource.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "orders"
            ]
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "description": "Page number (1-based)",
              "example": 1
            },
            "required": false,
            "description": "Page number (1-based)",
            "name": "page",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "description": "Items per page (default 50)",
              "example": 50
            },
            "required": false,
            "description": "Items per page (default 50)",
            "name": "per_page",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Sort field (prefix with - for descending)",
              "example": "-created_at"
            },
            "required": false,
            "description": "Sort field (prefix with - for descending)",
            "name": "sort",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Full-text search query"
            },
            "required": false,
            "description": "Full-text search query",
            "name": "search",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated list of resources",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ListResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden / insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/customers": {
      "get": {
        "tags": [
          "v1-customers"
        ],
        "summary": "List customers",
        "description": "List customers with filtering and pagination.\n\nAdditional filter query parameters are available depending on the resource.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "customers"
            ]
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "description": "Page number (1-based)",
              "example": 1
            },
            "required": false,
            "description": "Page number (1-based)",
            "name": "page",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "description": "Items per page (default 50)",
              "example": 50
            },
            "required": false,
            "description": "Items per page (default 50)",
            "name": "per_page",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Sort field (prefix with - for descending)",
              "example": "-created_at"
            },
            "required": false,
            "description": "Sort field (prefix with - for descending)",
            "name": "sort",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Full-text search query"
            },
            "required": false,
            "description": "Full-text search query",
            "name": "search",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated list of resources",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ListResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden / insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/subscriptions": {
      "get": {
        "tags": [
          "v1-subscriptions"
        ],
        "summary": "List subscriptions",
        "description": "List subscriptions with filtering and pagination.\n\nAdditional filter query parameters are available depending on the resource.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "subscriptions"
            ]
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "description": "Page number (1-based)",
              "example": 1
            },
            "required": false,
            "description": "Page number (1-based)",
            "name": "page",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "description": "Items per page (default 50)",
              "example": 50
            },
            "required": false,
            "description": "Items per page (default 50)",
            "name": "per_page",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Sort field (prefix with - for descending)",
              "example": "-created_at"
            },
            "required": false,
            "description": "Sort field (prefix with - for descending)",
            "name": "sort",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Full-text search query"
            },
            "required": false,
            "description": "Full-text search query",
            "name": "search",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated list of resources",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ListResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden / insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/payments": {
      "get": {
        "tags": [
          "v1-payments"
        ],
        "summary": "List payments",
        "description": "List payments with filtering and pagination.\n\nAdditional filter query parameters are available depending on the resource.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "payments"
            ]
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "description": "Page number (1-based)",
              "example": 1
            },
            "required": false,
            "description": "Page number (1-based)",
            "name": "page",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "description": "Items per page (default 50)",
              "example": 50
            },
            "required": false,
            "description": "Items per page (default 50)",
            "name": "per_page",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Sort field (prefix with - for descending)",
              "example": "-created_at"
            },
            "required": false,
            "description": "Sort field (prefix with - for descending)",
            "name": "sort",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Full-text search query"
            },
            "required": false,
            "description": "Full-text search query",
            "name": "search",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated list of resources",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ListResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden / insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/paymentplans": {
      "get": {
        "tags": [
          "v1-paymentplans"
        ],
        "summary": "List payment plans",
        "description": "List payment plans with filtering and pagination.\n\nAdditional filter query parameters are available depending on the resource.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "paymentplans"
            ]
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "description": "Page number (1-based)",
              "example": 1
            },
            "required": false,
            "description": "Page number (1-based)",
            "name": "page",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "description": "Items per page (default 50)",
              "example": 50
            },
            "required": false,
            "description": "Items per page (default 50)",
            "name": "per_page",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Sort field (prefix with - for descending)",
              "example": "-created_at"
            },
            "required": false,
            "description": "Sort field (prefix with - for descending)",
            "name": "sort",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Full-text search query"
            },
            "required": false,
            "description": "Full-text search query",
            "name": "search",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated list of resources",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ListResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden / insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/checkouts": {
      "get": {
        "tags": [
          "v1-checkouts"
        ],
        "summary": "List checkouts",
        "description": "List checkouts with filtering and pagination.\n\nAdditional filter query parameters are available depending on the resource.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "checkouts"
            ]
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "description": "Page number (1-based)",
              "example": 1
            },
            "required": false,
            "description": "Page number (1-based)",
            "name": "page",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "description": "Items per page (default 50)",
              "example": 50
            },
            "required": false,
            "description": "Items per page (default 50)",
            "name": "per_page",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Sort field (prefix with - for descending)",
              "example": "-created_at"
            },
            "required": false,
            "description": "Sort field (prefix with - for descending)",
            "name": "sort",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Full-text search query"
            },
            "required": false,
            "description": "Full-text search query",
            "name": "search",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated list of resources",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ListResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden / insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/checkouts/describe": {
      "get": {
        "tags": [
          "v1-checkouts"
        ],
        "summary": "Describe checkout structure",
        "description": "Returns checkout fields and configuration metadata.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "checkouts"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Checkout structure description",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden / insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/account": {
      "get": {
        "tags": [
          "v1-account"
        ],
        "summary": "Get account info",
        "description": "Returns basic account and authenticated user details.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "account"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Account information",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "account_id": {
                      "type": "integer"
                    },
                    "account_name": {
                      "type": "string"
                    },
                    "user_id": {
                      "type": "integer"
                    },
                    "user_email": {
                      "type": "string"
                    },
                    "user_name": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "account_id",
                    "account_name",
                    "user_id",
                    "user_email",
                    "user_name"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden / insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/customers/{customer_id}/auth": {
      "post": {
        "tags": [
          "v1-customers"
        ],
        "summary": "Send customer magic link email",
        "description": "Sends a magic link email to the specified customer.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "customers"
            ]
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Customer ID"
            },
            "required": true,
            "description": "Customer ID",
            "name": "customer_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "Redirect URL included in the magic link"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success"
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden / insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Customer not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/customers/auth": {
      "post": {
        "tags": [
          "v1-customers"
        ],
        "summary": "Send magic link email by email address",
        "description": "Sends a magic link email to a customer identified by email address.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "customers"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "description": "Customer email address"
                  },
                  "url": {
                    "type": "string",
                    "description": "Redirect URL included in the magic link"
                  }
                },
                "required": [
                  "email"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success"
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden / insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/customers/{customer_id}/login": {
      "post": {
        "tags": [
          "v1-customers"
        ],
        "summary": "Generate customer magic link token",
        "description": "Generates a magic link token for the specified customer (does not send email).",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "customers"
            ]
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Customer ID"
            },
            "required": true,
            "description": "Customer ID",
            "name": "customer_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "Redirect URL included in the magic link"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Magic link token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "magic_link_token": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "magic_link_token"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden / insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Customer not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/customers/login": {
      "post": {
        "tags": [
          "v1-customers"
        ],
        "summary": "Generate magic link token by email",
        "description": "Generates a magic link token for a customer identified by email address.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "customers"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "description": "Customer email address"
                  },
                  "url": {
                    "type": "string",
                    "description": "Redirect URL included in the magic link"
                  }
                },
                "required": [
                  "email"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Magic link token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "magic_link_token": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "magic_link_token"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden / insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/affiliates/{affiliate_id}/auth": {
      "post": {
        "tags": [
          "v1-affiliates"
        ],
        "summary": "Send affiliate magic link email",
        "description": "Sends a magic link email to the specified affiliate.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "customers"
            ]
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Affiliate ID"
            },
            "required": true,
            "description": "Affiliate ID",
            "name": "affiliate_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "Redirect URL included in the magic link"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success"
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden / insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Affiliate not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/affiliates/{affiliate_id}/login": {
      "post": {
        "tags": [
          "v1-affiliates"
        ],
        "summary": "Generate affiliate magic link token",
        "description": "Generates a magic link token for the specified affiliate.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "customers"
            ]
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Affiliate ID"
            },
            "required": true,
            "description": "Affiliate ID",
            "name": "affiliate_id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Magic link token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "magic_link_token": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "magic_link_token"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden / insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Affiliate not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/integrations/actions": {
      "post": {
        "tags": [
          "v1-integrations"
        ],
        "summary": "Create integration action",
        "description": "Creates a new integration action triggered by an event.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "integrations"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "event_name": {
                    "type": "string",
                    "description": "Event name to trigger on"
                  },
                  "integration_type": {
                    "type": "string",
                    "description": "Integration type identifier"
                  },
                  "action_name": {
                    "type": "string",
                    "description": "Action name"
                  },
                  "action_config": {
                    "nullable": true,
                    "description": "Action configuration object"
                  },
                  "reference_entity": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "description": "Entity type (e.g. checkout, subscription)"
                      },
                      "id": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "number"
                          }
                        ],
                        "description": "Entity ID"
                      }
                    },
                    "required": [
                      "type",
                      "id"
                    ]
                  }
                },
                "required": [
                  "event_name",
                  "integration_type",
                  "action_name",
                  "reference_entity"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success"
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden / insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/integrations/actions/delete": {
      "post": {
        "tags": [
          "v1-integrations"
        ],
        "summary": "Delete integration action",
        "description": "Deletes an existing integration action.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "integrations"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "event_name": {
                    "type": "string",
                    "description": "Event name"
                  },
                  "integration_type": {
                    "type": "string",
                    "description": "Integration type identifier"
                  },
                  "action_name": {
                    "type": "string",
                    "description": "Action name"
                  },
                  "action_config": {
                    "nullable": true,
                    "description": "Action configuration object (optional)"
                  },
                  "reference_entity": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "description": "Entity type"
                      },
                      "id": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "number"
                          }
                        ],
                        "description": "Entity ID"
                      }
                    },
                    "required": [
                      "type",
                      "id"
                    ]
                  }
                },
                "required": [
                  "event_name",
                  "integration_type",
                  "action_name",
                  "reference_entity"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success"
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden / insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/subscriptions/{subscription_id}/usage": {
      "post": {
        "tags": [
          "v1-subscriptions"
        ],
        "summary": "Report metered usage",
        "description": "Reports metered usage for a subscription. Returns the Stripe usage record(s).",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": [
              "subscriptions",
              "subscription_metered_billing"
            ]
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Subscription ID"
            },
            "required": true,
            "description": "Subscription ID",
            "name": "subscription_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "quantity": {
                    "type": "number",
                    "description": "Usage quantity to report"
                  },
                  "timestamp": {
                    "type": "number",
                    "description": "Unix timestamp for the usage event (defaults to now)"
                  }
                },
                "required": [
                  "quantity"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Stripe usage record(s)",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden / insufficient scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Subscription not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1ErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "x-tagGroups": [
    {
      "name": "Customers",
      "tags": [
        "customers"
      ]
    },
    {
      "name": "Orders",
      "tags": [
        "orders"
      ]
    },
    {
      "name": "Products",
      "tags": [
        "products"
      ]
    },
    {
      "name": "Subscriptions",
      "tags": [
        "subscriptions"
      ]
    },
    {
      "name": "Payments",
      "tags": [
        "payments"
      ]
    },
    {
      "name": "Payment Plans",
      "tags": [
        "paymentplans"
      ]
    },
    {
      "name": "Promos",
      "tags": [
        "promos"
      ]
    },
    {
      "name": "Affiliates",
      "tags": [
        "Affiliates",
        "affiliates",
        "affiliate-programs",
        "affiliate-payouts"
      ]
    },
    {
      "name": "Webhooks",
      "tags": [
        "Webhooks",
        "webhook-endpoints",
        "webhook-events",
        "webhook-event-types"
      ]
    },
    {
      "name": "API v1",
      "tags": [
        "API v1",
        "v1-account",
        "v1-orders",
        "v1-customers",
        "v1-subscriptions",
        "v1-payments",
        "v1-paymentplans",
        "v1-checkouts",
        "v1-affiliates",
        "v1-integrations"
      ]
    }
  ]
}