{
  "openapi": "3.1.0",
  "info": {
    "title": "Vanix Subscriptions API",
    "version": "v1",
    "description": "Read and change a store's subscriptions from its own systems. Authenticate with an API key made in Vanix under Settings \u2192 API keys, sent as `Authorization: Bearer <key>`. See https://vanixcommerce.com/docs/api."
  },
  "servers": [
    {
      "url": "https://api.vanixcommerce.com/v1"
    }
  ],
  "security": [
    {
      "apiKey": []
    }
  ],
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "An API key: `vx_live_` followed by 43 characters. Never put it in a URL or in browser code."
      }
    },
    "headers": {
      "RequestId": {
        "description": "Quote it if you contact us about a request.",
        "schema": {
          "type": "string",
          "example": "req_9f1c0b2e4d5a4e7f8a6b3c2d1e0f9a8b"
        }
      },
      "RateLimitLimit": {
        "description": "The size of the rate-limit bucket closest to empty: the store's, shared by its keys, or this key's.",
        "schema": {
          "type": "integer"
        }
      },
      "RateLimitRemaining": {
        "description": "Requests that would go through right now.",
        "schema": {
          "type": "integer"
        }
      },
      "RateLimitReset": {
        "description": "Seconds until the bucket is full again.",
        "schema": {
          "type": "integer"
        }
      },
      "RetryAfter": {
        "description": "Seconds to wait before retrying.",
        "schema": {
          "type": "integer"
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "type",
              "code",
              "message",
              "requestId"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthenticated",
                  "plan",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "rate_limited",
                  "upstream",
                  "internal"
                ]
              },
              "code": {
                "type": "string",
                "description": "Stable; branch on this, not on the message."
              },
              "message": {
                "type": "string",
                "description": "For a developer to read."
              },
              "param": {
                "type": "string",
                "description": "The request field at fault, when there is one."
              },
              "requestId": {
                "type": "string"
              }
            },
            "additionalProperties": true
          }
        }
      },
      "Shop": {
        "type": "object",
        "required": [
          "shop",
          "apiKey",
          "environment"
        ],
        "properties": {
          "shop": {
            "type": "object",
            "required": [
              "domain",
              "timeZone",
              "plan"
            ],
            "properties": {
              "domain": {
                "type": "string",
                "example": "example.myshopify.com"
              },
              "timeZone": {
                "type": "string",
                "description": "The zone date-only fields are in.",
                "example": "America/Denver"
              },
              "plan": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "handle": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                }
              },
              "currencyCode": {
                "type": [
                  "string",
                  "null"
                ],
                "example": "USD"
              },
              "taxesIncluded": {
                "type": [
                  "boolean",
                  "null"
                ],
                "description": "Whether the store's prices include tax, by default. Markets can price tax-inclusive per country, so this is not a promise about every subscription; rely on a subscription's `totals.total`. Null when Shopify could not be read."
              }
            }
          },
          "apiKey": {
            "type": "object",
            "required": [
              "id",
              "name",
              "prefix",
              "scopes"
            ],
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "name": {
                "type": "string"
              },
              "prefix": {
                "type": "string",
                "example": "vx_live_4f9Q"
              },
              "scopes": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "example": [
                  "subscriptions:read",
                  "customers:read"
                ]
              }
            }
          },
          "environment": {
            "type": "string",
            "enum": [
              "live",
              "test"
            ]
          }
        }
      },
      "Money": {
        "type": "object",
        "required": [
          "amount",
          "currencyCode"
        ],
        "properties": {
          "amount": {
            "type": "string",
            "description": "A decimal string with the currency's own number of decimals: `\"12.50\"`, `\"1086\"` for yen. Never a float.",
            "example": "12.50"
          },
          "currencyCode": {
            "type": "string",
            "example": "USD"
          }
        }
      },
      "Ref": {
        "type": "object",
        "required": [
          "id",
          "gid"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "The numeric id, the one in Shopify admin URLs."
          },
          "gid": {
            "type": "string",
            "description": "Shopify's global id."
          }
        }
      },
      "Anchor": {
        "type": "object",
        "required": [
          "type",
          "day",
          "month",
          "cutoffDay"
        ],
        "properties": {
          "type": {
            "type": [
              "string",
              "null"
            ],
            "description": "WEEKDAY, MONTHDAY or YEARDAY."
          },
          "day": {
            "type": [
              "integer",
              "null"
            ]
          },
          "month": {
            "type": [
              "integer",
              "null"
            ]
          },
          "cutoffDay": {
            "type": [
              "integer",
              "null"
            ]
          }
        }
      },
      "Address": {
        "type": "object",
        "required": [
          "firstName",
          "lastName",
          "company",
          "address1",
          "address2",
          "city",
          "province",
          "provinceCode",
          "zip",
          "country",
          "countryCode",
          "phone"
        ],
        "properties": {
          "firstName": {
            "type": [
              "string",
              "null"
            ]
          },
          "lastName": {
            "type": [
              "string",
              "null"
            ]
          },
          "company": {
            "type": [
              "string",
              "null"
            ]
          },
          "address1": {
            "type": [
              "string",
              "null"
            ]
          },
          "address2": {
            "type": [
              "string",
              "null"
            ]
          },
          "city": {
            "type": [
              "string",
              "null"
            ]
          },
          "province": {
            "type": [
              "string",
              "null"
            ]
          },
          "provinceCode": {
            "type": [
              "string",
              "null"
            ]
          },
          "zip": {
            "type": [
              "string",
              "null"
            ]
          },
          "country": {
            "type": [
              "string",
              "null"
            ]
          },
          "countryCode": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "SubscriptionLine": {
        "type": "object",
        "required": [
          "id",
          "product",
          "variant",
          "quantity",
          "price",
          "basePrice",
          "total",
          "sellingPlan",
          "priceSchedule",
          "oneTime",
          "imageUrl"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "A gid. Lines have no numeric id in Shopify."
          },
          "product": {
            "type": [
              "object",
              "null"
            ],
            "description": "Null once the product is deleted.",
            "properties": {
              "id": {
                "type": "string"
              },
              "gid": {
                "type": "string"
              },
              "title": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "variant": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "gid": {
                "type": "string"
              },
              "title": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "sku": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "quantity": {
            "type": "integer"
          },
          "price": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Money"
              },
              {
                "type": "null"
              }
            ],
            "description": "The price per unit now."
          },
          "basePrice": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Money"
              },
              {
                "type": "null"
              }
            ],
            "description": "The price before the selling plan's discount."
          },
          "total": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Money"
              },
              {
                "type": "null"
              }
            ],
            "description": "This line on the next order, after every discount."
          },
          "sellingPlan": {
            "type": [
              "object",
              "null"
            ],
            "description": "Null for a line added without a plan.",
            "properties": {
              "id": {
                "type": "string"
              },
              "gid": {
                "type": "string"
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "priceSchedule": {
            "type": "array",
            "description": "Price changes after a number of cycles, such as a first-order discount.",
            "items": {
              "type": "object",
              "required": [
                "afterCycle",
                "price"
              ],
              "properties": {
                "afterCycle": {
                  "type": "integer"
                },
                "price": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/Money"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              }
            }
          },
          "oneTime": {
            "type": "boolean",
            "description": "An item for the next order only; it comes off after the next successful charge."
          },
          "imageUrl": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "Discount": {
        "type": "object",
        "required": [
          "id",
          "type",
          "title",
          "code",
          "target",
          "value",
          "cyclesUsed",
          "cycleLimit",
          "rejected"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "type": [
              "string",
              "null"
            ],
            "description": "CODE_DISCOUNT, MANUAL or AUTOMATIC_DISCOUNT."
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "code": {
            "type": [
              "string",
              "null"
            ],
            "description": "The code, on a CODE_DISCOUNT."
          },
          "target": {
            "type": [
              "string",
              "null"
            ],
            "description": "LINE_ITEM or SHIPPING_LINE."
          },
          "value": {
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "PERCENTAGE",
                  "FIXED_AMOUNT"
                ]
              },
              "percentage": {
                "type": "number"
              },
              "amount": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/Money"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "appliesOnEachItem": {
                "type": [
                  "boolean",
                  "null"
                ]
              }
            }
          },
          "cyclesUsed": {
            "type": [
              "integer",
              "null"
            ]
          },
          "cycleLimit": {
            "type": [
              "integer",
              "null"
            ]
          },
          "rejected": {
            "type": "boolean",
            "description": "Shopify has stopped applying it."
          }
        }
      },
      "PaymentMethod": {
        "type": "object",
        "required": [
          "type",
          "brand",
          "lastDigits",
          "expiryMonth",
          "expiryYear",
          "expiresSoon",
          "wallet",
          "paypalEmail",
          "inactive",
          "revoked"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "CARD",
              "SHOP_PAY",
              "PAYPAL",
              "BANK_ACCOUNT",
              "OTHER"
            ],
            "description": "`OTHER` is a method Shopify added after this was written."
          },
          "brand": {
            "type": [
              "string",
              "null"
            ]
          },
          "lastDigits": {
            "type": [
              "string",
              "null"
            ]
          },
          "expiryMonth": {
            "type": [
              "integer",
              "null"
            ]
          },
          "expiryYear": {
            "type": [
              "integer",
              "null"
            ]
          },
          "expiresSoon": {
            "type": "boolean"
          },
          "wallet": {
            "type": [
              "string",
              "null"
            ],
            "description": "apple_pay, google_pay\u2026 when the card came from one."
          },
          "paypalEmail": {
            "type": [
              "string",
              "null"
            ]
          },
          "inactive": {
            "type": "boolean"
          },
          "revoked": {
            "type": "boolean"
          }
        }
      },
      "Subscription": {
        "type": "object",
        "required": [
          "id",
          "gid",
          "revisionId",
          "status",
          "createdAt",
          "updatedAt",
          "customer",
          "nextBilling",
          "prepaid",
          "billingFrequency",
          "deliveryFrequency",
          "lines",
          "linesCount",
          "linesTruncated",
          "delivery",
          "totals",
          "discounts",
          "paymentMethod",
          "payment",
          "pendingCancellation",
          "originOrder",
          "note",
          "customAttributes"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "gid": {
            "type": "string"
          },
          "revisionId": {
            "type": [
              "string",
              "null"
            ],
            "description": "Send it back on a priced change; see Concurrency."
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "PAUSED",
              "CANCELLED",
              "EXPIRED",
              "FAILED"
            ]
          },
          "createdAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "updatedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "customer": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "gid": {
                "type": "string"
              },
              "displayName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "firstName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "lastName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "email": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "nextBilling": {
            "type": [
              "object",
              "null"
            ],
            "description": "When the next charge is made. Null while paused or ended. On a prepaid subscription the deliveries in between are not charges.",
            "properties": {
              "date": {
                "type": "string",
                "format": "date",
                "description": "In the store's time zone."
              },
              "at": {
                "type": "string",
                "format": "date-time"
              }
            }
          },
          "prepaid": {
            "type": "boolean",
            "description": "Billed less often than delivered."
          },
          "billingFrequency": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "interval": {
                "type": "string",
                "enum": [
                  "DAY",
                  "WEEK",
                  "MONTH",
                  "YEAR"
                ]
              },
              "intervalCount": {
                "type": "integer"
              },
              "minCycles": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "maxCycles": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "anchors": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Anchor"
                }
              }
            }
          },
          "deliveryFrequency": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "interval": {
                "type": "string",
                "enum": [
                  "DAY",
                  "WEEK",
                  "MONTH",
                  "YEAR"
                ]
              },
              "intervalCount": {
                "type": "integer"
              },
              "anchors": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Anchor"
                }
              }
            }
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SubscriptionLine"
            }
          },
          "linesCount": {
            "type": "integer"
          },
          "linesTruncated": {
            "type": "boolean",
            "description": "True in a list when there are more than 50 lines; the single read always has them all."
          },
          "delivery": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "method": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "SHIPPING",
                  "LOCAL_DELIVERY",
                  "PICKUP",
                  null
                ]
              },
              "option": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "code": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "title": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                }
              },
              "price": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/Money"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "address": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/Address"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "phone": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "instructions": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "totals": {
            "type": "object",
            "description": "Rely on `total`: what the next order charges. Do not add the parts up; where prices include tax it is already inside them.",
            "properties": {
              "lines": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/Money"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "delivery": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/Money"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "tax": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/Money"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "total": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/Money"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "estimated": {
                "type": "boolean",
                "description": "Shopify has not yet projected the order with tax; `total` is lines plus delivery."
              }
            }
          },
          "discounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Discount"
            }
          },
          "paymentMethod": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PaymentMethod"
              },
              {
                "type": "null"
              }
            ]
          },
          "payment": {
            "type": "object",
            "required": [
              "lastStatus",
              "lastErrorType",
              "failing",
              "nextRetryAt"
            ],
            "properties": {
              "lastStatus": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "SUCCEEDED, FAILED\u2026"
              },
              "lastErrorType": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "PAYMENT_ERROR, INVENTORY_ERROR, CUSTOMER_ERROR or OTHER."
              },
              "failing": {
                "type": "boolean"
              },
              "nextRetryAt": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              }
            }
          },
          "pendingCancellation": {
            "type": [
              "object",
              "null"
            ],
            "description": "An end-of-cycle cancel not yet carried out.",
            "properties": {
              "effectiveAt": {
                "type": "string",
                "format": "date-time"
              },
              "scheduledBy": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "customer",
                  "merchant",
                  "api",
                  null
                ]
              },
              "reason": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "originOrder": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "gid": {
                "type": "string"
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "createdAt": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              }
            }
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "customAttributes": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "key",
                "value"
              ],
              "properties": {
                "key": {
                  "type": "string"
                },
                "value": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            }
          }
        },
        "description": "The v1 subscription object. Fields may be added; none are renamed or removed within v1."
      },
      "Customer": {
        "type": "object",
        "required": [
          "id",
          "gid",
          "displayName",
          "firstName",
          "lastName",
          "email",
          "phone",
          "createdAt",
          "numberOfOrders",
          "amountSpent",
          "subscriptions"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "gid": {
            "type": "string"
          },
          "displayName": {
            "type": [
              "string",
              "null"
            ]
          },
          "firstName": {
            "type": [
              "string",
              "null"
            ]
          },
          "lastName": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "numberOfOrders": {
            "type": "integer"
          },
          "amountSpent": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Money"
              },
              {
                "type": "null"
              }
            ]
          },
          "subscriptions": {
            "type": "object",
            "required": [
              "count",
              "status"
            ],
            "properties": {
              "count": {
                "type": "integer"
              },
              "status": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The one that matters most when there are several: FAILED, then ACTIVE, PAUSED, CANCELLED, EXPIRED."
              }
            }
          }
        }
      },
      "CustomerDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Customer"
          },
          {
            "type": "object",
            "required": [
              "updatedAt",
              "note",
              "tags",
              "verifiedEmail",
              "marketingState",
              "defaultAddress",
              "lastOrder"
            ],
            "properties": {
              "updatedAt": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "note": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "tags": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "verifiedEmail": {
                "type": "boolean"
              },
              "marketingState": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "defaultAddress": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "address1": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "address2": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "city": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "province": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "zip": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "country": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "phone": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                }
              },
              "lastOrder": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "gid": {
                    "type": "string"
                  },
                  "name": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "createdAt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  },
                  "total": {
                    "oneOf": [
                      {
                        "$ref": "#/components/schemas/Money"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                }
              }
            }
          }
        ]
      },
      "SubscriptionList": {
        "type": "object",
        "required": [
          "data",
          "nextCursor"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Subscription"
            }
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "Pass as `cursor` for the next page; null on the last."
          }
        }
      },
      "CustomerList": {
        "type": "object",
        "required": [
          "data",
          "nextCursor"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Customer"
            }
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "Pass as `cursor` for the next page; null on the last."
          }
        }
      },
      "Warning": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "description": "See `x-warning-codes`."
          },
          "message": {
            "type": "string"
          },
          "closesAt": {
            "type": "string",
            "format": "date-time"
          },
          "deliveries": {
            "type": "integer"
          }
        },
        "required": [
          "code",
          "message"
        ],
        "description": "Worth knowing before saving; never stops the write."
      },
      "Notification": {
        "type": "object",
        "properties": {
          "sent": {
            "type": "boolean",
            "description": "Whether the customer was emailed. False when not asked to, or when it could not be sent."
          }
        },
        "required": [
          "sent"
        ]
      },
      "SubscriptionAnswer": {
        "type": "object",
        "properties": {
          "subscription": {
            "$ref": "#/components/schemas/Subscription"
          },
          "notification": {
            "$ref": "#/components/schemas/Notification"
          },
          "warnings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Warning"
            }
          },
          "charge": {
            "type": "object",
            "properties": {
              "state": {
                "type": "string",
                "enum": [
                  "SUCCEEDED",
                  "FAILED",
                  "ACTION_REQUIRED",
                  "PENDING",
                  "RETRYING",
                  "SKIPPED"
                ]
              }
            },
            "required": [
              "state"
            ]
          }
        },
        "required": [
          "subscription"
        ],
        "description": "The subscription as stored after the change. `notification`, `warnings` and `charge` come with the actions that have them."
      },
      "SwapPreview": {
        "type": "object",
        "properties": {
          "preview": {
            "type": "object",
            "properties": {
              "lineId": {
                "type": "string"
              },
              "from": {
                "type": "object",
                "properties": {
                  "product": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "gid": {
                        "type": "string"
                      },
                      "title": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    }
                  },
                  "variant": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "gid": {
                        "type": "string"
                      },
                      "title": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    }
                  },
                  "price": {
                    "oneOf": [
                      {
                        "$ref": "#/components/schemas/Money"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "basePrice": {
                    "oneOf": [
                      {
                        "$ref": "#/components/schemas/Money"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "sellingPlan": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "gid": {
                        "type": "string"
                      },
                      "name": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    }
                  }
                },
                "required": [
                  "product",
                  "variant",
                  "price",
                  "sellingPlan"
                ]
              },
              "to": {
                "type": "object",
                "properties": {
                  "product": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "gid": {
                        "type": "string"
                      },
                      "title": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    }
                  },
                  "variant": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "gid": {
                        "type": "string"
                      },
                      "title": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    }
                  },
                  "price": {
                    "oneOf": [
                      {
                        "$ref": "#/components/schemas/Money"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "basePrice": {
                    "oneOf": [
                      {
                        "$ref": "#/components/schemas/Money"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "sellingPlan": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "gid": {
                        "type": "string"
                      },
                      "name": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    }
                  }
                },
                "required": [
                  "product",
                  "variant",
                  "price",
                  "sellingPlan"
                ]
              },
              "quantity": {
                "type": "object",
                "properties": {
                  "from": {
                    "type": "integer"
                  },
                  "to": {
                    "type": "integer"
                  }
                },
                "required": [
                  "from",
                  "to"
                ]
              },
              "defaultPrice": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/Money"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "priceSetByMerchant": {
                "type": "boolean"
              },
              "customerCanSwap": {
                "type": "boolean"
              },
              "warnings": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Warning"
                }
              }
            },
            "required": [
              "lineId",
              "from",
              "to",
              "quantity",
              "defaultPrice",
              "priceSetByMerchant",
              "customerCanSwap",
              "warnings"
            ]
          },
          "revisionId": {
            "type": "string",
            "description": "Send it with the write."
          }
        },
        "required": [
          "preview",
          "revisionId"
        ]
      },
      "AddPreview": {
        "type": "object",
        "properties": {
          "preview": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "recurring",
                  "oneTime"
                ]
              },
              "product": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "gid": {
                    "type": "string"
                  },
                  "title": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                }
              },
              "variant": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "gid": {
                    "type": "string"
                  },
                  "title": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                }
              },
              "quantity": {
                "type": "integer"
              },
              "price": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/Money"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "basePrice": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/Money"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "defaultPrice": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/Money"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "priceSetByMerchant": {
                "type": "boolean"
              },
              "sellingPlanName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "customerCanSwap": {
                "type": "boolean"
              },
              "discounts": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "applies": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "code",
                    "applies"
                  ]
                }
              },
              "warnings": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Warning"
                }
              }
            },
            "required": [
              "kind",
              "product",
              "variant",
              "quantity",
              "price",
              "basePrice",
              "defaultPrice",
              "priceSetByMerchant",
              "sellingPlanName",
              "customerCanSwap",
              "discounts",
              "warnings"
            ]
          },
          "revisionId": {
            "type": "string",
            "description": "Send it with the write."
          }
        },
        "required": [
          "preview",
          "revisionId"
        ]
      },
      "RemoveLinePreview": {
        "type": "object",
        "properties": {
          "preview": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "recurring",
                  "oneTime"
                ]
              },
              "lastLine": {
                "type": "boolean",
                "description": "The last renewing line cannot be removed; cancel instead."
              },
              "warnings": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Warning"
                }
              }
            },
            "required": [
              "kind",
              "lastLine",
              "warnings"
            ]
          },
          "revisionId": {
            "type": "string",
            "description": "Send it with the write."
          }
        },
        "required": [
          "preview",
          "revisionId"
        ]
      },
      "AddressPreview": {
        "type": "object",
        "properties": {
          "preview": {
            "type": "object",
            "properties": {
              "address": {
                "$ref": "#/components/schemas/Address"
              },
              "deliveryOptions": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "title": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "price": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/Money"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "phoneRequired": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "code",
                    "title",
                    "description",
                    "price",
                    "phoneRequired"
                  ]
                }
              },
              "currentOptionCode": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "unchanged": {
                "type": "boolean"
              }
            },
            "required": [
              "address",
              "deliveryOptions",
              "currentOptionCode",
              "unchanged"
            ]
          },
          "revisionId": {
            "type": "string",
            "description": "Send it with the write."
          }
        },
        "required": [
          "preview",
          "revisionId"
        ]
      },
      "DiscountPreview": {
        "type": "object",
        "properties": {
          "preview": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "title": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "value": {
                "type": "object",
                "required": [
                  "type"
                ],
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "PERCENTAGE",
                      "FIXED_AMOUNT"
                    ]
                  },
                  "percentage": {
                    "type": "number"
                  },
                  "amount": {
                    "oneOf": [
                      {
                        "$ref": "#/components/schemas/Money"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "appliesOnEachItem": {
                    "type": [
                      "boolean",
                      "null"
                    ]
                  }
                }
              },
              "cycleLimit": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "lineIds": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "warnings": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Warning"
                }
              }
            },
            "required": [
              "code",
              "title",
              "value",
              "cycleLimit",
              "lineIds",
              "warnings"
            ]
          },
          "revisionId": {
            "type": "string",
            "description": "Send it with the write."
          }
        },
        "required": [
          "preview",
          "revisionId"
        ]
      },
      "SkipPreview": {
        "type": "object",
        "properties": {
          "preview": {
            "type": "object",
            "properties": {
              "allowed": {
                "type": "boolean"
              },
              "reason": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The error code the skip would answer."
              },
              "from": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "date": {
                    "type": "string",
                    "format": "date"
                  },
                  "at": {
                    "type": "string",
                    "format": "date-time"
                  }
                },
                "required": [
                  "date",
                  "at"
                ]
              },
              "to": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "date": {
                    "type": "string",
                    "format": "date"
                  },
                  "at": {
                    "type": "string",
                    "format": "date-time"
                  }
                },
                "required": [
                  "date",
                  "at"
                ]
              }
            },
            "required": [
              "allowed",
              "reason",
              "from",
              "to"
            ]
          },
          "revisionId": {
            "type": "string",
            "description": "Send it with the write."
          }
        },
        "required": [
          "preview",
          "revisionId"
        ]
      },
      "FrequencyOptions": {
        "type": "object",
        "properties": {
          "allowed": {
            "type": "boolean"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "current": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "interval": {
                "type": "string"
              },
              "intervalCount": {
                "type": "integer"
              }
            }
          },
          "options": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "interval": {
                  "type": "string"
                },
                "intervalCount": {
                  "type": "integer"
                },
                "lines": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "lineId": {
                        "type": "string"
                      },
                      "from": {
                        "type": "object",
                        "properties": {
                          "sellingPlanName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "price": {
                            "oneOf": [
                              {
                                "$ref": "#/components/schemas/Money"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "sellingPlanName",
                          "price"
                        ]
                      },
                      "to": {
                        "type": "object",
                        "properties": {
                          "sellingPlanName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "price": {
                            "oneOf": [
                              {
                                "$ref": "#/components/schemas/Money"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "sellingPlanName",
                          "price"
                        ]
                      }
                    },
                    "required": [
                      "lineId",
                      "from",
                      "to"
                    ]
                  }
                },
                "subtotal": {
                  "type": "object",
                  "properties": {
                    "from": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/Money"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "to": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/Money"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "from",
                    "to"
                  ]
                },
                "priceChanged": {
                  "type": "boolean"
                }
              },
              "required": [
                "interval",
                "intervalCount",
                "lines",
                "subtotal",
                "priceChanged"
              ]
            }
          },
          "revisionId": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "allowed",
          "reason",
          "current",
          "options",
          "revisionId"
        ]
      },
      "ActivityEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The same id a webhook for this event will carry; dedupe on it."
          },
          "topic": {
            "type": "string",
            "description": "See `x-topics`."
          },
          "occurredAt": {
            "type": "string",
            "format": "date-time"
          },
          "subscription": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Ref"
              },
              {
                "type": "null"
              }
            ]
          },
          "customer": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Ref"
              },
              {
                "type": "null"
              }
            ]
          },
          "actor": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "customer",
                  "merchant",
                  "api",
                  "system"
                ]
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The API key's name, for `api`."
              }
            },
            "required": [
              "kind"
            ]
          },
          "details": {
            "type": "object",
            "description": "The event's own data, per topic (`x-topics`). Fields may be added.",
            "additionalProperties": true
          }
        },
        "required": [
          "id",
          "topic",
          "occurredAt",
          "subscription",
          "customer",
          "actor",
          "details"
        ]
      },
      "Order": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "gid": {
            "type": "string"
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "kind": {
            "type": "string",
            "enum": [
              "firstOrder",
              "renewal"
            ]
          },
          "createdAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "cancelledAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "financialStatus": {
            "type": [
              "string",
              "null"
            ]
          },
          "fulfillmentStatus": {
            "type": [
              "string",
              "null"
            ]
          },
          "total": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Money"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "gid",
          "name",
          "kind",
          "createdAt",
          "cancelledAt",
          "financialStatus",
          "fulfillmentStatus",
          "total"
        ]
      },
      "CancellationAttempt": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "actor": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "customer",
                  "merchant",
                  "api"
                ]
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "kind"
            ]
          },
          "startedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "completedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "outcome": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "cancelled",
              "scheduled",
              "saved",
              "withdrawn",
              null
            ],
            "description": "Null while in the flow, or when the customer left it."
          },
          "when": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "immediate",
              "endOfCycle",
              "split",
              null
            ]
          },
          "effectiveAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "followUp": {
            "type": [
              "string",
              "null"
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "offer": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "kind": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "outcome": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "accepted",
                  "declined",
                  null
                ]
              },
              "discountPercent": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "orders": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "delayDays": {
                "type": [
                  "integer",
                  "null"
                ]
              }
            }
          }
        },
        "required": [
          "id",
          "actor",
          "startedAt",
          "completedAt",
          "outcome",
          "when",
          "effectiveAt",
          "reason",
          "followUp",
          "note",
          "offer"
        ]
      },
      "BillingRun": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "subscription": {
            "$ref": "#/components/schemas/Ref"
          },
          "dueAt": {
            "type": "string",
            "format": "date-time"
          },
          "state": {
            "type": "string",
            "enum": [
              "SUCCEEDED",
              "FAILED",
              "ACTION_REQUIRED",
              "PENDING",
              "RETRYING",
              "CANCELLED",
              "WITHDRAWN"
            ]
          },
          "attempts": {
            "type": "integer"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "settledAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "order": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "gid": {
                "type": "string"
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "amount": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Money"
              },
              {
                "type": "null"
              }
            ]
          },
          "error": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "code": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "message": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        },
        "required": [
          "id",
          "subscription",
          "dueAt",
          "state",
          "attempts",
          "createdAt",
          "settledAt",
          "order",
          "amount",
          "error"
        ],
        "description": "One charge we made or tried."
      },
      "ActivityList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ActivityEvent"
            }
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "OrderList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Order"
            }
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "BillingRunList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BillingRun"
            }
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "CancellationAttemptList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CancellationAttempt"
            }
          }
        },
        "required": [
          "data"
        ]
      }
    },
    "responses": {
      "Unauthenticated": {
        "description": "No key, a malformed one, a revoked one, or one from the other environment. Codes: `missing_api_key`, `invalid_api_key`, `wrong_environment`.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden": {
        "description": "`insufficient_scope` (with `requiredScope`), or `api_access_suspended`.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "PlanRequired": {
        "description": "`app_plan_required`: the store has no Vanix plan. `planSelectionUrl` is where to choose one.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "RateLimited": {
        "description": "`rate_limited`, with `scope` (`shop` or `key`) and `retryAfter`.",
        "headers": {
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "BadRequest": {
        "description": "`invalid_request`, `invalid_id`, `invalid_pagination`, `invalid_status` and the other 400 codes in `x-error-codes`, with `param` naming the field.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "NotFound": {
        "description": "`subscription_not_found`, `customer_not_found` or `not_found`.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Upstream": {
        "description": "`shopify_error`, `shopify_throttled`, `shopify_unavailable`, `shopify_timeout`, `shopify_connection_lost`. Retry after `Retry-After` when it is sent.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Conflict": {
        "description": "`revision_conflict` (with `currentRevisionId`), `request_in_progress`, and the state conflicts in `x-error-codes`.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Unprocessable": {
        "description": "The change cannot be made as asked; `code` says why. See `x-error-codes`.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "parameters": {
      "Limit": {
        "name": "limit",
        "in": "query",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100,
          "default": 25
        }
      },
      "Cursor": {
        "name": "cursor",
        "in": "query",
        "description": "`nextCursor` from the previous page.",
        "schema": {
          "type": "string"
        }
      },
      "SubscriptionId": {
        "name": "id",
        "in": "path",
        "required": true,
        "description": "The numeric id or the gid.",
        "schema": {
          "type": "string"
        }
      },
      "CustomerId": {
        "name": "id",
        "in": "path",
        "required": true,
        "description": "The numeric id or the gid.",
        "schema": {
          "type": "string"
        }
      },
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "description": "Any string up to 255 characters. A repeat within 24 hours gets the first answer back, with `Idempotent-Replayed: true`. Use one on ship-now and add above all.",
        "schema": {
          "type": "string"
        }
      }
    },
    "x-error-codes": {
      "missing_api_key": {
        "status": 401,
        "description": "No `Authorization: Bearer` header, or not a key.",
        "common": true
      },
      "invalid_api_key": {
        "status": 401,
        "description": "Not a key we know, or one that has been revoked.",
        "common": true
      },
      "wrong_environment": {
        "status": 401,
        "description": "A `vx_test_` key on the live API, or the reverse.",
        "common": true
      },
      "key_in_query": {
        "status": 400,
        "description": "A key in the URL. Send it in the header only; URLs are logged.",
        "common": true
      },
      "insufficient_scope": {
        "status": 403,
        "description": "The key lacks the scope this needs; `requiredScope` names it."
      },
      "api_access_suspended": {
        "status": 403,
        "description": "API access for the store is paused by us. Contact hello@vanixcommerce.com.",
        "common": true
      },
      "app_plan_required": {
        "status": 402,
        "description": "The store has no Vanix plan; `planSelectionUrl` is where to choose one.",
        "common": true
      },
      "app_plan_ended": {
        "status": 403,
        "description": "The store's plan has ended. Reads work; changes other than cancel, pause, sync and previews are refused."
      },
      "app_plan_locked": {
        "status": 403,
        "description": "The store is over its plan's limit past the grace period. Reads work; changes other than cancel, pause, sync and previews are refused."
      },
      "rate_limited": {
        "status": 429,
        "description": "Too many requests; `scope` says whether the store or this key is over, and `Retry-After` when to try again.",
        "common": true
      },
      "invalid_json": {
        "status": 400,
        "description": "The body is not valid JSON."
      },
      "body_too_large": {
        "status": 413,
        "description": "The body is too large."
      },
      "invalid_request": {
        "status": 400,
        "description": "Something in the request is wrong; `message` says what and `param` names the field when there is one."
      },
      "invalid_pagination": {
        "status": 400,
        "description": "`limit` is not 1 to 100, or `cursor` is not one this API returned."
      },
      "invalid_status": {
        "status": 400,
        "description": "`status` is not a subscription status."
      },
      "invalid_id": {
        "status": 400,
        "description": "An id that is neither a numeric id nor a gid of the right kind."
      },
      "invalid_idempotency_key": {
        "status": 400,
        "description": "`Idempotency-Key` is empty or longer than 255 characters."
      },
      "idempotency_key_reused": {
        "status": 422,
        "description": "The same `Idempotency-Key` with a different request."
      },
      "request_in_progress": {
        "status": 409,
        "description": "A request with this `Idempotency-Key` is still running."
      },
      "not_found": {
        "status": 404,
        "description": "No such endpoint, or nothing at this path.",
        "common": true
      },
      "subscription_not_found": {
        "status": 404,
        "description": "No subscription with that id in this store."
      },
      "customer_not_found": {
        "status": 404,
        "description": "No customer with that id in this store."
      },
      "line_not_found": {
        "status": 404,
        "description": "No line with that id on this subscription."
      },
      "forbidden": {
        "status": 403,
        "description": "Refused."
      },
      "conflict": {
        "status": 409,
        "description": "The request conflicts with the state of the subscription; `message` says how."
      },
      "unprocessable": {
        "status": 422,
        "description": "The request is understood but cannot be carried out; `message` says why."
      },
      "internal_error": {
        "status": 500,
        "description": "Our fault. Quote the `requestId`.",
        "common": true
      },
      "unavailable": {
        "status": 503,
        "description": "We could not check the key just now. Retry shortly.",
        "common": true
      },
      "shopify_error": {
        "status": 502,
        "description": "Shopify refused or failed the change.",
        "common": true
      },
      "shopify_throttled": {
        "status": 503,
        "description": "Shopify is throttling this store's requests. Retry after `Retry-After`.",
        "common": true
      },
      "shopify_unavailable": {
        "status": 503,
        "description": "Shopify could not be reached.",
        "common": true
      },
      "shopify_timeout": {
        "status": 504,
        "description": "Shopify took too long to answer.",
        "common": true
      },
      "shopify_connection_lost": {
        "status": 503,
        "description": "Shopify no longer accepts the app's access for this store; the merchant needs to open the app to reconnect it.",
        "common": true
      },
      "invalid_variant_id": {
        "status": 400,
        "description": "Not a product variant id."
      },
      "line_id_required": {
        "status": 400,
        "description": "The line to change is missing."
      },
      "revision_id_required": {
        "status": 400,
        "description": "This change is priced, so it needs the `revisionId` the price was given at."
      },
      "revision_conflict": {
        "status": 409,
        "description": "The subscription has changed since `revisionId`. Read it, or preview again, and retry."
      },
      "subscription_closed": {
        "status": 422,
        "description": "The subscription is cancelled or expired."
      },
      "subscription_not_active": {
        "status": 409,
        "description": "Only an active subscription can do this."
      },
      "subscription_paused": {
        "status": 422,
        "description": "The subscription is paused; resume it first."
      },
      "subscription_not_paused": {
        "status": 409,
        "description": "The subscription is not paused."
      },
      "payment_halted": {
        "status": 409,
        "description": "Payment retries have stopped; choose a new date first."
      },
      "payment_recovering": {
        "status": 409,
        "description": "A failed payment is being retried."
      },
      "cancellation_scheduled": {
        "status": 409,
        "description": "The subscription is already set to end."
      },
      "cancellation_not_scheduled": {
        "status": 409,
        "description": "The subscription is not set to end."
      },
      "invalid_when": {
        "status": 400,
        "description": "`when` must be `immediate` or `endOfCycle`."
      },
      "invalid_date": {
        "status": 400,
        "description": "Not a valid date."
      },
      "no_upcoming_order": {
        "status": 422,
        "description": "The subscription has no upcoming order."
      },
      "no_billing_interval": {
        "status": 422,
        "description": "The subscription has no billing interval to resume on."
      },
      "charge_in_progress": {
        "status": 409,
        "description": "An order for this subscription is being charged now. Retry in a minute."
      },
      "charging_disabled": {
        "status": 409,
        "description": "Charging is turned off, so nothing would be shipped."
      },
      "schedule_changed": {
        "status": 409,
        "description": "The date of the order changed. Read the subscription and retry."
      },
      "prepaid_subscription": {
        "status": 422,
        "description": "Not possible on a prepaid subscription."
      },
      "date_out_of_range": {
        "status": 422,
        "description": "The date is further ahead than allowed."
      },
      "last_line": {
        "status": 422,
        "description": "The subscription's last line cannot be removed; cancel instead."
      },
      "too_many_lines": {
        "status": 422,
        "description": "The subscription has as many lines as it can hold."
      },
      "country_required": {
        "status": 400,
        "description": "The address needs a country."
      },
      "country_not_shipped": {
        "status": 422,
        "description": "The store does not ship to that country."
      },
      "no_delivery_rates": {
        "status": 422,
        "description": "Shopify has no delivery rates for that address."
      },
      "delivery_option_unavailable": {
        "status": 409,
        "description": "The delivery option chosen is no longer offered for that address. Preview again."
      },
      "invalid_price": {
        "status": 400,
        "description": "A price is missing, negative or too large."
      },
      "invalid_quantity": {
        "status": 400,
        "description": "Quantity must be a whole number in the allowed range."
      },
      "product_unavailable": {
        "status": 422,
        "description": "The product is deleted or not active."
      },
      "same_variant": {
        "status": 422,
        "description": "That variant is already on this line."
      },
      "invalid_kind": {
        "status": 400,
        "description": "Choose whether the item renews or is for the next order only."
      },
      "invalid_frequency": {
        "status": 400,
        "description": "Not a frequency."
      },
      "same_frequency": {
        "status": 409,
        "description": "The subscription already has that frequency."
      },
      "frequency_not_offered": {
        "status": 409,
        "description": "That frequency is not offered for everything on the subscription."
      },
      "frequency_change_unavailable": {
        "status": 409,
        "description": "The frequency cannot be changed right now."
      },
      "discount_running": {
        "status": 409,
        "description": "A cancellation discount is running; change the frequency once it ends."
      },
      "too_close_to_next_order": {
        "status": 409,
        "description": "Too close to the next order."
      },
      "discount_code_required": {
        "status": 400,
        "description": "No code was sent."
      },
      "discount_code_not_found": {
        "status": 422,
        "description": "No discount with that code, or it has been deleted."
      },
      "discount_not_found": {
        "status": 404,
        "description": "No such discount on this subscription."
      },
      "discount_not_applicable": {
        "status": 422,
        "description": "The code cannot be applied to this subscription."
      },
      "discount_currency_mismatch": {
        "status": 422,
        "description": "A fixed-amount code in another currency than the subscription's."
      },
      "discount_expired": {
        "status": 422,
        "description": "The code has expired."
      },
      "discount_not_started": {
        "status": 422,
        "description": "The code has not started yet."
      },
      "discount_used_up": {
        "status": 422,
        "description": "The code has reached its usage limit."
      },
      "discount_already_applied": {
        "status": 409,
        "description": "The code is already on this subscription."
      },
      "discount_does_not_combine": {
        "status": 409,
        "description": "The code does not combine with a discount already on the subscription."
      },
      "discount_no_eligible_lines": {
        "status": 422,
        "description": "Nothing on the subscription is covered by the code."
      },
      "discount_minimum_not_met": {
        "status": 422,
        "description": "The subscription does not meet the code's minimum."
      },
      "date_in_past": {
        "status": 422,
        "description": "The new date is not in the future. To charge now, use ship-now."
      },
      "payment_update_recently_sent": {
        "status": 429,
        "description": "An update email was sent moments ago. Try again in a few minutes."
      },
      "payment_update_not_sendable": {
        "status": 422,
        "description": "The email cannot be sent: no address, a suppressed address, or a payment method Shopify cannot send a link for."
      },
      "invalid_reason": {
        "status": 400,
        "description": "reasonId or childId is not one of the store's cancellation reasons."
      },
      "not_shipped": {
        "status": 422,
        "description": "The subscription is picked up or delivered locally, so it has no shipping address to change."
      }
    },
    "x-warning-codes": {
      "out_of_stock": "The variant is out of stock.",
      "no_selling_plan": "The product has no selling plan at this frequency, so the line goes on without one.",
      "past_cutoff": "The next order may already be being prepared (`closesAt` says when the cut-off was).",
      "payment_recovering": "A failed payment is being retried; the change alters the amount retried.",
      "currency_mismatch": "The subscription is billed in another currency than the store's.",
      "customer_cannot_swap": "The customer will not be able to swap this line themselves.",
      "prepaid": "A prepaid line's price is the whole cycle's (`deliveries` says how many).",
      "customer_already_used": "The customer has used this code before.",
      "for_other_customers": "The code is set for other customers.",
      "for_customer_segments": "The code is set for customer segments.",
      "single_use_used": "The code is single-use and has been used.",
      "other_discounts": "The subscription has other discounts.",
      "not_all_lines": "The code covers only some of the lines.",
      "other": "Something new; read `message`."
    },
    "x-topics": {
      "charge.action_required": {
        "scope": "subscriptions:read",
        "description": "The customer has to act, such as a 3-D Secure check.",
        "details": "`actionStatus`"
      },
      "charge.failed": {
        "scope": "subscriptions:read",
        "description": "A charge was declined or failed.",
        "details": "`errorCode`, `errorMessage`, `amountAttempted`"
      },
      "charge.succeeded": {
        "scope": "subscriptions:read",
        "description": "A charge made an order.",
        "details": "`order`, `amount`"
      },
      "discount.deactivated": {
        "scope": "discounts:read",
        "description": "A Shopify discount code was used up and deactivated.",
        "details": "`title`, `usageLimit`"
      },
      "payment_method.revoked": {
        "scope": "subscriptions:read",
        "description": "The customer's payment method was revoked.",
        "details": "none"
      },
      "recovery.halted": {
        "scope": "subscriptions:read",
        "description": "Retries ran out. `action` is what the store's recovery settings did: `cancel`, `pause`, or null when the subscription is left as it is.",
        "details": "`reason`, `attempts`, `action`"
      },
      "recovery.recovered": {
        "scope": "subscriptions:read",
        "description": "A retried charge went through.",
        "details": "`attempts`"
      },
      "recovery.retry_scheduled": {
        "scope": "subscriptions:read",
        "description": "A failed charge will be retried.",
        "details": "`reason`, `attempt`, `of`, `retryAt`"
      },
      "subscription.activated": {
        "scope": "subscriptions:read",
        "description": "Became active other than by resuming, such as a failed subscription charged again.",
        "details": "`from`, `to`"
      },
      "subscription.address_changed": {
        "scope": "subscriptions:read",
        "description": "The delivery address changed.",
        "details": "`changed`: the fields that did"
      },
      "subscription.cancellation_scheduled": {
        "scope": "subscriptions:read",
        "description": "Set to end at the end of the paid cycle.",
        "details": "`effectiveAt`, `reason`"
      },
      "subscription.cancellation_withdrawn": {
        "scope": "subscriptions:read",
        "description": "A subscription set to end was kept.",
        "details": "`wasEndingAt`"
      },
      "subscription.cancelled": {
        "scope": "subscriptions:read",
        "description": "Cancelled through Vanix: now, or at the end of the cycle it was set to end on. A cancel by recovery, once retries run out, is `recovery.halted` with `action: \"cancel\"` instead.",
        "details": "`when`, `effectiveAt`, `reason`"
      },
      "subscription.created": {
        "scope": "subscriptions:read",
        "description": "A subscription was created, at checkout or otherwise.",
        "details": "`status`"
      },
      "subscription.discounts_changed": {
        "scope": "subscriptions:read",
        "description": "A discount started or ended.",
        "details": "`change` (offerStarted, offerEnded, codeAdded, codeEnded, codeSwapped), `code`, `reason`"
      },
      "subscription.expired": {
        "scope": "subscriptions:read",
        "description": "Reached its last cycle.",
        "details": "`from`, `to`"
      },
      "subscription.failed": {
        "scope": "subscriptions:read",
        "description": "Shopify marked it failed.",
        "details": "`from`, `to`"
      },
      "subscription.frequency_changed": {
        "scope": "subscriptions:read",
        "description": "The delivery frequency changed.",
        "details": "`from`, `to`"
      },
      "subscription.lines_changed": {
        "scope": "subscriptions:read",
        "description": "Lines changed.",
        "details": "`change`: quantities, swapped, replaced, added, removed or oneTimeRemoved"
      },
      "subscription.paused": {
        "scope": "subscriptions:read",
        "description": "Paused, by anyone.",
        "details": "`from`, `to`"
      },
      "subscription.rescheduled": {
        "scope": "subscriptions:read",
        "description": "The next charge moved: by a person, ship-now, a resume, or a charge (`reason`).",
        "details": "`from`, `to`, `reason`"
      },
      "subscription.resumed": {
        "scope": "subscriptions:read",
        "description": "Resumed from paused.",
        "details": "`from`, `to`"
      },
      "subscription.saved": {
        "scope": "subscriptions:read",
        "description": "A cancellation offer kept the customer.",
        "details": "`offerKind`"
      },
      "subscription.skipped": {
        "scope": "subscriptions:read",
        "description": "The next order was skipped.",
        "details": "`from`, `to`"
      }
    }
  },
  "paths": {
    "/shop": {
      "get": {
        "operationId": "getShop",
        "summary": "The store a key belongs to, and the key",
        "description": "The first call to make with a new key, to check it works. Needs no scope.",
        "x-scope": null,
        "x-error-codes": [],
        "responses": {
          "200": {
            "description": "The store and the key.",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Shop"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "402": {
            "$ref": "#/components/responses/PlanRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/subscriptions": {
      "get": {
        "operationId": "listSubscriptions",
        "summary": "List subscriptions",
        "description": "Most recently changed first. Lines stop at 50 per subscription here (`linesTruncated`); read one subscription for them all.",
        "x-scope": "subscriptions:read",
        "x-error-codes": [
          "invalid_id",
          "invalid_pagination",
          "invalid_status",
          "insufficient_scope"
        ],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "ACTIVE",
                "PAUSED",
                "CANCELLED",
                "EXPIRED",
                "FAILED"
              ]
            }
          },
          {
            "name": "customerId",
            "in": "query",
            "description": "One customer's subscriptions: a numeric id or gid.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "List subscriptions",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "402": {
            "$ref": "#/components/responses/PlanRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/subscriptions/{id}": {
      "get": {
        "operationId": "getSubscription",
        "summary": "One subscription",
        "description": "Always every line, read from Shopify when there are more than 50.",
        "x-scope": "subscriptions:read",
        "x-error-codes": [
          "invalid_id",
          "insufficient_scope",
          "subscription_not_found"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SubscriptionId"
          }
        ],
        "responses": {
          "200": {
            "description": "One subscription",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "subscription"
                  ],
                  "properties": {
                    "subscription": {
                      "$ref": "#/components/schemas/Subscription"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "402": {
            "$ref": "#/components/responses/PlanRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/Upstream"
          }
        }
      }
    },
    "/customers": {
      "get": {
        "operationId": "listCustomers",
        "summary": "List customers",
        "description": "Read live from Shopify, sorted by name, or by relevance with `query`.",
        "x-scope": "customers:read",
        "x-error-codes": [
          "invalid_pagination",
          "insufficient_scope"
        ],
        "parameters": [
          {
            "name": "query",
            "in": "query",
            "description": "Shopify's customer search syntax. A bare term matches name, email and phone.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "List customers",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "402": {
            "$ref": "#/components/responses/PlanRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/Upstream"
          }
        }
      }
    },
    "/customers/{id}": {
      "get": {
        "operationId": "getCustomer",
        "summary": "One customer",
        "description": "Shopify's record, with a summary of their subscriptions. The subscriptions themselves are `GET /subscriptions?customerId=`.",
        "x-scope": "customers:read",
        "x-error-codes": [
          "invalid_id",
          "invalid_request",
          "insufficient_scope",
          "customer_not_found"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/CustomerId"
          }
        ],
        "responses": {
          "200": {
            "description": "One customer",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "customer"
                  ],
                  "properties": {
                    "customer": {
                      "$ref": "#/components/schemas/CustomerDetail"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "402": {
            "$ref": "#/components/responses/PlanRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/Upstream"
          }
        }
      }
    },
    "/subscriptions/{id}/sync": {
      "post": {
        "operationId": "syncSubscription",
        "summary": "Read it again from Shopify",
        "description": "For when a change made in Shopify admin has not reached us yet.",
        "x-scope": "subscriptions:write",
        "x-open-when-locked": true,
        "x-error-codes": [
          "invalid_id",
          "invalid_idempotency_key",
          "invalid_json",
          "insufficient_scope",
          "subscription_not_found",
          "request_in_progress",
          "body_too_large",
          "idempotency_key_reused"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SubscriptionId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Read it again from Shopify",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionAnswer"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "402": {
            "$ref": "#/components/responses/PlanRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "503": {
            "$ref": "#/components/responses/Upstream"
          }
        }
      }
    },
    "/subscriptions/{id}/pause": {
      "post": {
        "operationId": "pauseSubscription",
        "summary": "Pause",
        "description": "Charges stop until it is resumed. Open while the store's plan is locked.",
        "x-scope": "subscriptions:write",
        "x-open-when-locked": true,
        "x-error-codes": [
          "invalid_id",
          "invalid_idempotency_key",
          "invalid_json",
          "invalid_request",
          "insufficient_scope",
          "subscription_not_found",
          "cancellation_scheduled",
          "request_in_progress",
          "revision_conflict",
          "subscription_not_active",
          "body_too_large",
          "idempotency_key_reused",
          "unprocessable"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SubscriptionId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Pause",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionAnswer"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "402": {
            "$ref": "#/components/responses/PlanRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "503": {
            "$ref": "#/components/responses/Upstream"
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "notifyCustomer": {
                    "type": "boolean",
                    "default": false,
                    "description": "Email the customer about the change."
                  },
                  "revisionId": {
                    "type": "string",
                    "description": "Optional. Given, the change is refused with `revision_conflict` if the subscription has moved on."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/subscriptions/{id}/resume": {
      "post": {
        "operationId": "resumeSubscription",
        "summary": "Resume",
        "description": "The next charge is one interval from now.",
        "x-scope": "subscriptions:write",
        "x-open-when-locked": false,
        "x-error-codes": [
          "invalid_id",
          "invalid_idempotency_key",
          "invalid_json",
          "invalid_request",
          "app_plan_ended",
          "app_plan_locked",
          "insufficient_scope",
          "subscription_not_found",
          "request_in_progress",
          "revision_conflict",
          "subscription_not_paused",
          "body_too_large",
          "idempotency_key_reused",
          "no_billing_interval",
          "unprocessable"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SubscriptionId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Resume",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionAnswer"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "402": {
            "$ref": "#/components/responses/PlanRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "503": {
            "$ref": "#/components/responses/Upstream"
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "notifyCustomer": {
                    "type": "boolean",
                    "default": false,
                    "description": "Email the customer about the change."
                  },
                  "revisionId": {
                    "type": "string",
                    "description": "Optional. Given, the change is refused with `revision_conflict` if the subscription has moved on."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/subscriptions/{id}/cancel": {
      "post": {
        "operationId": "cancelSubscription",
        "summary": "Cancel",
        "description": "Now, or at the end of the paid cycle (`pendingCancellation` until then). Open while the store's plan is locked.",
        "x-scope": "subscriptions:write",
        "x-open-when-locked": true,
        "x-error-codes": [
          "invalid_id",
          "invalid_idempotency_key",
          "invalid_json",
          "invalid_reason",
          "invalid_request",
          "invalid_when",
          "revision_id_required",
          "insufficient_scope",
          "subscription_not_found",
          "cancellation_scheduled",
          "request_in_progress",
          "revision_conflict",
          "body_too_large",
          "idempotency_key_reused",
          "no_delivery_rates",
          "no_upcoming_order",
          "subscription_closed",
          "unprocessable"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SubscriptionId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Cancel",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionAnswer"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "402": {
            "$ref": "#/components/responses/PlanRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "503": {
            "$ref": "#/components/responses/Upstream"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "when": {
                    "type": "string",
                    "enum": [
                      "immediate",
                      "endOfCycle"
                    ]
                  },
                  "revisionId": {
                    "type": "string",
                    "description": "The `revisionId` the preview gave. Required: a price confirmed against one version must not be charged against another."
                  },
                  "reasonId": {
                    "type": "string",
                    "description": "One of the store's cancellation reasons."
                  },
                  "childId": {
                    "type": "string"
                  },
                  "note": {
                    "type": "string"
                  },
                  "notifyCustomer": {
                    "type": "boolean",
                    "default": false,
                    "description": "Email the customer about the change."
                  }
                },
                "required": [
                  "when",
                  "revisionId"
                ]
              }
            }
          }
        }
      }
    },
    "/subscriptions/{id}/cancel/withdraw": {
      "post": {
        "operationId": "withdrawCancellation",
        "summary": "Keep a subscription set to end",
        "description": "Calls off a pending end-of-cycle cancel, whoever scheduled it.",
        "x-scope": "subscriptions:write",
        "x-open-when-locked": false,
        "x-error-codes": [
          "invalid_id",
          "invalid_idempotency_key",
          "invalid_json",
          "app_plan_ended",
          "app_plan_locked",
          "insufficient_scope",
          "subscription_not_found",
          "cancellation_not_scheduled",
          "request_in_progress",
          "revision_conflict",
          "body_too_large",
          "idempotency_key_reused",
          "subscription_closed",
          "unprocessable"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SubscriptionId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Keep a subscription set to end",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionAnswer"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "402": {
            "$ref": "#/components/responses/PlanRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "503": {
            "$ref": "#/components/responses/Upstream"
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "notifyCustomer": {
                    "type": "boolean",
                    "default": false,
                    "description": "Email the customer about the change."
                  },
                  "revisionId": {
                    "type": "string",
                    "description": "Optional. Given, the change is refused with `revision_conflict` if the subscription has moved on."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/subscriptions/{id}/reschedule": {
      "post": {
        "operationId": "rescheduleSubscription",
        "summary": "Move the next charge",
        "description": "`date` is a day in the store's time zone, charged at the time of day the subscription bills at now; `at` is an exact moment. Not in the past: to charge now, use ship-now.",
        "x-scope": "subscriptions:write",
        "x-open-when-locked": false,
        "x-error-codes": [
          "invalid_date",
          "invalid_id",
          "invalid_idempotency_key",
          "invalid_json",
          "app_plan_ended",
          "app_plan_locked",
          "insufficient_scope",
          "subscription_not_found",
          "charge_in_progress",
          "request_in_progress",
          "revision_conflict",
          "body_too_large",
          "date_in_past",
          "idempotency_key_reused",
          "subscription_closed"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SubscriptionId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Move the next charge",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionAnswer"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "402": {
            "$ref": "#/components/responses/PlanRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "503": {
            "$ref": "#/components/responses/Upstream"
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "date": {
                    "type": "string",
                    "format": "date"
                  },
                  "at": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "revisionId": {
                    "type": "string",
                    "description": "Optional. Given, the change is refused with `revision_conflict` if the subscription has moved on."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/subscriptions/{id}/skip": {
      "get": {
        "operationId": "previewSkip",
        "summary": "Where skipping would move the next charge",
        "description": "Writes nothing.",
        "x-scope": "subscriptions:read",
        "x-open-when-locked": false,
        "x-error-codes": [
          "invalid_id",
          "insufficient_scope",
          "subscription_not_found"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SubscriptionId"
          }
        ],
        "responses": {
          "200": {
            "description": "Where skipping would move the next charge",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SkipPreview"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "402": {
            "$ref": "#/components/responses/PlanRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "503": {
            "$ref": "#/components/responses/Upstream"
          }
        }
      },
      "post": {
        "operationId": "skipOrder",
        "summary": "Skip the next order",
        "description": "The next charge moves one interval on. Refused while a payment is being retried (reschedule instead) and on prepaid subscriptions.",
        "x-scope": "subscriptions:write",
        "x-open-when-locked": false,
        "x-error-codes": [
          "invalid_id",
          "invalid_idempotency_key",
          "invalid_json",
          "invalid_request",
          "app_plan_ended",
          "app_plan_locked",
          "insufficient_scope",
          "subscription_not_found",
          "cancellation_scheduled",
          "charge_in_progress",
          "payment_recovering",
          "request_in_progress",
          "revision_conflict",
          "schedule_changed",
          "body_too_large",
          "idempotency_key_reused",
          "no_upcoming_order",
          "prepaid_subscription",
          "subscription_closed",
          "subscription_paused"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SubscriptionId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Skip the next order",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionAnswer"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "402": {
            "$ref": "#/components/responses/PlanRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "503": {
            "$ref": "#/components/responses/Upstream"
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "date-time",
                    "description": "The `nextBilling.at` being skipped. Given, the skip is refused with `schedule_changed` if the date has moved."
                  },
                  "revisionId": {
                    "type": "string",
                    "description": "Optional. Given, the change is refused with `revision_conflict` if the subscription has moved on."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/subscriptions/{id}/ship-now": {
      "post": {
        "operationId": "shipNow",
        "summary": "Charge the next order now",
        "description": "Charges now and moves the schedule on from today. Send an `Idempotency-Key`.",
        "x-scope": "subscriptions:write",
        "x-open-when-locked": false,
        "x-error-codes": [
          "invalid_id",
          "invalid_idempotency_key",
          "invalid_json",
          "invalid_request",
          "app_plan_ended",
          "app_plan_locked",
          "insufficient_scope",
          "subscription_not_found",
          "cancellation_scheduled",
          "charge_in_progress",
          "charging_disabled",
          "request_in_progress",
          "revision_conflict",
          "body_too_large",
          "idempotency_key_reused",
          "no_delivery_rates",
          "subscription_closed",
          "subscription_paused",
          "unprocessable"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SubscriptionId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Charge the next order now",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionAnswer"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "402": {
            "$ref": "#/components/responses/PlanRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "503": {
            "$ref": "#/components/responses/Upstream"
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "revisionId": {
                    "type": "string",
                    "description": "Optional. Given, the change is refused with `revision_conflict` if the subscription has moved on."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/subscriptions/{id}/quantities": {
      "post": {
        "operationId": "changeQuantities",
        "summary": "Change quantities",
        "description": "Lines not listed are left alone.",
        "x-scope": "subscriptions:write",
        "x-open-when-locked": false,
        "x-error-codes": [
          "invalid_id",
          "invalid_idempotency_key",
          "invalid_json",
          "invalid_request",
          "app_plan_ended",
          "app_plan_locked",
          "insufficient_scope",
          "line_not_found",
          "subscription_not_found",
          "request_in_progress",
          "revision_conflict",
          "body_too_large",
          "idempotency_key_reused",
          "no_delivery_rates",
          "subscription_closed",
          "unprocessable"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SubscriptionId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Change quantities",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionAnswer"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "402": {
            "$ref": "#/components/responses/PlanRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "503": {
            "$ref": "#/components/responses/Upstream"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "lines": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "A line `id` from the subscription."
                        },
                        "quantity": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "id",
                        "quantity"
                      ]
                    }
                  },
                  "revisionId": {
                    "type": "string",
                    "description": "Optional. Given, the change is refused with `revision_conflict` if the subscription has moved on."
                  }
                },
                "required": [
                  "lines"
                ]
              }
            }
          }
        }
      }
    },
    "/subscriptions/{id}/swap/preview": {
      "post": {
        "operationId": "previewSwap",
        "summary": "Price a line replacement",
        "description": "Writes nothing. Open while the store's plan is locked.",
        "x-scope": "subscriptions:write",
        "x-open-when-locked": true,
        "x-error-codes": [
          "invalid_id",
          "invalid_json",
          "invalid_price",
          "invalid_quantity",
          "invalid_request",
          "invalid_variant_id",
          "insufficient_scope",
          "line_not_found",
          "subscription_not_found",
          "body_too_large",
          "product_unavailable",
          "same_variant",
          "unprocessable"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SubscriptionId"
          }
        ],
        "responses": {
          "200": {
            "description": "Price a line replacement",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SwapPreview"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "402": {
            "$ref": "#/components/responses/PlanRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "503": {
            "$ref": "#/components/responses/Upstream"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "lineId": {
                    "type": "string",
                    "description": "A line `id` from the subscription."
                  },
                  "variantId": {
                    "type": "string",
                    "description": "A product variant id or gid."
                  },
                  "price": {
                    "type": "string",
                    "description": "A decimal amount in the subscription's currency, such as \"12.50\". Leave it out to take the price the store's rules give."
                  },
                  "quantity": {
                    "type": "integer"
                  },
                  "attachPlan": {
                    "type": "boolean",
                    "description": "Put the new product on a selling plan at the subscription's frequency when it has one (the default)."
                  }
                },
                "required": [
                  "lineId",
                  "variantId"
                ]
              }
            }
          }
        }
      }
    },
    "/subscriptions/{id}/swap": {
      "post": {
        "operationId": "swapLine",
        "summary": "Replace a line",
        "description": "With the `revisionId` from the preview.",
        "x-scope": "subscriptions:write",
        "x-open-when-locked": false,
        "x-error-codes": [
          "invalid_id",
          "invalid_idempotency_key",
          "invalid_json",
          "invalid_price",
          "invalid_quantity",
          "invalid_request",
          "invalid_variant_id",
          "line_id_required",
          "revision_id_required",
          "app_plan_ended",
          "app_plan_locked",
          "insufficient_scope",
          "line_not_found",
          "subscription_not_found",
          "cancellation_scheduled",
          "request_in_progress",
          "revision_conflict",
          "body_too_large",
          "idempotency_key_reused",
          "no_delivery_rates",
          "product_unavailable",
          "same_variant",
          "subscription_closed",
          "unprocessable"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SubscriptionId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Replace a line",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionAnswer"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "402": {
            "$ref": "#/components/responses/PlanRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "503": {
            "$ref": "#/components/responses/Upstream"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "lineId": {
                    "type": "string",
                    "description": "A line `id` from the subscription."
                  },
                  "variantId": {
                    "type": "string",
                    "description": "A product variant id or gid."
                  },
                  "price": {
                    "type": "string",
                    "description": "A decimal amount in the subscription's currency, such as \"12.50\". Leave it out to take the price the store's rules give."
                  },
                  "quantity": {
                    "type": "integer"
                  },
                  "attachPlan": {
                    "type": "boolean",
                    "description": "Put the new product on a selling plan at the subscription's frequency when it has one (the default)."
                  },
                  "revisionId": {
                    "type": "string",
                    "description": "The `revisionId` the preview gave. Required: a price confirmed against one version must not be charged against another."
                  }
                },
                "required": [
                  "lineId",
                  "variantId",
                  "revisionId"
                ]
              }
            }
          }
        }
      }
    },
    "/subscriptions/{id}/add/preview": {
      "post": {
        "operationId": "previewAdd",
        "summary": "Price an added line",
        "description": "Writes nothing. Open while the store's plan is locked.",
        "x-scope": "subscriptions:write",
        "x-open-when-locked": true,
        "x-error-codes": [
          "invalid_id",
          "invalid_json",
          "invalid_kind",
          "invalid_price",
          "invalid_quantity",
          "invalid_request",
          "invalid_variant_id",
          "insufficient_scope",
          "subscription_not_found",
          "body_too_large",
          "product_unavailable",
          "too_many_lines",
          "unprocessable"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SubscriptionId"
          }
        ],
        "responses": {
          "200": {
            "description": "Price an added line",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AddPreview"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "402": {
            "$ref": "#/components/responses/PlanRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "503": {
            "$ref": "#/components/responses/Upstream"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "variantId": {
                    "type": "string",
                    "description": "A product variant id or gid."
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "recurring",
                      "oneTime"
                    ],
                    "default": "recurring",
                    "description": "`oneTime` ships with the next order only and comes off after it is charged."
                  },
                  "quantity": {
                    "type": "integer"
                  },
                  "price": {
                    "type": "string",
                    "description": "A decimal amount in the subscription's currency, such as \"12.50\". Leave it out to take the price the store's rules give."
                  },
                  "attachPlan": {
                    "type": "boolean",
                    "description": "Put the new product on a selling plan at the subscription's frequency when it has one (the default)."
                  }
                },
                "required": [
                  "variantId"
                ]
              }
            }
          }
        }
      }
    },
    "/subscriptions/{id}/add": {
      "post": {
        "operationId": "addLine",
        "summary": "Add a line",
        "description": "With the `revisionId` from the preview. Send an `Idempotency-Key`: nothing else stops a retried add adding twice.",
        "x-scope": "subscriptions:write",
        "x-open-when-locked": false,
        "x-error-codes": [
          "invalid_id",
          "invalid_idempotency_key",
          "invalid_json",
          "invalid_kind",
          "invalid_price",
          "invalid_quantity",
          "invalid_request",
          "invalid_variant_id",
          "revision_id_required",
          "app_plan_ended",
          "app_plan_locked",
          "insufficient_scope",
          "subscription_not_found",
          "cancellation_scheduled",
          "conflict",
          "request_in_progress",
          "revision_conflict",
          "body_too_large",
          "idempotency_key_reused",
          "no_delivery_rates",
          "product_unavailable",
          "subscription_closed",
          "too_many_lines",
          "unprocessable"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SubscriptionId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Add a line",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionAnswer"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "402": {
            "$ref": "#/components/responses/PlanRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "503": {
            "$ref": "#/components/responses/Upstream"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "variantId": {
                    "type": "string",
                    "description": "A product variant id or gid."
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "recurring",
                      "oneTime"
                    ],
                    "default": "recurring",
                    "description": "`oneTime` ships with the next order only and comes off after it is charged."
                  },
                  "quantity": {
                    "type": "integer"
                  },
                  "price": {
                    "type": "string",
                    "description": "A decimal amount in the subscription's currency, such as \"12.50\". Leave it out to take the price the store's rules give."
                  },
                  "attachPlan": {
                    "type": "boolean",
                    "description": "Put the new product on a selling plan at the subscription's frequency when it has one (the default)."
                  },
                  "revisionId": {
                    "type": "string",
                    "description": "The `revisionId` the preview gave. Required: a price confirmed against one version must not be charged against another."
                  }
                },
                "required": [
                  "variantId",
                  "revisionId"
                ]
              }
            }
          }
        }
      }
    },
    "/subscriptions/{id}/remove-line/preview": {
      "post": {
        "operationId": "previewRemoveLine",
        "summary": "Check a line removal",
        "description": "Writes nothing. Open while the store's plan is locked.",
        "x-scope": "subscriptions:write",
        "x-open-when-locked": true,
        "x-error-codes": [
          "invalid_id",
          "invalid_json",
          "insufficient_scope",
          "line_not_found",
          "subscription_not_found",
          "body_too_large"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SubscriptionId"
          }
        ],
        "responses": {
          "200": {
            "description": "Check a line removal",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoveLinePreview"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "402": {
            "$ref": "#/components/responses/PlanRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "503": {
            "$ref": "#/components/responses/Upstream"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "lineId": {
                    "type": "string",
                    "description": "A line `id` from the subscription."
                  }
                },
                "required": [
                  "lineId"
                ]
              }
            }
          }
        }
      }
    },
    "/subscriptions/{id}/remove-line": {
      "post": {
        "operationId": "removeLine",
        "summary": "Remove a line",
        "description": "The last renewing line is refused with `last_line`; cancel instead.",
        "x-scope": "subscriptions:write",
        "x-open-when-locked": false,
        "x-error-codes": [
          "invalid_id",
          "invalid_idempotency_key",
          "invalid_json",
          "line_id_required",
          "revision_id_required",
          "app_plan_ended",
          "app_plan_locked",
          "insufficient_scope",
          "line_not_found",
          "subscription_not_found",
          "cancellation_scheduled",
          "request_in_progress",
          "revision_conflict",
          "body_too_large",
          "idempotency_key_reused",
          "last_line",
          "no_delivery_rates",
          "subscription_closed",
          "unprocessable"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SubscriptionId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Remove a line",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionAnswer"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "402": {
            "$ref": "#/components/responses/PlanRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "503": {
            "$ref": "#/components/responses/Upstream"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "lineId": {
                    "type": "string",
                    "description": "A line `id` from the subscription."
                  },
                  "revisionId": {
                    "type": "string",
                    "description": "The `revisionId` the preview gave. Required: a price confirmed against one version must not be charged against another."
                  }
                },
                "required": [
                  "lineId",
                  "revisionId"
                ]
              }
            }
          }
        }
      }
    },
    "/subscriptions/{id}/frequency-options": {
      "get": {
        "operationId": "frequencyOptions",
        "summary": "Frequencies it can move to",
        "description": "Each priced, line by line.",
        "x-scope": "subscriptions:read",
        "x-open-when-locked": false,
        "x-error-codes": [
          "invalid_id",
          "insufficient_scope",
          "subscription_not_found"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SubscriptionId"
          }
        ],
        "responses": {
          "200": {
            "description": "Frequencies it can move to",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FrequencyOptions"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "402": {
            "$ref": "#/components/responses/PlanRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "503": {
            "$ref": "#/components/responses/Upstream"
          }
        }
      }
    },
    "/subscriptions/{id}/frequency": {
      "post": {
        "operationId": "changeFrequency",
        "summary": "Change the frequency",
        "description": "To one of `frequency-options`. The next charge date does not move; the new interval runs from it.",
        "x-scope": "subscriptions:write",
        "x-open-when-locked": false,
        "x-error-codes": [
          "invalid_frequency",
          "invalid_id",
          "invalid_idempotency_key",
          "invalid_json",
          "revision_id_required",
          "app_plan_ended",
          "app_plan_locked",
          "insufficient_scope",
          "subscription_not_found",
          "cancellation_scheduled",
          "discount_running",
          "frequency_not_offered",
          "request_in_progress",
          "revision_conflict",
          "same_frequency",
          "body_too_large",
          "idempotency_key_reused",
          "no_delivery_rates",
          "prepaid_subscription",
          "subscription_closed",
          "unprocessable"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SubscriptionId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Change the frequency",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionAnswer"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "402": {
            "$ref": "#/components/responses/PlanRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "503": {
            "$ref": "#/components/responses/Upstream"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "interval": {
                    "type": "string",
                    "enum": [
                      "DAY",
                      "WEEK",
                      "MONTH",
                      "YEAR"
                    ]
                  },
                  "intervalCount": {
                    "type": "integer"
                  },
                  "revisionId": {
                    "type": "string",
                    "description": "Optional. Given, the change is refused with `revision_conflict` if the subscription has moved on."
                  }
                },
                "required": [
                  "interval",
                  "intervalCount"
                ]
              }
            }
          }
        }
      }
    },
    "/subscriptions/{id}/address/preview": {
      "post": {
        "operationId": "previewAddress",
        "summary": "Delivery options for an address",
        "description": "The rates Shopify offers for the address. Writes nothing. Open while the store's plan is locked.",
        "x-scope": "subscriptions:write",
        "x-open-when-locked": true,
        "x-error-codes": [
          "country_required",
          "invalid_id",
          "invalid_json",
          "invalid_request",
          "insufficient_scope",
          "subscription_not_found",
          "body_too_large",
          "country_not_shipped",
          "no_delivery_rates",
          "not_shipped",
          "unprocessable"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SubscriptionId"
          }
        ],
        "responses": {
          "200": {
            "description": "Delivery options for an address",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AddressPreview"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "402": {
            "$ref": "#/components/responses/PlanRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "503": {
            "$ref": "#/components/responses/Upstream"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "address": {
                    "type": "object",
                    "description": "firstName, lastName, company, address1, address2, city, province or provinceCode, zip, countryCode, phone.",
                    "properties": {
                      "firstName": {
                        "type": "string"
                      },
                      "lastName": {
                        "type": "string"
                      },
                      "company": {
                        "type": "string"
                      },
                      "address1": {
                        "type": "string"
                      },
                      "address2": {
                        "type": "string"
                      },
                      "city": {
                        "type": "string"
                      },
                      "province": {
                        "type": "string"
                      },
                      "provinceCode": {
                        "type": "string"
                      },
                      "zip": {
                        "type": "string"
                      },
                      "countryCode": {
                        "type": "string"
                      },
                      "phone": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "countryCode"
                    ]
                  }
                },
                "required": [
                  "address"
                ]
              }
            }
          }
        }
      }
    },
    "/subscriptions/{id}/address": {
      "post": {
        "operationId": "changeAddress",
        "summary": "Change the delivery address",
        "description": "`optionCode` is one of the preview's `deliveryOptions`.",
        "x-scope": "subscriptions:write",
        "x-open-when-locked": false,
        "x-error-codes": [
          "country_required",
          "invalid_id",
          "invalid_idempotency_key",
          "invalid_json",
          "invalid_request",
          "revision_id_required",
          "app_plan_ended",
          "app_plan_locked",
          "insufficient_scope",
          "subscription_not_found",
          "delivery_option_unavailable",
          "request_in_progress",
          "revision_conflict",
          "body_too_large",
          "country_not_shipped",
          "idempotency_key_reused",
          "no_delivery_rates",
          "not_shipped",
          "subscription_closed",
          "unprocessable"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SubscriptionId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Change the delivery address",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionAnswer"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "402": {
            "$ref": "#/components/responses/PlanRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "503": {
            "$ref": "#/components/responses/Upstream"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "address": {
                    "type": "object",
                    "description": "firstName, lastName, company, address1, address2, city, province or provinceCode, zip, countryCode, phone.",
                    "properties": {
                      "firstName": {
                        "type": "string"
                      },
                      "lastName": {
                        "type": "string"
                      },
                      "company": {
                        "type": "string"
                      },
                      "address1": {
                        "type": "string"
                      },
                      "address2": {
                        "type": "string"
                      },
                      "city": {
                        "type": "string"
                      },
                      "province": {
                        "type": "string"
                      },
                      "provinceCode": {
                        "type": "string"
                      },
                      "zip": {
                        "type": "string"
                      },
                      "countryCode": {
                        "type": "string"
                      },
                      "phone": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "countryCode"
                    ]
                  },
                  "optionCode": {
                    "type": "string"
                  },
                  "revisionId": {
                    "type": "string",
                    "description": "The `revisionId` the preview gave. Required: a price confirmed against one version must not be charged against another."
                  }
                },
                "required": [
                  "address",
                  "optionCode",
                  "revisionId"
                ]
              }
            }
          }
        }
      }
    },
    "/subscriptions/{id}/discounts/preview": {
      "post": {
        "operationId": "previewDiscount",
        "summary": "Check a discount code",
        "description": "Writes nothing. Open while the store's plan is locked.",
        "x-scope": "subscriptions:write",
        "x-open-when-locked": true,
        "x-error-codes": [
          "discount_code_required",
          "invalid_id",
          "invalid_json",
          "insufficient_scope",
          "subscription_not_found",
          "discount_already_applied",
          "discount_does_not_combine",
          "body_too_large",
          "discount_code_not_found",
          "discount_currency_mismatch",
          "discount_expired",
          "discount_minimum_not_met",
          "discount_no_eligible_lines",
          "discount_not_applicable",
          "discount_not_started",
          "discount_used_up"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SubscriptionId"
          }
        ],
        "responses": {
          "200": {
            "description": "Check a discount code",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DiscountPreview"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "402": {
            "$ref": "#/components/responses/PlanRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "503": {
            "$ref": "#/components/responses/Upstream"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string"
                  }
                },
                "required": [
                  "code"
                ]
              }
            }
          }
        }
      }
    },
    "/subscriptions/{id}/discounts": {
      "post": {
        "operationId": "addDiscount",
        "summary": "Add a discount code",
        "description": "A Shopify discount code, applied as it would be at checkout.",
        "x-scope": "subscriptions:write",
        "x-open-when-locked": false,
        "x-error-codes": [
          "discount_code_required",
          "invalid_id",
          "invalid_idempotency_key",
          "invalid_json",
          "app_plan_ended",
          "app_plan_locked",
          "insufficient_scope",
          "subscription_not_found",
          "cancellation_scheduled",
          "discount_already_applied",
          "discount_does_not_combine",
          "request_in_progress",
          "revision_conflict",
          "body_too_large",
          "discount_code_not_found",
          "discount_currency_mismatch",
          "discount_expired",
          "discount_minimum_not_met",
          "discount_no_eligible_lines",
          "discount_not_applicable",
          "discount_not_started",
          "discount_used_up",
          "idempotency_key_reused",
          "subscription_closed",
          "unprocessable"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SubscriptionId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Add a discount code",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionAnswer"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "402": {
            "$ref": "#/components/responses/PlanRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "503": {
            "$ref": "#/components/responses/Upstream"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "revisionId": {
                    "type": "string",
                    "description": "The `revisionId` the preview gave. Required: a price confirmed against one version must not be charged against another."
                  }
                },
                "required": [
                  "code",
                  "revisionId"
                ]
              }
            }
          }
        }
      }
    },
    "/subscriptions/{id}/discounts/remove": {
      "post": {
        "operationId": "removeDiscount",
        "summary": "Take a discount code off",
        "description": "`discountId` is an `id` from the subscription's `discounts`. Only codes added through Vanix can be taken off here.",
        "x-scope": "subscriptions:write",
        "x-open-when-locked": false,
        "x-error-codes": [
          "invalid_id",
          "invalid_idempotency_key",
          "invalid_json",
          "invalid_request",
          "app_plan_ended",
          "app_plan_locked",
          "insufficient_scope",
          "discount_not_found",
          "subscription_not_found",
          "cancellation_scheduled",
          "request_in_progress",
          "revision_conflict",
          "body_too_large",
          "discount_code_not_found",
          "idempotency_key_reused",
          "subscription_closed",
          "unprocessable"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SubscriptionId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Take a discount code off",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionAnswer"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "402": {
            "$ref": "#/components/responses/PlanRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "503": {
            "$ref": "#/components/responses/Upstream"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "discountId": {
                    "type": "string"
                  },
                  "revisionId": {
                    "type": "string",
                    "description": "The `revisionId` the preview gave. Required: a price confirmed against one version must not be charged against another."
                  }
                },
                "required": [
                  "discountId",
                  "revisionId"
                ]
              }
            }
          }
        }
      }
    },
    "/subscriptions/{id}/payment-update-email": {
      "post": {
        "operationId": "sendPaymentUpdateEmail",
        "summary": "Email the customer a payment update link",
        "description": "Shopify's link to update the payment method. At most once every few minutes.",
        "x-scope": "subscriptions:write",
        "x-open-when-locked": false,
        "x-error-codes": [
          "invalid_id",
          "invalid_idempotency_key",
          "invalid_json",
          "app_plan_ended",
          "app_plan_locked",
          "insufficient_scope",
          "subscription_not_found",
          "request_in_progress",
          "body_too_large",
          "idempotency_key_reused",
          "payment_update_not_sendable",
          "subscription_closed",
          "payment_update_recently_sent"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SubscriptionId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Email the customer a payment update link",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionAnswer"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "402": {
            "$ref": "#/components/responses/PlanRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "503": {
            "$ref": "#/components/responses/Upstream"
          }
        }
      }
    },
    "/subscriptions/{id}/orders": {
      "get": {
        "operationId": "listSubscriptionOrders",
        "summary": "A subscription's orders",
        "description": "Newest first, read live from Shopify. At most 50 a page.",
        "x-scope": "subscriptions:read",
        "x-error-codes": [
          "invalid_id",
          "invalid_pagination",
          "insufficient_scope",
          "subscription_not_found"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SubscriptionId"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A subscription's orders",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "402": {
            "$ref": "#/components/responses/PlanRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/Upstream"
          }
        }
      }
    },
    "/subscriptions/{id}/cancellation-attempts": {
      "get": {
        "operationId": "listCancellationAttempts",
        "summary": "A subscription's cancellation attempts",
        "description": "Each time the customer opened the cancel flow, or staff or a key cancelled. Newest first, the last 20.",
        "x-scope": "subscriptions:read",
        "x-error-codes": [
          "invalid_id",
          "insufficient_scope",
          "subscription_not_found"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SubscriptionId"
          }
        ],
        "responses": {
          "200": {
            "description": "A subscription's cancellation attempts",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CancellationAttemptList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "402": {
            "$ref": "#/components/responses/PlanRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/subscriptions/{id}/activity": {
      "get": {
        "operationId": "listSubscriptionActivity",
        "summary": "A subscription's activity",
        "description": "Newest first. A page can hold fewer than `limit` and still have more: follow `nextCursor` until it is null.",
        "x-scope": "subscriptions:read",
        "x-error-codes": [
          "invalid_id",
          "invalid_pagination",
          "insufficient_scope",
          "subscription_not_found"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/SubscriptionId"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A subscription's activity",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ActivityList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "402": {
            "$ref": "#/components/responses/PlanRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/customers/{id}/activity": {
      "get": {
        "operationId": "listCustomerActivity",
        "summary": "A customer's activity",
        "description": "Across all their subscriptions, newest first.",
        "x-scope": "customers:read",
        "x-error-codes": [
          "invalid_id",
          "invalid_pagination",
          "insufficient_scope"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/CustomerId"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A customer's activity",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ActivityList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "402": {
            "$ref": "#/components/responses/PlanRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/activity": {
      "get": {
        "operationId": "listActivity",
        "summary": "The store's activity",
        "description": "Every published event, newest first.",
        "x-scope": "subscriptions:read",
        "x-error-codes": [
          "invalid_pagination",
          "insufficient_scope"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "The store's activity",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ActivityList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "402": {
            "$ref": "#/components/responses/PlanRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/billing-runs": {
      "get": {
        "operationId": "listBillingRuns",
        "summary": "Charges",
        "description": "Each charge we made or tried, newest first.",
        "x-scope": "subscriptions:read",
        "x-error-codes": [
          "invalid_id",
          "invalid_pagination",
          "insufficient_scope"
        ],
        "parameters": [
          {
            "name": "subscriptionId",
            "in": "query",
            "description": "One subscription's: an id or gid.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "Charges",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingRunList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "402": {
            "$ref": "#/components/responses/PlanRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    }
  }
}
