{
  "components": {
    "schemas": {
      "ActivityLogCriteria": {
        "properties": {
          "activityBy": {
            "$ref": "#/components/schemas/StringFilter"
          },
          "createAt": {
            "$ref": "#/components/schemas/ZonedDateTimeFilter"
          },
          "entityId": {
            "$ref": "#/components/schemas/LongFilter"
          },
          "entityType": {
            "$ref": "#/components/schemas/ActivityLogEntityTypeFilter"
          },
          "eventSource": {
            "$ref": "#/components/schemas/ActivityLogEventSourceFilter"
          },
          "eventType": {
            "$ref": "#/components/schemas/ActivityLogEventTypeFilter"
          },
          "id": {
            "$ref": "#/components/schemas/LongFilter"
          },
          "shop": {
            "$ref": "#/components/schemas/StringFilter"
          },
          "status": {
            "$ref": "#/components/schemas/ActivityLogStatusFilter"
          }
        },
        "type": "object"
      },
      "ActivityLogDTO": {
        "properties": {
          "activityBy": {
            "type": "string"
          },
          "additionalInfo": {
            "type": "string"
          },
          "clientIp": {
            "type": "string"
          },
          "createAt": {
            "format": "date-time",
            "type": "string"
          },
          "entityId": {
            "format": "int64",
            "type": "integer"
          },
          "entityType": {
            "enum": [
              "SUBSCRIPTION_BILLING_ATTEMPT",
              "SUBSCRIPTION_CONTRACT_DETAILS",
              "SUBSCRIPTION_GROUP_PLAN",
              "SHIPPING_PROFILE",
              "CANCELLATION_MANAGEMENT",
              "DUNNING_MANAGEMENT",
              "PRODUCT_SWAP",
              "FREQUENCY_SWAP",
              "EMAIL_TEMPLATE",
              "SHOP_INFO",
              "SUBSCRIPTION_WIDGET_SETTINGS",
              "CUSTOMER_PORTAL_SETTINGS",
              "SUBSCRIPTION_BUNDLING",
              "BULK_AUTOMATION",
              "PARTNER_CONNECTION",
              "SEGMENT",
              "APP_INTEGRATION",
              "JOURNEY",
              "QUICK_ACTION_LINK"
            ],
            "type": "string"
          },
          "eventSource": {
            "enum": [
              "CUSTOMER_PORTAL",
              "MERCHANT_PORTAL",
              "SHOPIFY_EVENT",
              "SYSTEM_EVENT",
              "MERCHANT_PORTAL_BULK_AUTOMATION",
              "SCHEDULED_BULK_AUTOMATION",
              "MERCHANT_EXTERNAL_API",
              "SHOPIFY_FLOW",
              "CUSTOMER_HUB"
            ],
            "type": "string"
          },
          "eventType": {
            "enum": [
              "NEXT_BILLING_DATE_CHANGE",
              "NEXT_BILLING_TIME_CHANGE",
              "BILLING_INTERVAL_CHANGE",
              "DELIVERY_INTERVAL_CHANGE",
              "BILLING_ATTEMPT_TRIGGERED",
              "BILLING_ATTEMPT_SKIPPED",
              "IMMEDIATE_ORDER_RATE_LIMIT_BLOCKED",
              "PRICING_POLICY_ESCALATION_BLOCKED",
              "BILLING_AMOUNT_ESCALATION_BLOCKED",
              "PRODUCT_ADD",
              "PRODUCT_REMOVE",
              "PRODUCT_REPLACE",
              "PRODUCT_QUANTITY_CHANGE",
              "PRODUCT_PRICE_CHANGE",
              "PRODUCT_PRICING_POLICY_CHANGE",
              "PRODUCT_SELLING_PLAN_CHANGE",
              "PRODUCT_DELETED_SYNC",
              "CONTRACT_PAUSED",
              "CONTRACT_ACTIVATED",
              "CONTRACT_ACTIVATION_DEFERRED",
              "CONTRACT_CANCELLED",
              "DELIVERY_METHOD_UPDATED",
              "SUPPORT_APD_DATA_UPDATED",
              "SUPPORT_APD_DATA_REMOVED",
              "SYSTEM_UPDATED_DELIVERY_PRICE",
              "DELIVERY_PRICE_SYNC_SKIPPED",
              "MANUAL_DELIVERY_PRICE_UPDATED",
              "DELIVERY_PRICE_OVERRIDE_CHANGED",
              "SHIPPING_ADDRESS_CHANGE",
              "SHIPPING_ADDRESS_CHANGE_SYNC",
              "SEND_GIFT_RECEIVED_EMAIL",
              "SEND_GIFT_THANK_YOU_EMAIL",
              "SEND_GIFT_PURCHASED_MERCHANT_EMAIL",
              "SEND_SUBSCRIPTION_CREATED_EMAIL",
              "SEND_TRANSACTION_FAILED_EMAIL",
              "SEND_UPCOMING_ORDER_EMAIL",
              "SEND_EXPIRING_CREDIT_CARD_EMAIL",
              "SEND_SHIPPING_ADDRESS_UPDATED_EMAIL",
              "SEND_ORDER_FREQUENCY_UPDATED_EMAIL",
              "SEND_NEXT_ORDER_DATE_UPDATED_EMAIL",
              "SEND_SUBSCRIPTION_PAUSED_EMAIL",
              "SEND_SUBSCRIPTION_CANCELED_EMAIL",
              "SEND_SUBSCRIPTION_RESUMED_EMAIL",
              "SEND_SUBSCRIPTION_PRODUCT_ADDED_EMAIL",
              "SEND_SUBSCRIPTION_PRODUCT_REMOVED_EMAIL",
              "SEND_SUBSCRIPTION_PRODUCT_REPLACED_EMAIL",
              "SEND_ORDER_SKIPPED_EMAIL",
              "ONE_TIME_PURCHASE_PRODUCT_ADDED",
              "ONE_TIME_PURCHASE_PRODUCT_REMOVED",
              "ONE_TIME_PURCHASE_PRODUCT_UPDATE",
              "SEND_SECURITY_CHALLENGE_EMAIL",
              "DISCOUNT_APPLIED",
              "DISCOUNT_REMOVED",
              "DUNNING_CANCELLED",
              "DUNNING_SKIPPED",
              "DUNNING_PAUSED",
              "DUNNING_ATTEMPT_SKIPPED",
              "BILLING_ATTEMPT_NOTIFICATION",
              "SEND_SUBSCRIPTION_MANAGEMENT_LINK",
              "PRICE_CHANGE_SYNC",
              "UPDATE_QUEUED_ATTEMPTS",
              "EMPTY_ORDER_QUEUE_HEAL_TRIGGERED",
              "WEBHOOK",
              "SPLIT_CONTRACT",
              "SWITCH_PAYMENT_METHODS",
              "PAYMENT_METHOD_UPDATED",
              "SEND_OUT_OF_STOCK_EMAIL",
              "INFORMATIONAL_EVENT",
              "BULK_EMAIL",
              "CONTRACT_CREATED",
              "INITIAL_CONTRACT_INFO",
              "ANCHOR_DAY_REMOVED",
              "UPCOMING_ORDER_UPDATED",
              "SUBSCRIPTION_CONTRACT_UPDATED",
              "BILLING_ATTEMPT_UPDATED",
              "RESCHEDULE_FULFILLMENT",
              "FULFILLMENT_REFUNDED",
              "FULFILLMENT_ORDERS_MERGED",
              "SWAP_AUTOMATION_TRIGGERED",
              "FREQUENCY_SWAP_AUTOMATION_TRIGGERED",
              "BAB_DISCOUNT_ADJUSTMENT",
              "BAB_PRODUCT_ADD",
              "BAB_PRODUCT_REMOVE",
              "BAB_QUANTITY_CHANGE",
              "STOP_UPCOMING_ORDER_EMAIL_UPDATED",
              "ORDER_TAGS_ADDED",
              "EMAIL",
              "SEND_TRANSACTION_SUCCESS_EMAIL",
              "TAGS_UPDATED",
              "SEND_PRODUCT_PRICE_UPDATED_EMAIL",
              "SUBSCRIPTION_GROUP_PLAN_UPDATE",
              "SUBSCRIPTION_GROUP_PLAN_CREATE",
              "SUBSCRIPTION_GROUP_PLAN_DELETE",
              "CREATED",
              "UPDATED",
              "SEND_SUSPENSION_EMAIL",
              "SEND_SUSPENSION_WARNING_EMAIL",
              "DELETED",
              "CURRENCY_MISMATCH_DETECTED",
              "PRICING_METHOD_APPLIED",
              "PRICING_POLICY_DISCOUNT_APPLIED",
              "PRICING_POLICY_SYNC_SKIPPED",
              "PRICING_POLICY_SYNC_FAILED",
              "PRICING_POLICY_NO_APPLICABLE_CYCLE",
              "PRICING_POLICY_REMOVED",
              "PRICING_POLICY_OVERRIDE",
              "AUTOMATIC_DISCOUNT_UPDATE",
              "BILLING_ATTEMPT_REFRESHED",
              "PRICE_CHANGE_SYNC_SKIPPED",
              "BASE_PRICE_CALCULATION",
              "LINE_DUTY_ADDED",
              "IMMEDIATE_RETRY_TRIGGERED",
              "PRICE_CHANGE_SYNC_BULK_AUTOMATION",
              "SCHEDULE_EXPIRING_CREDIT_CARD_EMAIL",
              "STARTED_BULK_AUTOMATION_PROCESSING",
              "SCHEDULED_BULK_AUTOMATION_SCHEDULED",
              "SCHEDULED_BULK_AUTOMATION_CANCELED",
              "SCHEDULED_BULK_AUTOMATION_DEFERRED",
              "SCHEDULED_BULK_AUTOMATION_STARTED",
              "SCHEDULED_BULK_AUTOMATION_COMPLETED",
              "SCHEDULED_BULK_AUTOMATION_FAILED",
              "DUPLICATE_BILLING_ATTEMPT_DETECTED",
              "AUTO_RESUME_SCHEDULED",
              "BILLING_CYCLE_PRODUCTS_SKIPPED",
              "ORDER_ATTRIBUTES_SYNCED",
              "DATE_ATTRIBUTE_MODIFIED_BEFORE_SYNC",
              "ORDER_DATE_SYNC_FAILED",
              "DELIVERY_DATE_SETTINGS_APPLIED",
              "ORPHANED_SELLING_PLAN_DETECTED",
              "BUNDLE_DISCOUNT_PERCENTAGE_ROUNDED",
              "PARTNER_CONNECTED",
              "PARTNER_DISCONNECTED",
              "PARTNER_CONNECTION_REQUESTED",
              "PARTNER_CONNECTION_APPROVED",
              "PARTNER_CONNECTION_REJECTED",
              "STORE_CREDIT_DISCOUNT_APPLIED",
              "UPDATE_STORE_CREDIT",
              "SKIP_PAYMENT_ENABLED",
              "PREPAID_DEFERRED_CANCELLATION_SCHEDULED",
              "PREPAID_DEFERRED_CANCELLATION_EXECUTED",
              "PREPAID_DEFERRED_CANCELLATION_CLEARED",
              "MIXED_PREPAID_SEPARATE_ORDERS_CONTRACT_DETECTED",
              "CURRENCY_ADJUSTMENT_RECOVERY",
              "PRICING_POLICY_SUPPRESSED_FOR_MIGRATED_CONTRACT",
              "PRICING_POLICY_SKIPPED_MIGRATED_BY_STRATEGY",
              "FEATURE_ACCESS_BLOCKED",
              "SEGMENT_CREATED",
              "SEGMENT_UPDATED",
              "SEGMENT_DELETED",
              "SEGMENT_REFRESHED",
              "CHARGE_CAP_EXEMPTION_APPLIED",
              "BUNDLE_DISCOUNT_SYNC_TRIGGERED",
              "FREE_PRODUCT_REWARD_APPLIED",
              "FREE_PRODUCT_REWARD_SYNC_FAILED",
              "BILLING_ATTEMPT_BACKFILLED"
            ],
            "type": "string"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "shop": {
            "type": "string"
          },
          "status": {
            "enum": [
              "SUCCESS",
              "FAILURE",
              "INFO",
              "SKIPPED",
              "PARTIAL_FAILURE"
            ],
            "type": "string"
          }
        },
        "type": "object"
      },
      "ActivityLogEntityTypeFilter": {
        "properties": {
          "equals": {
            "enum": [
              "SUBSCRIPTION_BILLING_ATTEMPT",
              "SUBSCRIPTION_CONTRACT_DETAILS",
              "SUBSCRIPTION_GROUP_PLAN",
              "SHIPPING_PROFILE",
              "CANCELLATION_MANAGEMENT",
              "DUNNING_MANAGEMENT",
              "PRODUCT_SWAP",
              "FREQUENCY_SWAP",
              "EMAIL_TEMPLATE",
              "SHOP_INFO",
              "SUBSCRIPTION_WIDGET_SETTINGS",
              "CUSTOMER_PORTAL_SETTINGS",
              "SUBSCRIPTION_BUNDLING",
              "BULK_AUTOMATION",
              "PARTNER_CONNECTION",
              "SEGMENT",
              "APP_INTEGRATION",
              "JOURNEY",
              "QUICK_ACTION_LINK"
            ],
            "type": "string"
          },
          "in": {
            "items": {
              "enum": [
                "SUBSCRIPTION_BILLING_ATTEMPT",
                "SUBSCRIPTION_CONTRACT_DETAILS",
                "SUBSCRIPTION_GROUP_PLAN",
                "SHIPPING_PROFILE",
                "CANCELLATION_MANAGEMENT",
                "DUNNING_MANAGEMENT",
                "PRODUCT_SWAP",
                "FREQUENCY_SWAP",
                "EMAIL_TEMPLATE",
                "SHOP_INFO",
                "SUBSCRIPTION_WIDGET_SETTINGS",
                "CUSTOMER_PORTAL_SETTINGS",
                "SUBSCRIPTION_BUNDLING",
                "BULK_AUTOMATION",
                "PARTNER_CONNECTION",
                "SEGMENT",
                "APP_INTEGRATION",
                "JOURNEY",
                "QUICK_ACTION_LINK"
              ],
              "type": "string"
            },
            "type": "array"
          },
          "notEquals": {
            "enum": [
              "SUBSCRIPTION_BILLING_ATTEMPT",
              "SUBSCRIPTION_CONTRACT_DETAILS",
              "SUBSCRIPTION_GROUP_PLAN",
              "SHIPPING_PROFILE",
              "CANCELLATION_MANAGEMENT",
              "DUNNING_MANAGEMENT",
              "PRODUCT_SWAP",
              "FREQUENCY_SWAP",
              "EMAIL_TEMPLATE",
              "SHOP_INFO",
              "SUBSCRIPTION_WIDGET_SETTINGS",
              "CUSTOMER_PORTAL_SETTINGS",
              "SUBSCRIPTION_BUNDLING",
              "BULK_AUTOMATION",
              "PARTNER_CONNECTION",
              "SEGMENT",
              "APP_INTEGRATION",
              "JOURNEY",
              "QUICK_ACTION_LINK"
            ],
            "type": "string"
          },
          "notIn": {
            "items": {
              "enum": [
                "SUBSCRIPTION_BILLING_ATTEMPT",
                "SUBSCRIPTION_CONTRACT_DETAILS",
                "SUBSCRIPTION_GROUP_PLAN",
                "SHIPPING_PROFILE",
                "CANCELLATION_MANAGEMENT",
                "DUNNING_MANAGEMENT",
                "PRODUCT_SWAP",
                "FREQUENCY_SWAP",
                "EMAIL_TEMPLATE",
                "SHOP_INFO",
                "SUBSCRIPTION_WIDGET_SETTINGS",
                "CUSTOMER_PORTAL_SETTINGS",
                "SUBSCRIPTION_BUNDLING",
                "BULK_AUTOMATION",
                "PARTNER_CONNECTION",
                "SEGMENT",
                "APP_INTEGRATION",
                "JOURNEY",
                "QUICK_ACTION_LINK"
              ],
              "type": "string"
            },
            "type": "array"
          },
          "specified": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "ActivityLogEventSourceFilter": {
        "properties": {
          "equals": {
            "enum": [
              "CUSTOMER_PORTAL",
              "MERCHANT_PORTAL",
              "SHOPIFY_EVENT",
              "SYSTEM_EVENT",
              "MERCHANT_PORTAL_BULK_AUTOMATION",
              "SCHEDULED_BULK_AUTOMATION",
              "MERCHANT_EXTERNAL_API",
              "SHOPIFY_FLOW",
              "CUSTOMER_HUB"
            ],
            "type": "string"
          },
          "in": {
            "items": {
              "enum": [
                "CUSTOMER_PORTAL",
                "MERCHANT_PORTAL",
                "SHOPIFY_EVENT",
                "SYSTEM_EVENT",
                "MERCHANT_PORTAL_BULK_AUTOMATION",
                "SCHEDULED_BULK_AUTOMATION",
                "MERCHANT_EXTERNAL_API",
                "SHOPIFY_FLOW",
                "CUSTOMER_HUB"
              ],
              "type": "string"
            },
            "type": "array"
          },
          "notEquals": {
            "enum": [
              "CUSTOMER_PORTAL",
              "MERCHANT_PORTAL",
              "SHOPIFY_EVENT",
              "SYSTEM_EVENT",
              "MERCHANT_PORTAL_BULK_AUTOMATION",
              "SCHEDULED_BULK_AUTOMATION",
              "MERCHANT_EXTERNAL_API",
              "SHOPIFY_FLOW",
              "CUSTOMER_HUB"
            ],
            "type": "string"
          },
          "notIn": {
            "items": {
              "enum": [
                "CUSTOMER_PORTAL",
                "MERCHANT_PORTAL",
                "SHOPIFY_EVENT",
                "SYSTEM_EVENT",
                "MERCHANT_PORTAL_BULK_AUTOMATION",
                "SCHEDULED_BULK_AUTOMATION",
                "MERCHANT_EXTERNAL_API",
                "SHOPIFY_FLOW",
                "CUSTOMER_HUB"
              ],
              "type": "string"
            },
            "type": "array"
          },
          "specified": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "ActivityLogEventTypeFilter": {
        "properties": {
          "equals": {
            "enum": [
              "NEXT_BILLING_DATE_CHANGE",
              "NEXT_BILLING_TIME_CHANGE",
              "BILLING_INTERVAL_CHANGE",
              "DELIVERY_INTERVAL_CHANGE",
              "BILLING_ATTEMPT_TRIGGERED",
              "BILLING_ATTEMPT_SKIPPED",
              "IMMEDIATE_ORDER_RATE_LIMIT_BLOCKED",
              "PRICING_POLICY_ESCALATION_BLOCKED",
              "BILLING_AMOUNT_ESCALATION_BLOCKED",
              "PRODUCT_ADD",
              "PRODUCT_REMOVE",
              "PRODUCT_REPLACE",
              "PRODUCT_QUANTITY_CHANGE",
              "PRODUCT_PRICE_CHANGE",
              "PRODUCT_PRICING_POLICY_CHANGE",
              "PRODUCT_SELLING_PLAN_CHANGE",
              "PRODUCT_DELETED_SYNC",
              "CONTRACT_PAUSED",
              "CONTRACT_ACTIVATED",
              "CONTRACT_ACTIVATION_DEFERRED",
              "CONTRACT_CANCELLED",
              "DELIVERY_METHOD_UPDATED",
              "SUPPORT_APD_DATA_UPDATED",
              "SUPPORT_APD_DATA_REMOVED",
              "SYSTEM_UPDATED_DELIVERY_PRICE",
              "DELIVERY_PRICE_SYNC_SKIPPED",
              "MANUAL_DELIVERY_PRICE_UPDATED",
              "DELIVERY_PRICE_OVERRIDE_CHANGED",
              "SHIPPING_ADDRESS_CHANGE",
              "SHIPPING_ADDRESS_CHANGE_SYNC",
              "SEND_GIFT_RECEIVED_EMAIL",
              "SEND_GIFT_THANK_YOU_EMAIL",
              "SEND_GIFT_PURCHASED_MERCHANT_EMAIL",
              "SEND_SUBSCRIPTION_CREATED_EMAIL",
              "SEND_TRANSACTION_FAILED_EMAIL",
              "SEND_UPCOMING_ORDER_EMAIL",
              "SEND_EXPIRING_CREDIT_CARD_EMAIL",
              "SEND_SHIPPING_ADDRESS_UPDATED_EMAIL",
              "SEND_ORDER_FREQUENCY_UPDATED_EMAIL",
              "SEND_NEXT_ORDER_DATE_UPDATED_EMAIL",
              "SEND_SUBSCRIPTION_PAUSED_EMAIL",
              "SEND_SUBSCRIPTION_CANCELED_EMAIL",
              "SEND_SUBSCRIPTION_RESUMED_EMAIL",
              "SEND_SUBSCRIPTION_PRODUCT_ADDED_EMAIL",
              "SEND_SUBSCRIPTION_PRODUCT_REMOVED_EMAIL",
              "SEND_SUBSCRIPTION_PRODUCT_REPLACED_EMAIL",
              "SEND_ORDER_SKIPPED_EMAIL",
              "ONE_TIME_PURCHASE_PRODUCT_ADDED",
              "ONE_TIME_PURCHASE_PRODUCT_REMOVED",
              "ONE_TIME_PURCHASE_PRODUCT_UPDATE",
              "SEND_SECURITY_CHALLENGE_EMAIL",
              "DISCOUNT_APPLIED",
              "DISCOUNT_REMOVED",
              "DUNNING_CANCELLED",
              "DUNNING_SKIPPED",
              "DUNNING_PAUSED",
              "DUNNING_ATTEMPT_SKIPPED",
              "BILLING_ATTEMPT_NOTIFICATION",
              "SEND_SUBSCRIPTION_MANAGEMENT_LINK",
              "PRICE_CHANGE_SYNC",
              "UPDATE_QUEUED_ATTEMPTS",
              "EMPTY_ORDER_QUEUE_HEAL_TRIGGERED",
              "WEBHOOK",
              "SPLIT_CONTRACT",
              "SWITCH_PAYMENT_METHODS",
              "PAYMENT_METHOD_UPDATED",
              "SEND_OUT_OF_STOCK_EMAIL",
              "INFORMATIONAL_EVENT",
              "BULK_EMAIL",
              "CONTRACT_CREATED",
              "INITIAL_CONTRACT_INFO",
              "ANCHOR_DAY_REMOVED",
              "UPCOMING_ORDER_UPDATED",
              "SUBSCRIPTION_CONTRACT_UPDATED",
              "BILLING_ATTEMPT_UPDATED",
              "RESCHEDULE_FULFILLMENT",
              "FULFILLMENT_REFUNDED",
              "FULFILLMENT_ORDERS_MERGED",
              "SWAP_AUTOMATION_TRIGGERED",
              "FREQUENCY_SWAP_AUTOMATION_TRIGGERED",
              "BAB_DISCOUNT_ADJUSTMENT",
              "BAB_PRODUCT_ADD",
              "BAB_PRODUCT_REMOVE",
              "BAB_QUANTITY_CHANGE",
              "STOP_UPCOMING_ORDER_EMAIL_UPDATED",
              "ORDER_TAGS_ADDED",
              "EMAIL",
              "SEND_TRANSACTION_SUCCESS_EMAIL",
              "TAGS_UPDATED",
              "SEND_PRODUCT_PRICE_UPDATED_EMAIL",
              "SUBSCRIPTION_GROUP_PLAN_UPDATE",
              "SUBSCRIPTION_GROUP_PLAN_CREATE",
              "SUBSCRIPTION_GROUP_PLAN_DELETE",
              "CREATED",
              "UPDATED",
              "SEND_SUSPENSION_EMAIL",
              "SEND_SUSPENSION_WARNING_EMAIL",
              "DELETED",
              "CURRENCY_MISMATCH_DETECTED",
              "PRICING_METHOD_APPLIED",
              "PRICING_POLICY_DISCOUNT_APPLIED",
              "PRICING_POLICY_SYNC_SKIPPED",
              "PRICING_POLICY_SYNC_FAILED",
              "PRICING_POLICY_NO_APPLICABLE_CYCLE",
              "PRICING_POLICY_REMOVED",
              "PRICING_POLICY_OVERRIDE",
              "AUTOMATIC_DISCOUNT_UPDATE",
              "BILLING_ATTEMPT_REFRESHED",
              "PRICE_CHANGE_SYNC_SKIPPED",
              "BASE_PRICE_CALCULATION",
              "LINE_DUTY_ADDED",
              "IMMEDIATE_RETRY_TRIGGERED",
              "PRICE_CHANGE_SYNC_BULK_AUTOMATION",
              "SCHEDULE_EXPIRING_CREDIT_CARD_EMAIL",
              "STARTED_BULK_AUTOMATION_PROCESSING",
              "SCHEDULED_BULK_AUTOMATION_SCHEDULED",
              "SCHEDULED_BULK_AUTOMATION_CANCELED",
              "SCHEDULED_BULK_AUTOMATION_DEFERRED",
              "SCHEDULED_BULK_AUTOMATION_STARTED",
              "SCHEDULED_BULK_AUTOMATION_COMPLETED",
              "SCHEDULED_BULK_AUTOMATION_FAILED",
              "DUPLICATE_BILLING_ATTEMPT_DETECTED",
              "AUTO_RESUME_SCHEDULED",
              "BILLING_CYCLE_PRODUCTS_SKIPPED",
              "ORDER_ATTRIBUTES_SYNCED",
              "DATE_ATTRIBUTE_MODIFIED_BEFORE_SYNC",
              "ORDER_DATE_SYNC_FAILED",
              "DELIVERY_DATE_SETTINGS_APPLIED",
              "ORPHANED_SELLING_PLAN_DETECTED",
              "BUNDLE_DISCOUNT_PERCENTAGE_ROUNDED",
              "PARTNER_CONNECTED",
              "PARTNER_DISCONNECTED",
              "PARTNER_CONNECTION_REQUESTED",
              "PARTNER_CONNECTION_APPROVED",
              "PARTNER_CONNECTION_REJECTED",
              "STORE_CREDIT_DISCOUNT_APPLIED",
              "UPDATE_STORE_CREDIT",
              "SKIP_PAYMENT_ENABLED",
              "PREPAID_DEFERRED_CANCELLATION_SCHEDULED",
              "PREPAID_DEFERRED_CANCELLATION_EXECUTED",
              "PREPAID_DEFERRED_CANCELLATION_CLEARED",
              "MIXED_PREPAID_SEPARATE_ORDERS_CONTRACT_DETECTED",
              "CURRENCY_ADJUSTMENT_RECOVERY",
              "PRICING_POLICY_SUPPRESSED_FOR_MIGRATED_CONTRACT",
              "PRICING_POLICY_SKIPPED_MIGRATED_BY_STRATEGY",
              "FEATURE_ACCESS_BLOCKED",
              "SEGMENT_CREATED",
              "SEGMENT_UPDATED",
              "SEGMENT_DELETED",
              "SEGMENT_REFRESHED",
              "CHARGE_CAP_EXEMPTION_APPLIED",
              "BUNDLE_DISCOUNT_SYNC_TRIGGERED",
              "FREE_PRODUCT_REWARD_APPLIED",
              "FREE_PRODUCT_REWARD_SYNC_FAILED",
              "BILLING_ATTEMPT_BACKFILLED"
            ],
            "type": "string"
          },
          "in": {
            "items": {
              "enum": [
                "NEXT_BILLING_DATE_CHANGE",
                "NEXT_BILLING_TIME_CHANGE",
                "BILLING_INTERVAL_CHANGE",
                "DELIVERY_INTERVAL_CHANGE",
                "BILLING_ATTEMPT_TRIGGERED",
                "BILLING_ATTEMPT_SKIPPED",
                "IMMEDIATE_ORDER_RATE_LIMIT_BLOCKED",
                "PRICING_POLICY_ESCALATION_BLOCKED",
                "BILLING_AMOUNT_ESCALATION_BLOCKED",
                "PRODUCT_ADD",
                "PRODUCT_REMOVE",
                "PRODUCT_REPLACE",
                "PRODUCT_QUANTITY_CHANGE",
                "PRODUCT_PRICE_CHANGE",
                "PRODUCT_PRICING_POLICY_CHANGE",
                "PRODUCT_SELLING_PLAN_CHANGE",
                "PRODUCT_DELETED_SYNC",
                "CONTRACT_PAUSED",
                "CONTRACT_ACTIVATED",
                "CONTRACT_ACTIVATION_DEFERRED",
                "CONTRACT_CANCELLED",
                "DELIVERY_METHOD_UPDATED",
                "SUPPORT_APD_DATA_UPDATED",
                "SUPPORT_APD_DATA_REMOVED",
                "SYSTEM_UPDATED_DELIVERY_PRICE",
                "DELIVERY_PRICE_SYNC_SKIPPED",
                "MANUAL_DELIVERY_PRICE_UPDATED",
                "DELIVERY_PRICE_OVERRIDE_CHANGED",
                "SHIPPING_ADDRESS_CHANGE",
                "SHIPPING_ADDRESS_CHANGE_SYNC",
                "SEND_GIFT_RECEIVED_EMAIL",
                "SEND_GIFT_THANK_YOU_EMAIL",
                "SEND_GIFT_PURCHASED_MERCHANT_EMAIL",
                "SEND_SUBSCRIPTION_CREATED_EMAIL",
                "SEND_TRANSACTION_FAILED_EMAIL",
                "SEND_UPCOMING_ORDER_EMAIL",
                "SEND_EXPIRING_CREDIT_CARD_EMAIL",
                "SEND_SHIPPING_ADDRESS_UPDATED_EMAIL",
                "SEND_ORDER_FREQUENCY_UPDATED_EMAIL",
                "SEND_NEXT_ORDER_DATE_UPDATED_EMAIL",
                "SEND_SUBSCRIPTION_PAUSED_EMAIL",
                "SEND_SUBSCRIPTION_CANCELED_EMAIL",
                "SEND_SUBSCRIPTION_RESUMED_EMAIL",
                "SEND_SUBSCRIPTION_PRODUCT_ADDED_EMAIL",
                "SEND_SUBSCRIPTION_PRODUCT_REMOVED_EMAIL",
                "SEND_SUBSCRIPTION_PRODUCT_REPLACED_EMAIL",
                "SEND_ORDER_SKIPPED_EMAIL",
                "ONE_TIME_PURCHASE_PRODUCT_ADDED",
                "ONE_TIME_PURCHASE_PRODUCT_REMOVED",
                "ONE_TIME_PURCHASE_PRODUCT_UPDATE",
                "SEND_SECURITY_CHALLENGE_EMAIL",
                "DISCOUNT_APPLIED",
                "DISCOUNT_REMOVED",
                "DUNNING_CANCELLED",
                "DUNNING_SKIPPED",
                "DUNNING_PAUSED",
                "DUNNING_ATTEMPT_SKIPPED",
                "BILLING_ATTEMPT_NOTIFICATION",
                "SEND_SUBSCRIPTION_MANAGEMENT_LINK",
                "PRICE_CHANGE_SYNC",
                "UPDATE_QUEUED_ATTEMPTS",
                "EMPTY_ORDER_QUEUE_HEAL_TRIGGERED",
                "WEBHOOK",
                "SPLIT_CONTRACT",
                "SWITCH_PAYMENT_METHODS",
                "PAYMENT_METHOD_UPDATED",
                "SEND_OUT_OF_STOCK_EMAIL",
                "INFORMATIONAL_EVENT",
                "BULK_EMAIL",
                "CONTRACT_CREATED",
                "INITIAL_CONTRACT_INFO",
                "ANCHOR_DAY_REMOVED",
                "UPCOMING_ORDER_UPDATED",
                "SUBSCRIPTION_CONTRACT_UPDATED",
                "BILLING_ATTEMPT_UPDATED",
                "RESCHEDULE_FULFILLMENT",
                "FULFILLMENT_REFUNDED",
                "FULFILLMENT_ORDERS_MERGED",
                "SWAP_AUTOMATION_TRIGGERED",
                "FREQUENCY_SWAP_AUTOMATION_TRIGGERED",
                "BAB_DISCOUNT_ADJUSTMENT",
                "BAB_PRODUCT_ADD",
                "BAB_PRODUCT_REMOVE",
                "BAB_QUANTITY_CHANGE",
                "STOP_UPCOMING_ORDER_EMAIL_UPDATED",
                "ORDER_TAGS_ADDED",
                "EMAIL",
                "SEND_TRANSACTION_SUCCESS_EMAIL",
                "TAGS_UPDATED",
                "SEND_PRODUCT_PRICE_UPDATED_EMAIL",
                "SUBSCRIPTION_GROUP_PLAN_UPDATE",
                "SUBSCRIPTION_GROUP_PLAN_CREATE",
                "SUBSCRIPTION_GROUP_PLAN_DELETE",
                "CREATED",
                "UPDATED",
                "SEND_SUSPENSION_EMAIL",
                "SEND_SUSPENSION_WARNING_EMAIL",
                "DELETED",
                "CURRENCY_MISMATCH_DETECTED",
                "PRICING_METHOD_APPLIED",
                "PRICING_POLICY_DISCOUNT_APPLIED",
                "PRICING_POLICY_SYNC_SKIPPED",
                "PRICING_POLICY_SYNC_FAILED",
                "PRICING_POLICY_NO_APPLICABLE_CYCLE",
                "PRICING_POLICY_REMOVED",
                "PRICING_POLICY_OVERRIDE",
                "AUTOMATIC_DISCOUNT_UPDATE",
                "BILLING_ATTEMPT_REFRESHED",
                "PRICE_CHANGE_SYNC_SKIPPED",
                "BASE_PRICE_CALCULATION",
                "LINE_DUTY_ADDED",
                "IMMEDIATE_RETRY_TRIGGERED",
                "PRICE_CHANGE_SYNC_BULK_AUTOMATION",
                "SCHEDULE_EXPIRING_CREDIT_CARD_EMAIL",
                "STARTED_BULK_AUTOMATION_PROCESSING",
                "SCHEDULED_BULK_AUTOMATION_SCHEDULED",
                "SCHEDULED_BULK_AUTOMATION_CANCELED",
                "SCHEDULED_BULK_AUTOMATION_DEFERRED",
                "SCHEDULED_BULK_AUTOMATION_STARTED",
                "SCHEDULED_BULK_AUTOMATION_COMPLETED",
                "SCHEDULED_BULK_AUTOMATION_FAILED",
                "DUPLICATE_BILLING_ATTEMPT_DETECTED",
                "AUTO_RESUME_SCHEDULED",
                "BILLING_CYCLE_PRODUCTS_SKIPPED",
                "ORDER_ATTRIBUTES_SYNCED",
                "DATE_ATTRIBUTE_MODIFIED_BEFORE_SYNC",
                "ORDER_DATE_SYNC_FAILED",
                "DELIVERY_DATE_SETTINGS_APPLIED",
                "ORPHANED_SELLING_PLAN_DETECTED",
                "BUNDLE_DISCOUNT_PERCENTAGE_ROUNDED",
                "PARTNER_CONNECTED",
                "PARTNER_DISCONNECTED",
                "PARTNER_CONNECTION_REQUESTED",
                "PARTNER_CONNECTION_APPROVED",
                "PARTNER_CONNECTION_REJECTED",
                "STORE_CREDIT_DISCOUNT_APPLIED",
                "UPDATE_STORE_CREDIT",
                "SKIP_PAYMENT_ENABLED",
                "PREPAID_DEFERRED_CANCELLATION_SCHEDULED",
                "PREPAID_DEFERRED_CANCELLATION_EXECUTED",
                "PREPAID_DEFERRED_CANCELLATION_CLEARED",
                "MIXED_PREPAID_SEPARATE_ORDERS_CONTRACT_DETECTED",
                "CURRENCY_ADJUSTMENT_RECOVERY",
                "PRICING_POLICY_SUPPRESSED_FOR_MIGRATED_CONTRACT",
                "PRICING_POLICY_SKIPPED_MIGRATED_BY_STRATEGY",
                "FEATURE_ACCESS_BLOCKED",
                "SEGMENT_CREATED",
                "SEGMENT_UPDATED",
                "SEGMENT_DELETED",
                "SEGMENT_REFRESHED",
                "CHARGE_CAP_EXEMPTION_APPLIED",
                "BUNDLE_DISCOUNT_SYNC_TRIGGERED",
                "FREE_PRODUCT_REWARD_APPLIED",
                "FREE_PRODUCT_REWARD_SYNC_FAILED",
                "BILLING_ATTEMPT_BACKFILLED"
              ],
              "type": "string"
            },
            "type": "array"
          },
          "notEquals": {
            "enum": [
              "NEXT_BILLING_DATE_CHANGE",
              "NEXT_BILLING_TIME_CHANGE",
              "BILLING_INTERVAL_CHANGE",
              "DELIVERY_INTERVAL_CHANGE",
              "BILLING_ATTEMPT_TRIGGERED",
              "BILLING_ATTEMPT_SKIPPED",
              "IMMEDIATE_ORDER_RATE_LIMIT_BLOCKED",
              "PRICING_POLICY_ESCALATION_BLOCKED",
              "BILLING_AMOUNT_ESCALATION_BLOCKED",
              "PRODUCT_ADD",
              "PRODUCT_REMOVE",
              "PRODUCT_REPLACE",
              "PRODUCT_QUANTITY_CHANGE",
              "PRODUCT_PRICE_CHANGE",
              "PRODUCT_PRICING_POLICY_CHANGE",
              "PRODUCT_SELLING_PLAN_CHANGE",
              "PRODUCT_DELETED_SYNC",
              "CONTRACT_PAUSED",
              "CONTRACT_ACTIVATED",
              "CONTRACT_ACTIVATION_DEFERRED",
              "CONTRACT_CANCELLED",
              "DELIVERY_METHOD_UPDATED",
              "SUPPORT_APD_DATA_UPDATED",
              "SUPPORT_APD_DATA_REMOVED",
              "SYSTEM_UPDATED_DELIVERY_PRICE",
              "DELIVERY_PRICE_SYNC_SKIPPED",
              "MANUAL_DELIVERY_PRICE_UPDATED",
              "DELIVERY_PRICE_OVERRIDE_CHANGED",
              "SHIPPING_ADDRESS_CHANGE",
              "SHIPPING_ADDRESS_CHANGE_SYNC",
              "SEND_GIFT_RECEIVED_EMAIL",
              "SEND_GIFT_THANK_YOU_EMAIL",
              "SEND_GIFT_PURCHASED_MERCHANT_EMAIL",
              "SEND_SUBSCRIPTION_CREATED_EMAIL",
              "SEND_TRANSACTION_FAILED_EMAIL",
              "SEND_UPCOMING_ORDER_EMAIL",
              "SEND_EXPIRING_CREDIT_CARD_EMAIL",
              "SEND_SHIPPING_ADDRESS_UPDATED_EMAIL",
              "SEND_ORDER_FREQUENCY_UPDATED_EMAIL",
              "SEND_NEXT_ORDER_DATE_UPDATED_EMAIL",
              "SEND_SUBSCRIPTION_PAUSED_EMAIL",
              "SEND_SUBSCRIPTION_CANCELED_EMAIL",
              "SEND_SUBSCRIPTION_RESUMED_EMAIL",
              "SEND_SUBSCRIPTION_PRODUCT_ADDED_EMAIL",
              "SEND_SUBSCRIPTION_PRODUCT_REMOVED_EMAIL",
              "SEND_SUBSCRIPTION_PRODUCT_REPLACED_EMAIL",
              "SEND_ORDER_SKIPPED_EMAIL",
              "ONE_TIME_PURCHASE_PRODUCT_ADDED",
              "ONE_TIME_PURCHASE_PRODUCT_REMOVED",
              "ONE_TIME_PURCHASE_PRODUCT_UPDATE",
              "SEND_SECURITY_CHALLENGE_EMAIL",
              "DISCOUNT_APPLIED",
              "DISCOUNT_REMOVED",
              "DUNNING_CANCELLED",
              "DUNNING_SKIPPED",
              "DUNNING_PAUSED",
              "DUNNING_ATTEMPT_SKIPPED",
              "BILLING_ATTEMPT_NOTIFICATION",
              "SEND_SUBSCRIPTION_MANAGEMENT_LINK",
              "PRICE_CHANGE_SYNC",
              "UPDATE_QUEUED_ATTEMPTS",
              "EMPTY_ORDER_QUEUE_HEAL_TRIGGERED",
              "WEBHOOK",
              "SPLIT_CONTRACT",
              "SWITCH_PAYMENT_METHODS",
              "PAYMENT_METHOD_UPDATED",
              "SEND_OUT_OF_STOCK_EMAIL",
              "INFORMATIONAL_EVENT",
              "BULK_EMAIL",
              "CONTRACT_CREATED",
              "INITIAL_CONTRACT_INFO",
              "ANCHOR_DAY_REMOVED",
              "UPCOMING_ORDER_UPDATED",
              "SUBSCRIPTION_CONTRACT_UPDATED",
              "BILLING_ATTEMPT_UPDATED",
              "RESCHEDULE_FULFILLMENT",
              "FULFILLMENT_REFUNDED",
              "FULFILLMENT_ORDERS_MERGED",
              "SWAP_AUTOMATION_TRIGGERED",
              "FREQUENCY_SWAP_AUTOMATION_TRIGGERED",
              "BAB_DISCOUNT_ADJUSTMENT",
              "BAB_PRODUCT_ADD",
              "BAB_PRODUCT_REMOVE",
              "BAB_QUANTITY_CHANGE",
              "STOP_UPCOMING_ORDER_EMAIL_UPDATED",
              "ORDER_TAGS_ADDED",
              "EMAIL",
              "SEND_TRANSACTION_SUCCESS_EMAIL",
              "TAGS_UPDATED",
              "SEND_PRODUCT_PRICE_UPDATED_EMAIL",
              "SUBSCRIPTION_GROUP_PLAN_UPDATE",
              "SUBSCRIPTION_GROUP_PLAN_CREATE",
              "SUBSCRIPTION_GROUP_PLAN_DELETE",
              "CREATED",
              "UPDATED",
              "SEND_SUSPENSION_EMAIL",
              "SEND_SUSPENSION_WARNING_EMAIL",
              "DELETED",
              "CURRENCY_MISMATCH_DETECTED",
              "PRICING_METHOD_APPLIED",
              "PRICING_POLICY_DISCOUNT_APPLIED",
              "PRICING_POLICY_SYNC_SKIPPED",
              "PRICING_POLICY_SYNC_FAILED",
              "PRICING_POLICY_NO_APPLICABLE_CYCLE",
              "PRICING_POLICY_REMOVED",
              "PRICING_POLICY_OVERRIDE",
              "AUTOMATIC_DISCOUNT_UPDATE",
              "BILLING_ATTEMPT_REFRESHED",
              "PRICE_CHANGE_SYNC_SKIPPED",
              "BASE_PRICE_CALCULATION",
              "LINE_DUTY_ADDED",
              "IMMEDIATE_RETRY_TRIGGERED",
              "PRICE_CHANGE_SYNC_BULK_AUTOMATION",
              "SCHEDULE_EXPIRING_CREDIT_CARD_EMAIL",
              "STARTED_BULK_AUTOMATION_PROCESSING",
              "SCHEDULED_BULK_AUTOMATION_SCHEDULED",
              "SCHEDULED_BULK_AUTOMATION_CANCELED",
              "SCHEDULED_BULK_AUTOMATION_DEFERRED",
              "SCHEDULED_BULK_AUTOMATION_STARTED",
              "SCHEDULED_BULK_AUTOMATION_COMPLETED",
              "SCHEDULED_BULK_AUTOMATION_FAILED",
              "DUPLICATE_BILLING_ATTEMPT_DETECTED",
              "AUTO_RESUME_SCHEDULED",
              "BILLING_CYCLE_PRODUCTS_SKIPPED",
              "ORDER_ATTRIBUTES_SYNCED",
              "DATE_ATTRIBUTE_MODIFIED_BEFORE_SYNC",
              "ORDER_DATE_SYNC_FAILED",
              "DELIVERY_DATE_SETTINGS_APPLIED",
              "ORPHANED_SELLING_PLAN_DETECTED",
              "BUNDLE_DISCOUNT_PERCENTAGE_ROUNDED",
              "PARTNER_CONNECTED",
              "PARTNER_DISCONNECTED",
              "PARTNER_CONNECTION_REQUESTED",
              "PARTNER_CONNECTION_APPROVED",
              "PARTNER_CONNECTION_REJECTED",
              "STORE_CREDIT_DISCOUNT_APPLIED",
              "UPDATE_STORE_CREDIT",
              "SKIP_PAYMENT_ENABLED",
              "PREPAID_DEFERRED_CANCELLATION_SCHEDULED",
              "PREPAID_DEFERRED_CANCELLATION_EXECUTED",
              "PREPAID_DEFERRED_CANCELLATION_CLEARED",
              "MIXED_PREPAID_SEPARATE_ORDERS_CONTRACT_DETECTED",
              "CURRENCY_ADJUSTMENT_RECOVERY",
              "PRICING_POLICY_SUPPRESSED_FOR_MIGRATED_CONTRACT",
              "PRICING_POLICY_SKIPPED_MIGRATED_BY_STRATEGY",
              "FEATURE_ACCESS_BLOCKED",
              "SEGMENT_CREATED",
              "SEGMENT_UPDATED",
              "SEGMENT_DELETED",
              "SEGMENT_REFRESHED",
              "CHARGE_CAP_EXEMPTION_APPLIED",
              "BUNDLE_DISCOUNT_SYNC_TRIGGERED",
              "FREE_PRODUCT_REWARD_APPLIED",
              "FREE_PRODUCT_REWARD_SYNC_FAILED",
              "BILLING_ATTEMPT_BACKFILLED"
            ],
            "type": "string"
          },
          "notIn": {
            "items": {
              "enum": [
                "NEXT_BILLING_DATE_CHANGE",
                "NEXT_BILLING_TIME_CHANGE",
                "BILLING_INTERVAL_CHANGE",
                "DELIVERY_INTERVAL_CHANGE",
                "BILLING_ATTEMPT_TRIGGERED",
                "BILLING_ATTEMPT_SKIPPED",
                "IMMEDIATE_ORDER_RATE_LIMIT_BLOCKED",
                "PRICING_POLICY_ESCALATION_BLOCKED",
                "BILLING_AMOUNT_ESCALATION_BLOCKED",
                "PRODUCT_ADD",
                "PRODUCT_REMOVE",
                "PRODUCT_REPLACE",
                "PRODUCT_QUANTITY_CHANGE",
                "PRODUCT_PRICE_CHANGE",
                "PRODUCT_PRICING_POLICY_CHANGE",
                "PRODUCT_SELLING_PLAN_CHANGE",
                "PRODUCT_DELETED_SYNC",
                "CONTRACT_PAUSED",
                "CONTRACT_ACTIVATED",
                "CONTRACT_ACTIVATION_DEFERRED",
                "CONTRACT_CANCELLED",
                "DELIVERY_METHOD_UPDATED",
                "SUPPORT_APD_DATA_UPDATED",
                "SUPPORT_APD_DATA_REMOVED",
                "SYSTEM_UPDATED_DELIVERY_PRICE",
                "DELIVERY_PRICE_SYNC_SKIPPED",
                "MANUAL_DELIVERY_PRICE_UPDATED",
                "DELIVERY_PRICE_OVERRIDE_CHANGED",
                "SHIPPING_ADDRESS_CHANGE",
                "SHIPPING_ADDRESS_CHANGE_SYNC",
                "SEND_GIFT_RECEIVED_EMAIL",
                "SEND_GIFT_THANK_YOU_EMAIL",
                "SEND_GIFT_PURCHASED_MERCHANT_EMAIL",
                "SEND_SUBSCRIPTION_CREATED_EMAIL",
                "SEND_TRANSACTION_FAILED_EMAIL",
                "SEND_UPCOMING_ORDER_EMAIL",
                "SEND_EXPIRING_CREDIT_CARD_EMAIL",
                "SEND_SHIPPING_ADDRESS_UPDATED_EMAIL",
                "SEND_ORDER_FREQUENCY_UPDATED_EMAIL",
                "SEND_NEXT_ORDER_DATE_UPDATED_EMAIL",
                "SEND_SUBSCRIPTION_PAUSED_EMAIL",
                "SEND_SUBSCRIPTION_CANCELED_EMAIL",
                "SEND_SUBSCRIPTION_RESUMED_EMAIL",
                "SEND_SUBSCRIPTION_PRODUCT_ADDED_EMAIL",
                "SEND_SUBSCRIPTION_PRODUCT_REMOVED_EMAIL",
                "SEND_SUBSCRIPTION_PRODUCT_REPLACED_EMAIL",
                "SEND_ORDER_SKIPPED_EMAIL",
                "ONE_TIME_PURCHASE_PRODUCT_ADDED",
                "ONE_TIME_PURCHASE_PRODUCT_REMOVED",
                "ONE_TIME_PURCHASE_PRODUCT_UPDATE",
                "SEND_SECURITY_CHALLENGE_EMAIL",
                "DISCOUNT_APPLIED",
                "DISCOUNT_REMOVED",
                "DUNNING_CANCELLED",
                "DUNNING_SKIPPED",
                "DUNNING_PAUSED",
                "DUNNING_ATTEMPT_SKIPPED",
                "BILLING_ATTEMPT_NOTIFICATION",
                "SEND_SUBSCRIPTION_MANAGEMENT_LINK",
                "PRICE_CHANGE_SYNC",
                "UPDATE_QUEUED_ATTEMPTS",
                "EMPTY_ORDER_QUEUE_HEAL_TRIGGERED",
                "WEBHOOK",
                "SPLIT_CONTRACT",
                "SWITCH_PAYMENT_METHODS",
                "PAYMENT_METHOD_UPDATED",
                "SEND_OUT_OF_STOCK_EMAIL",
                "INFORMATIONAL_EVENT",
                "BULK_EMAIL",
                "CONTRACT_CREATED",
                "INITIAL_CONTRACT_INFO",
                "ANCHOR_DAY_REMOVED",
                "UPCOMING_ORDER_UPDATED",
                "SUBSCRIPTION_CONTRACT_UPDATED",
                "BILLING_ATTEMPT_UPDATED",
                "RESCHEDULE_FULFILLMENT",
                "FULFILLMENT_REFUNDED",
                "FULFILLMENT_ORDERS_MERGED",
                "SWAP_AUTOMATION_TRIGGERED",
                "FREQUENCY_SWAP_AUTOMATION_TRIGGERED",
                "BAB_DISCOUNT_ADJUSTMENT",
                "BAB_PRODUCT_ADD",
                "BAB_PRODUCT_REMOVE",
                "BAB_QUANTITY_CHANGE",
                "STOP_UPCOMING_ORDER_EMAIL_UPDATED",
                "ORDER_TAGS_ADDED",
                "EMAIL",
                "SEND_TRANSACTION_SUCCESS_EMAIL",
                "TAGS_UPDATED",
                "SEND_PRODUCT_PRICE_UPDATED_EMAIL",
                "SUBSCRIPTION_GROUP_PLAN_UPDATE",
                "SUBSCRIPTION_GROUP_PLAN_CREATE",
                "SUBSCRIPTION_GROUP_PLAN_DELETE",
                "CREATED",
                "UPDATED",
                "SEND_SUSPENSION_EMAIL",
                "SEND_SUSPENSION_WARNING_EMAIL",
                "DELETED",
                "CURRENCY_MISMATCH_DETECTED",
                "PRICING_METHOD_APPLIED",
                "PRICING_POLICY_DISCOUNT_APPLIED",
                "PRICING_POLICY_SYNC_SKIPPED",
                "PRICING_POLICY_SYNC_FAILED",
                "PRICING_POLICY_NO_APPLICABLE_CYCLE",
                "PRICING_POLICY_REMOVED",
                "PRICING_POLICY_OVERRIDE",
                "AUTOMATIC_DISCOUNT_UPDATE",
                "BILLING_ATTEMPT_REFRESHED",
                "PRICE_CHANGE_SYNC_SKIPPED",
                "BASE_PRICE_CALCULATION",
                "LINE_DUTY_ADDED",
                "IMMEDIATE_RETRY_TRIGGERED",
                "PRICE_CHANGE_SYNC_BULK_AUTOMATION",
                "SCHEDULE_EXPIRING_CREDIT_CARD_EMAIL",
                "STARTED_BULK_AUTOMATION_PROCESSING",
                "SCHEDULED_BULK_AUTOMATION_SCHEDULED",
                "SCHEDULED_BULK_AUTOMATION_CANCELED",
                "SCHEDULED_BULK_AUTOMATION_DEFERRED",
                "SCHEDULED_BULK_AUTOMATION_STARTED",
                "SCHEDULED_BULK_AUTOMATION_COMPLETED",
                "SCHEDULED_BULK_AUTOMATION_FAILED",
                "DUPLICATE_BILLING_ATTEMPT_DETECTED",
                "AUTO_RESUME_SCHEDULED",
                "BILLING_CYCLE_PRODUCTS_SKIPPED",
                "ORDER_ATTRIBUTES_SYNCED",
                "DATE_ATTRIBUTE_MODIFIED_BEFORE_SYNC",
                "ORDER_DATE_SYNC_FAILED",
                "DELIVERY_DATE_SETTINGS_APPLIED",
                "ORPHANED_SELLING_PLAN_DETECTED",
                "BUNDLE_DISCOUNT_PERCENTAGE_ROUNDED",
                "PARTNER_CONNECTED",
                "PARTNER_DISCONNECTED",
                "PARTNER_CONNECTION_REQUESTED",
                "PARTNER_CONNECTION_APPROVED",
                "PARTNER_CONNECTION_REJECTED",
                "STORE_CREDIT_DISCOUNT_APPLIED",
                "UPDATE_STORE_CREDIT",
                "SKIP_PAYMENT_ENABLED",
                "PREPAID_DEFERRED_CANCELLATION_SCHEDULED",
                "PREPAID_DEFERRED_CANCELLATION_EXECUTED",
                "PREPAID_DEFERRED_CANCELLATION_CLEARED",
                "MIXED_PREPAID_SEPARATE_ORDERS_CONTRACT_DETECTED",
                "CURRENCY_ADJUSTMENT_RECOVERY",
                "PRICING_POLICY_SUPPRESSED_FOR_MIGRATED_CONTRACT",
                "PRICING_POLICY_SKIPPED_MIGRATED_BY_STRATEGY",
                "FEATURE_ACCESS_BLOCKED",
                "SEGMENT_CREATED",
                "SEGMENT_UPDATED",
                "SEGMENT_DELETED",
                "SEGMENT_REFRESHED",
                "CHARGE_CAP_EXEMPTION_APPLIED",
                "BUNDLE_DISCOUNT_SYNC_TRIGGERED",
                "FREE_PRODUCT_REWARD_APPLIED",
                "FREE_PRODUCT_REWARD_SYNC_FAILED",
                "BILLING_ATTEMPT_BACKFILLED"
              ],
              "type": "string"
            },
            "type": "array"
          },
          "specified": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "ActivityLogStatusFilter": {
        "properties": {
          "equals": {
            "enum": [
              "SUCCESS",
              "FAILURE",
              "INFO",
              "SKIPPED",
              "PARTIAL_FAILURE"
            ],
            "type": "string"
          },
          "in": {
            "items": {
              "enum": [
                "SUCCESS",
                "FAILURE",
                "INFO",
                "SKIPPED",
                "PARTIAL_FAILURE"
              ],
              "type": "string"
            },
            "type": "array"
          },
          "notEquals": {
            "enum": [
              "SUCCESS",
              "FAILURE",
              "INFO",
              "SKIPPED",
              "PARTIAL_FAILURE"
            ],
            "type": "string"
          },
          "notIn": {
            "items": {
              "enum": [
                "SUCCESS",
                "FAILURE",
                "INFO",
                "SKIPPED",
                "PARTIAL_FAILURE"
              ],
              "type": "string"
            },
            "type": "array"
          },
          "specified": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "AddedProductsResponseDTO": {
        "properties": {
          "addedProductIds": {
            "items": {
              "format": "int64",
              "type": "integer"
            },
            "type": "array"
          },
          "addedVariantIds": {
            "items": {
              "format": "int64",
              "type": "integer"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "AdjustmentValue": {
        "properties": {
          "get__typename": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "Amount": {
        "properties": {
          "amount": {
            "type": "object"
          },
          "currencyCode": {
            "enum": [
              "USD",
              "EUR",
              "GBP",
              "CAD",
              "AFN",
              "ALL",
              "DZD",
              "AOA",
              "ARS",
              "AMD",
              "AWG",
              "AUD",
              "BBD",
              "AZN",
              "BDT",
              "BSD",
              "BHD",
              "BIF",
              "BYN",
              "BZD",
              "BMD",
              "BTN",
              "BAM",
              "BRL",
              "BOB",
              "BWP",
              "BND",
              "BGN",
              "MMK",
              "KHR",
              "CVE",
              "KYD",
              "XAF",
              "CLP",
              "CNY",
              "COP",
              "KMF",
              "CDF",
              "CRC",
              "HRK",
              "CZK",
              "DKK",
              "DJF",
              "DOP",
              "XCD",
              "EGP",
              "ERN",
              "ETB",
              "FKP",
              "XPF",
              "FJD",
              "GIP",
              "GMD",
              "GHS",
              "GTQ",
              "GYD",
              "GEL",
              "GNF",
              "HTG",
              "HNL",
              "HKD",
              "HUF",
              "ISK",
              "INR",
              "IDR",
              "ILS",
              "IRR",
              "IQD",
              "JMD",
              "JPY",
              "JEP",
              "JOD",
              "KZT",
              "KES",
              "KID",
              "KWD",
              "KGS",
              "LAK",
              "LVL",
              "LBP",
              "LSL",
              "LRD",
              "LYD",
              "LTL",
              "MGA",
              "MKD",
              "MOP",
              "MWK",
              "MVR",
              "MRU",
              "MXN",
              "MYR",
              "MUR",
              "MDL",
              "MAD",
              "MNT",
              "MZN",
              "NAD",
              "NPR",
              "ANG",
              "NZD",
              "NIO",
              "NGN",
              "NOK",
              "OMR",
              "PAB",
              "PKR",
              "PGK",
              "PYG",
              "PEN",
              "PHP",
              "PLN",
              "QAR",
              "RON",
              "RUB",
              "RWF",
              "WST",
              "SHP",
              "SAR",
              "RSD",
              "SCR",
              "SLL",
              "SGD",
              "SDG",
              "SOS",
              "SYP",
              "ZAR",
              "KRW",
              "SSP",
              "SBD",
              "LKR",
              "SRD",
              "SZL",
              "SEK",
              "CHF",
              "TWD",
              "THB",
              "TJS",
              "TZS",
              "TOP",
              "TTD",
              "TND",
              "TRY",
              "TMT",
              "UGX",
              "UAH",
              "AED",
              "UYU",
              "UZS",
              "VUV",
              "VES",
              "VND",
              "XOF",
              "YER",
              "ZMW",
              "USDC",
              "BYR",
              "STD",
              "STN",
              "VED",
              "VEF",
              "XXX",
              "$UNKNOWN"
            ],
            "type": "string"
          },
          "get__typename": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "Anchor": {
        "properties": {
          "cutoffDay": {
            "format": "int32",
            "type": "integer"
          },
          "day": {
            "format": "int32",
            "type": "integer"
          },
          "get__typename": {
            "type": "string"
          },
          "month": {
            "format": "int32",
            "type": "integer"
          },
          "type": {
            "enum": [
              "WEEKDAY",
              "MONTHDAY",
              "YEARDAY",
              "$UNKNOWN"
            ],
            "type": "string"
          }
        },
        "type": "object"
      },
      "Anchor1": {
        "properties": {
          "cutoffDay": {
            "format": "int32",
            "type": "integer"
          },
          "day": {
            "format": "int32",
            "type": "integer"
          },
          "get__typename": {
            "type": "string"
          },
          "month": {
            "format": "int32",
            "type": "integer"
          },
          "type": {
            "enum": [
              "WEEKDAY",
              "MONTHDAY",
              "YEARDAY",
              "$UNKNOWN"
            ],
            "type": "string"
          }
        },
        "type": "object"
      },
      "AppstleCycle": {
        "description": "Custom pricing cycle configuration for subscription line items",
        "properties": {
          "afterCycle": {
            "description": "The billing cycle number after which this pricing applies",
            "example": 3,
            "format": "int32",
            "minimum": 1,
            "type": "integer"
          },
          "discountType": {
            "description": "Type of discount to apply in pricing cycles",
            "enum": [
              "PERCENTAGE",
              "FIXED",
              "PRICE",
              "SHIPPING",
              "FREE_PRODUCT",
              "PERCENTAGE",
              "FIXED",
              "PRICE",
              "SHIPPING",
              "FREE_PRODUCT"
            ],
            "example": "PERCENTAGE",
            "type": "string"
          },
          "freeProductHandle": {
            "description": "Product handle of a free product to add when discountType is FREE_PRODUCT",
            "example": "free-gift-product",
            "type": "string"
          },
          "freeProductImage": {
            "description": "Image URL of the free product when discountType is FREE_PRODUCT",
            "example": "https://cdn.shopify.com/s/files/1/0000/0000/products/mug.jpg",
            "type": "string"
          },
          "freeProductTitle": {
            "description": "Display title of the free product when discountType is FREE_PRODUCT",
            "example": "Ceramic Mug",
            "type": "string"
          },
          "freeProducts": {
            "description": "One or more free products to gift when discountType is FREE_PRODUCT. Optional \u2014 when absent, the legacy singular freeVariantId/freeProductHandle/freeProductTitle/freeProductImage fields are the source of truth for a single free product. When present, index 0 is always mirrored onto those legacy fields so older clients keep working unchanged. Capped at 5 entries.",
            "items": {
              "$ref": "#/components/schemas/FreeProductEntry"
            },
            "type": "array"
          },
          "freeVariantId": {
            "description": "Variant ID of a free product to add when discountType is FREE_PRODUCT",
            "example": 42549172011164,
            "format": "int64",
            "type": "integer"
          },
          "preventDuplicationFreeProduct": {
            "description": "Prevent adding duplicate free products if already in cart",
            "example": true,
            "type": "boolean"
          },
          "repeatEvery": {
            "description": "Repeating rewards only: the repeating rewards come back every this many orders, counting the first order. A free gift on order 5 (afterCycle 4) with repeatEvery 5 is given on orders 5, 10, 15 and so on. When absent, they come back every N orders, where N is the highest afterCycle among the repeating rewards. Ignored on pay-as-you-go prepaid plans.",
            "example": 5,
            "format": "int32",
            "maximum": 150,
            "minimum": 1,
            "type": "integer"
          },
          "repeatingCycle": {
            "description": "Whether this pricing should repeat for subsequent cycles",
            "example": true,
            "type": "boolean"
          },
          "repeatingNumberOfCycle": {
            "description": "Number of cycles to repeat this pricing for when repeatingCycle is true",
            "example": 6,
            "format": "int32",
            "minimum": 1,
            "type": "integer"
          },
          "restrictFreeProductQuantity": {
            "description": "Keep each free product at quantity 1 regardless of the parent line item quantity",
            "example": true,
            "type": "boolean"
          },
          "singleOrder": {
            "description": "SHIPPING only: the shipping price covers this reward's own order, then the subscription goes back to its normal shipping price. Ignored on other reward types and on repeating rewards.",
            "example": true,
            "type": "boolean"
          },
          "tierRole": {
            "type": "string"
          },
          "value": {
            "description": "Discount value. For PERCENTAGE: 0-100 (e.g., 10 for 10% off). For FIXED: amount to subtract from price. For PRICE: new fixed price. For SHIPPING: shipping discount amount. For FREE_PRODUCT: not used (set freeVariantId or freeProductHandle instead)",
            "example": 10.0,
            "format": "double",
            "type": "number"
          }
        },
        "type": "object"
      },
      "AttemptBillingResponseDTO": {
        "description": "Acknowledgement that an immediate billing attempt was accepted and queued for processing. The payment result is delivered asynchronously.",
        "properties": {
          "billingAttemptId": {
            "description": "Billing attempt ID that is being processed. Can differ from requestedBillingAttemptId depending on shop settings; use this ID to track the result.",
            "example": 123457,
            "format": "int64",
            "type": "integer"
          },
          "billingDate": {
            "description": "Billing date of the attempt being processed",
            "format": "date-time",
            "type": "string"
          },
          "contractId": {
            "description": "Subscription contract ID",
            "example": 987654321,
            "format": "int64",
            "type": "integer"
          },
          "message": {
            "description": "Human readable description of what happens next",
            "type": "string"
          },
          "requestedBillingAttemptId": {
            "description": "Billing attempt ID that was passed in the request",
            "example": 123456,
            "format": "int64",
            "type": "integer"
          },
          "status": {
            "description": "Current status of the billing attempt",
            "enum": [
              "SUCCESS",
              "FAILURE",
              "REQUESTING",
              "PROGRESS",
              "QUEUED",
              "SKIPPED",
              "SOCIAL_CONNECTION_NULL",
              "CONTRACT_CANCELLED",
              "CONTRACT_ENDED",
              "CONTRACT_PAUSED",
              "AUTO_CHARGE_DISABLED",
              "SHOPIFY_EXCEPTION",
              "SKIPPED_DUNNING_MGMT",
              "SKIPPED_INVENTORY_MGMT",
              "IMMEDIATE_TRIGGERED",
              "SECURITY_CHALLENGE",
              "CONTRACT_PAUSED_MAX_CYCLES",
              "REFUNDED",
              "SKIPPED_DEMO_SHOP",
              "SKIPPED_SHOP_INFO_NOT_FOUND",
              "SKIPPED_BILLING_DATE_STALE",
              "SKIPPED_DUNNING_NOT_CONFIGURED",
              "PENDING_CONSOLIDATION"
            ],
            "example": "IMMEDIATE_TRIGGERED",
            "type": "string"
          }
        },
        "type": "object"
      },
      "AttributeInfo": {
        "properties": {
          "key": {
            "type": "string"
          },
          "value": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "AttributeInputDTO": {
        "description": "Key-value attribute pair",
        "example": [
          {
            "key": "subscription_type",
            "value": "premium"
          },
          {
            "key": "gift_message",
            "value": "Happy Birthday!"
          }
        ],
        "properties": {
          "key": {
            "description": "Key or name of the attribute",
            "example": "subscription_type",
            "type": "string"
          },
          "value": {
            "description": "Value of the attribute",
            "example": "premium",
            "type": "string"
          }
        },
        "required": [
          "key",
          "value"
        ],
        "type": "object"
      },
      "Attributes": {
        "type": "object"
      },
      "BasePrice": {
        "properties": {
          "amount": {
            "type": "object"
          },
          "currencyCode": {
            "enum": [
              "USD",
              "EUR",
              "GBP",
              "CAD",
              "AFN",
              "ALL",
              "DZD",
              "AOA",
              "ARS",
              "AMD",
              "AWG",
              "AUD",
              "BBD",
              "AZN",
              "BDT",
              "BSD",
              "BHD",
              "BIF",
              "BYN",
              "BZD",
              "BMD",
              "BTN",
              "BAM",
              "BRL",
              "BOB",
              "BWP",
              "BND",
              "BGN",
              "MMK",
              "KHR",
              "CVE",
              "KYD",
              "XAF",
              "CLP",
              "CNY",
              "COP",
              "KMF",
              "CDF",
              "CRC",
              "HRK",
              "CZK",
              "DKK",
              "DJF",
              "DOP",
              "XCD",
              "EGP",
              "ERN",
              "ETB",
              "FKP",
              "XPF",
              "FJD",
              "GIP",
              "GMD",
              "GHS",
              "GTQ",
              "GYD",
              "GEL",
              "GNF",
              "HTG",
              "HNL",
              "HKD",
              "HUF",
              "ISK",
              "INR",
              "IDR",
              "ILS",
              "IRR",
              "IQD",
              "JMD",
              "JPY",
              "JEP",
              "JOD",
              "KZT",
              "KES",
              "KID",
              "KWD",
              "KGS",
              "LAK",
              "LVL",
              "LBP",
              "LSL",
              "LRD",
              "LYD",
              "LTL",
              "MGA",
              "MKD",
              "MOP",
              "MWK",
              "MVR",
              "MRU",
              "MXN",
              "MYR",
              "MUR",
              "MDL",
              "MAD",
              "MNT",
              "MZN",
              "NAD",
              "NPR",
              "ANG",
              "NZD",
              "NIO",
              "NGN",
              "NOK",
              "OMR",
              "PAB",
              "PKR",
              "PGK",
              "PYG",
              "PEN",
              "PHP",
              "PLN",
              "QAR",
              "RON",
              "RUB",
              "RWF",
              "WST",
              "SHP",
              "SAR",
              "RSD",
              "SCR",
              "SLL",
              "SGD",
              "SDG",
              "SOS",
              "SYP",
              "ZAR",
              "KRW",
              "SSP",
              "SBD",
              "LKR",
              "SRD",
              "SZL",
              "SEK",
              "CHF",
              "TWD",
              "THB",
              "TJS",
              "TZS",
              "TOP",
              "TTD",
              "TND",
              "TRY",
              "TMT",
              "UGX",
              "UAH",
              "AED",
              "UYU",
              "UZS",
              "VUV",
              "VES",
              "VND",
              "XOF",
              "YER",
              "ZMW",
              "USDC",
              "BYR",
              "STD",
              "STN",
              "VED",
              "VEF",
              "XXX",
              "$UNKNOWN"
            ],
            "type": "string"
          },
          "get__typename": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "BillingAttempts": {
        "properties": {
          "get__typename": {
            "type": "string"
          },
          "nodes": {
            "items": {
              "$ref": "#/components/schemas/Node3"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "BillingPolicy": {
        "properties": {
          "anchors": {
            "items": {
              "$ref": "#/components/schemas/Anchor"
            },
            "type": "array"
          },
          "get__typename": {
            "type": "string"
          },
          "interval": {
            "enum": [
              "DAY",
              "WEEK",
              "MONTH",
              "YEAR",
              "$UNKNOWN"
            ],
            "type": "string"
          },
          "intervalCount": {
            "format": "int32",
            "type": "integer"
          },
          "maxCycles": {
            "format": "int32",
            "type": "integer"
          },
          "minCycles": {
            "format": "int32",
            "type": "integer"
          }
        },
        "type": "object"
      },
      "BuildABoxUpdate": {
        "properties": {
          "babHandle": {
            "type": "string"
          },
          "sourceProducts": {
            "items": {
              "$ref": "#/components/schemas/SourceProductDTO"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "BulkAddProductsRequest": {
        "properties": {
          "productIds": {
            "items": {
              "format": "int64",
              "type": "integer"
            },
            "type": "array"
          },
          "variantIds": {
            "items": {
              "format": "int64",
              "type": "integer"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "CancellationManagementDTO": {
        "properties": {
          "cancellationInstructionsText": {
            "type": "string"
          },
          "cancellationReasonsJSON": {
            "type": "string"
          },
          "cancellationType": {
            "enum": [
              "CANCEL_IMMEDIATELY",
              "CANCELLATION_INSTRUCTIONS",
              "CUSTOMER_RETENTION_FLOW",
              "CANCEL_AFTER_PAUSE"
            ],
            "type": "string"
          },
          "discountEmailAddress": {
            "type": "string"
          },
          "dynamicallyPauseCycleOnCancellation": {
            "type": "boolean"
          },
          "enableDiscountEmail": {
            "type": "boolean"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "pauseDurationCycle": {
            "format": "int32",
            "type": "integer"
          },
          "pauseInstructionsText": {
            "type": "string"
          },
          "pauseReasonsJSON": {
            "type": "string"
          },
          "pauseType": {
            "enum": [
              "PAUSE_IMMEDIATELY",
              "PAUSE_INSTRUCTIONS",
              "CUSTOMER_RETENTION_FLOW"
            ],
            "type": "string"
          },
          "reasonMessageTranslationsJSON": {
            "type": "string"
          },
          "shop": {
            "type": "string"
          }
        },
        "required": [
          "shop"
        ],
        "type": "object"
      },
      "Cart": {
        "properties": {
          "attributes": {
            "$ref": "#/components/schemas/Attributes"
          },
          "cart_level_discount_applications": {
            "items": {
              "type": "object"
            },
            "type": "array"
          },
          "currency": {
            "type": "string"
          },
          "item_count": {
            "format": "int64",
            "type": "integer"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/Item"
            },
            "type": "array"
          },
          "items_subtotal_price": {
            "format": "int64",
            "type": "integer"
          },
          "note": {
            "type": "object"
          },
          "original_total_price": {
            "format": "int64",
            "type": "integer"
          },
          "requires_shipping": {
            "type": "boolean"
          },
          "token": {
            "type": "string"
          },
          "total_discount": {
            "format": "int64",
            "type": "integer"
          },
          "total_price": {
            "format": "int64",
            "type": "integer"
          },
          "total_weight": {
            "format": "int64",
            "type": "integer"
          }
        },
        "type": "object"
      },
      "ChangeShippingAddressVM": {
        "properties": {
          "address1": {
            "type": "string"
          },
          "address2": {
            "type": "string"
          },
          "city": {
            "type": "string"
          },
          "company": {
            "type": "string"
          },
          "country": {
            "type": "string"
          },
          "countryCode": {
            "type": "string"
          },
          "firstName": {
            "type": "string"
          },
          "lastName": {
            "type": "string"
          },
          "locationId": {
            "type": "string"
          },
          "methodType": {
            "type": "string"
          },
          "phone": {
            "type": "string"
          },
          "province": {
            "type": "string"
          },
          "provinceCode": {
            "type": "string"
          },
          "zip": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "ComputedPrice": {
        "properties": {
          "amount": {
            "type": "object"
          },
          "currencyCode": {
            "enum": [
              "USD",
              "EUR",
              "GBP",
              "CAD",
              "AFN",
              "ALL",
              "DZD",
              "AOA",
              "ARS",
              "AMD",
              "AWG",
              "AUD",
              "BBD",
              "AZN",
              "BDT",
              "BSD",
              "BHD",
              "BIF",
              "BYN",
              "BZD",
              "BMD",
              "BTN",
              "BAM",
              "BRL",
              "BOB",
              "BWP",
              "BND",
              "BGN",
              "MMK",
              "KHR",
              "CVE",
              "KYD",
              "XAF",
              "CLP",
              "CNY",
              "COP",
              "KMF",
              "CDF",
              "CRC",
              "HRK",
              "CZK",
              "DKK",
              "DJF",
              "DOP",
              "XCD",
              "EGP",
              "ERN",
              "ETB",
              "FKP",
              "XPF",
              "FJD",
              "GIP",
              "GMD",
              "GHS",
              "GTQ",
              "GYD",
              "GEL",
              "GNF",
              "HTG",
              "HNL",
              "HKD",
              "HUF",
              "ISK",
              "INR",
              "IDR",
              "ILS",
              "IRR",
              "IQD",
              "JMD",
              "JPY",
              "JEP",
              "JOD",
              "KZT",
              "KES",
              "KID",
              "KWD",
              "KGS",
              "LAK",
              "LVL",
              "LBP",
              "LSL",
              "LRD",
              "LYD",
              "LTL",
              "MGA",
              "MKD",
              "MOP",
              "MWK",
              "MVR",
              "MRU",
              "MXN",
              "MYR",
              "MUR",
              "MDL",
              "MAD",
              "MNT",
              "MZN",
              "NAD",
              "NPR",
              "ANG",
              "NZD",
              "NIO",
              "NGN",
              "NOK",
              "OMR",
              "PAB",
              "PKR",
              "PGK",
              "PYG",
              "PEN",
              "PHP",
              "PLN",
              "QAR",
              "RON",
              "RUB",
              "RWF",
              "WST",
              "SHP",
              "SAR",
              "RSD",
              "SCR",
              "SLL",
              "SGD",
              "SDG",
              "SOS",
              "SYP",
              "ZAR",
              "KRW",
              "SSP",
              "SBD",
              "LKR",
              "SRD",
              "SZL",
              "SEK",
              "CHF",
              "TWD",
              "THB",
              "TJS",
              "TZS",
              "TOP",
              "TTD",
              "TND",
              "TRY",
              "TMT",
              "UGX",
              "UAH",
              "AED",
              "UYU",
              "UZS",
              "VUV",
              "VES",
              "VND",
              "XOF",
              "YER",
              "ZMW",
              "USDC",
              "BYR",
              "STD",
              "STN",
              "VED",
              "VEF",
              "XXX",
              "$UNKNOWN"
            ],
            "type": "string"
          },
          "get__typename": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "ContractAnalytics": {
        "properties": {
          "totalOrderAmount": {
            "format": "double",
            "type": "number"
          },
          "totalOrderCount": {
            "format": "int64",
            "type": "integer"
          },
          "totalOrderRevenue": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "CountryInfo": {
        "properties": {
          "code": {
            "type": "string"
          },
          "deliveryMethodInfo": {
            "items": {
              "$ref": "#/components/schemas/DeliveryMethodInfo"
            },
            "type": "array"
          },
          "provinceCode": {
            "type": "string"
          },
          "restOfWorld": {
            "type": "boolean"
          },
          "shouldIncludeAllProvince": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "CountryInfoV3": {
        "properties": {
          "includeAllProvinces": {
            "type": "boolean"
          },
          "label": {
            "type": "string"
          },
          "provinces": {
            "items": {
              "$ref": "#/components/schemas/Province"
            },
            "type": "array"
          },
          "value": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "CreateShippingProfileRequestV2": {
        "description": "Shipping Profile Request View Modelf",
        "properties": {
          "id": {
            "type": "string"
          },
          "locationInfos": {
            "items": {
              "$ref": "#/components/schemas/LocationInfo"
            },
            "type": "array"
          },
          "name": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "CreateShippingProfileRequestV3": {
        "properties": {
          "id": {
            "type": "string"
          },
          "locationInfos": {
            "items": {
              "$ref": "#/components/schemas/LocationInfoV3"
            },
            "type": "array"
          },
          "locations": {
            "items": {
              "$ref": "#/components/schemas/LocationInfoV3"
            },
            "type": "array"
          },
          "name": {
            "type": "string"
          },
          "profileId": {
            "format": "int64",
            "type": "integer"
          },
          "sellingPlanGroups": {
            "items": {
              "$ref": "#/components/schemas/SellingPlanGroupInfo"
            },
            "type": "array"
          },
          "zones": {
            "items": {
              "$ref": "#/components/schemas/ZoneInfo"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "CreateShippingProfileRequestVM": {
        "description": "Shipping Profile Request View Model",
        "properties": {
          "countryInfos": {
            "items": {
              "$ref": "#/components/schemas/DeliveryCountryInfo"
            },
            "type": "array"
          },
          "deliveryMethodInfo": {
            "items": {
              "$ref": "#/components/schemas/DeliveryMethodInfo"
            },
            "type": "array"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "locationInfos": {
            "items": {
              "$ref": "#/components/schemas/LocationInfo"
            },
            "type": "array"
          },
          "name": {
            "type": "string"
          },
          "restOfWorld": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "CurrentPrice": {
        "properties": {
          "amount": {
            "type": "object"
          },
          "currencyCode": {
            "enum": [
              "USD",
              "EUR",
              "GBP",
              "CAD",
              "AFN",
              "ALL",
              "DZD",
              "AOA",
              "ARS",
              "AMD",
              "AWG",
              "AUD",
              "BBD",
              "AZN",
              "BDT",
              "BSD",
              "BHD",
              "BIF",
              "BYN",
              "BZD",
              "BMD",
              "BTN",
              "BAM",
              "BRL",
              "BOB",
              "BWP",
              "BND",
              "BGN",
              "MMK",
              "KHR",
              "CVE",
              "KYD",
              "XAF",
              "CLP",
              "CNY",
              "COP",
              "KMF",
              "CDF",
              "CRC",
              "HRK",
              "CZK",
              "DKK",
              "DJF",
              "DOP",
              "XCD",
              "EGP",
              "ERN",
              "ETB",
              "FKP",
              "XPF",
              "FJD",
              "GIP",
              "GMD",
              "GHS",
              "GTQ",
              "GYD",
              "GEL",
              "GNF",
              "HTG",
              "HNL",
              "HKD",
              "HUF",
              "ISK",
              "INR",
              "IDR",
              "ILS",
              "IRR",
              "IQD",
              "JMD",
              "JPY",
              "JEP",
              "JOD",
              "KZT",
              "KES",
              "KID",
              "KWD",
              "KGS",
              "LAK",
              "LVL",
              "LBP",
              "LSL",
              "LRD",
              "LYD",
              "LTL",
              "MGA",
              "MKD",
              "MOP",
              "MWK",
              "MVR",
              "MRU",
              "MXN",
              "MYR",
              "MUR",
              "MDL",
              "MAD",
              "MNT",
              "MZN",
              "NAD",
              "NPR",
              "ANG",
              "NZD",
              "NIO",
              "NGN",
              "NOK",
              "OMR",
              "PAB",
              "PKR",
              "PGK",
              "PYG",
              "PEN",
              "PHP",
              "PLN",
              "QAR",
              "RON",
              "RUB",
              "RWF",
              "WST",
              "SHP",
              "SAR",
              "RSD",
              "SCR",
              "SLL",
              "SGD",
              "SDG",
              "SOS",
              "SYP",
              "ZAR",
              "KRW",
              "SSP",
              "SBD",
              "LKR",
              "SRD",
              "SZL",
              "SEK",
              "CHF",
              "TWD",
              "THB",
              "TJS",
              "TZS",
              "TOP",
              "TTD",
              "TND",
              "TRY",
              "TMT",
              "UGX",
              "UAH",
              "AED",
              "UYU",
              "UZS",
              "VUV",
              "VES",
              "VND",
              "XOF",
              "YER",
              "ZMW",
              "USDC",
              "BYR",
              "STD",
              "STN",
              "VED",
              "VEF",
              "XXX",
              "$UNKNOWN"
            ],
            "type": "string"
          },
          "get__typename": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "CustomAttribute": {
        "properties": {
          "get__typename": {
            "type": "string"
          },
          "key": {
            "type": "string"
          },
          "value": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "CustomAttribute1": {
        "properties": {
          "get__typename": {
            "type": "string"
          },
          "key": {
            "type": "string"
          },
          "value": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "Customer": {
        "properties": {
          "displayName": {
            "type": "string"
          },
          "email": {
            "deprecated": true,
            "type": "string"
          },
          "firstName": {
            "type": "string"
          },
          "get__typename": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "lastName": {
            "type": "string"
          },
          "phone": {
            "deprecated": true,
            "type": "string"
          }
        },
        "type": "object"
      },
      "CustomerInfo": {
        "properties": {
          "activeSubscriptions": {
            "format": "int64",
            "type": "integer"
          },
          "customerId": {
            "format": "int64",
            "type": "integer"
          },
          "email": {
            "type": "string"
          },
          "inActiveSubscriptions": {
            "format": "int64",
            "type": "integer"
          },
          "lifetimeValue": {
            "format": "double",
            "type": "number"
          },
          "name": {
            "type": "string"
          },
          "nextOrderDate": {
            "format": "date-time",
            "type": "string"
          }
        },
        "type": "object"
      },
      "CustomerPaymentMethod": {
        "properties": {
          "get__typename": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "instrument": {
            "$ref": "#/components/schemas/Instrument"
          },
          "revokedAt": {
            "type": "object"
          },
          "revokedReason": {
            "enum": [
              "AUTHORIZE_NET_GATEWAY_NOT_ENABLED",
              "AUTHORIZE_NET_RETURNED_NO_PAYMENT_METHOD",
              "FAILED_TO_UPDATE_CREDIT_CARD",
              "STRIPE_API_AUTHENTICATION_ERROR",
              "STRIPE_API_INVALID_REQUEST_ERROR",
              "STRIPE_GATEWAY_NOT_ENABLED",
              "STRIPE_RETURNED_NO_PAYMENT_METHOD",
              "STRIPE_PAYMENT_METHOD_NOT_CARD",
              "BRAINTREE_API_AUTHENTICATION_ERROR",
              "BRAINTREE_GATEWAY_NOT_ENABLED",
              "BRAINTREE_RETURNED_NO_PAYMENT_METHOD",
              "BRAINTREE_PAYMENT_METHOD_NOT_CARD",
              "PAYMENT_METHOD_VERIFICATION_FAILED",
              "THREE_D_SECURE_FLOW_IN_VERIFICATION_NOT_IMPLEMENTED",
              "MANUALLY_REVOKED",
              "FAILED_TO_RETRIEVE_BILLING_ADDRESS",
              "MERGED",
              "CUSTOMER_REDACTED",
              "TOO_MANY_CONSECUTIVE_FAILURES",
              "CVV_ATTEMPTS_LIMIT_EXCEEDED",
              "$UNKNOWN"
            ],
            "type": "string"
          }
        },
        "type": "object"
      },
      "CustomerPortalSettingsDTO": {
        "properties": {
          "activeBadgeText": {
            "type": "string"
          },
          "addAdditionalProduct": {
            "type": "boolean"
          },
          "addAdditionalProductInBAB": {
            "type": "boolean"
          },
          "addDiscountCodeAlertText": {
            "type": "string"
          },
          "addDiscountCodeText": {
            "type": "string"
          },
          "addNewButtonText": {
            "type": "string"
          },
          "addOneTimeProduct": {
            "type": "boolean"
          },
          "addProductButtonText": {
            "type": "string"
          },
          "addProductFinishedMessageText": {
            "type": "string"
          },
          "addProductLabelText": {
            "type": "string"
          },
          "addToOrderLabelText": {
            "type": "string"
          },
          "addToSubscriptionDiscriptionTextV2": {
            "type": "string"
          },
          "addToSubscriptionTitleCP": {
            "type": "string"
          },
          "address1LabelText": {
            "type": "string"
          },
          "address2LabelText": {
            "type": "string"
          },
          "addressHeaderTitleText": {
            "type": "string"
          },
          "afterCycleDiscountNoteDescription": {
            "type": "string"
          },
          "aiAgentEnabled": {
            "type": "boolean"
          },
          "aiAgentTier": {
            "type": "string"
          },
          "allowAddOneTimeProductOrderIdPrepaid": {
            "type": "boolean"
          },
          "allowAddProductWhenContractIsFreeze": {
            "type": "boolean"
          },
          "allowAddRemoveSwapBeforeDays": {
            "type": "string"
          },
          "allowCancelDuringFreeTrial": {
            "type": "boolean"
          },
          "allowCancellationBeforeDays": {
            "type": "string"
          },
          "allowDiscountCodeBeforeMinOrders": {
            "type": "boolean"
          },
          "allowEditQuantityPrepaidSeparatePlan": {
            "type": "boolean"
          },
          "allowOnlyOneTimeProductOnAddProductFlag": {
            "type": "boolean"
          },
          "allowOrderNow": {
            "type": "boolean"
          },
          "allowOrderNowOnListPage": {
            "type": "boolean"
          },
          "allowOrderNowScheduleChoice": {
            "type": "boolean"
          },
          "allowProductIdsForSubscriptionProductAdd": {
            "type": "string"
          },
          "allowProductTagsForSubscriptionProductAdd": {
            "type": "string"
          },
          "allowReschedulingContractTrialPeriod": {
            "type": "boolean"
          },
          "allowSplitContract": {
            "type": "boolean"
          },
          "allowSwapWhenContractIsFreeze": {
            "type": "boolean"
          },
          "allowToAddProductQuantityMinMaxReached": {
            "type": "boolean"
          },
          "allowToAutoAddProduct": {
            "type": "boolean"
          },
          "allowToEditQuantityIfProductOutOfStock": {
            "type": "boolean"
          },
          "allowToEditQuantityInSingleBABProduct": {
            "type": "boolean"
          },
          "allowToSameReasonAgain": {
            "type": "boolean"
          },
          "allowToSpecificZipCode": {
            "type": "string"
          },
          "allowToSpecificZipCodeForLocalDelivery": {
            "type": "string"
          },
          "allowedProductIdsForOneTimeProductAdd": {
            "type": "string"
          },
          "amountLbl": {
            "type": "string"
          },
          "amountTieredDiscountText": {
            "type": "string"
          },
          "apdHideDelivery": {
            "type": "boolean"
          },
          "apdHidePickup": {
            "type": "boolean"
          },
          "apdHideShipping": {
            "type": "boolean"
          },
          "applySellingPlanBasedDiscount": {
            "type": "boolean"
          },
          "applySubscriptionDiscount": {
            "type": "boolean"
          },
          "applySubscriptionDiscountForOtp": {
            "type": "boolean"
          },
          "areyousureCommonMessageText": {
            "type": "string"
          },
          "areyousurePauseMessageText": {
            "type": "string"
          },
          "areyousureResumeMessageText": {
            "type": "string"
          },
          "attributeHeadingText": {
            "type": "string"
          },
          "attributeNameLabelText": {
            "type": "string"
          },
          "attributeValue": {
            "type": "string"
          },
          "babProductBadgeTextV2": {
            "type": "string"
          },
          "billingDateRestrictFromDate": {
            "type": "string"
          },
          "billingDateRestrictToDays": {
            "format": "int32",
            "type": "integer"
          },
          "bottomHtml": {
            "type": "string"
          },
          "cancelAccordionTitle": {
            "type": "string"
          },
          "cancelButtonText": {
            "type": "string"
          },
          "cancelChangeOrderBtnText": {
            "type": "string"
          },
          "cancelEditShippingButtonText": {
            "type": "string"
          },
          "cancelFreqBtnText": {
            "type": "string"
          },
          "cancelSub": {
            "type": "boolean"
          },
          "cancelSubscriptionBtnText": {
            "type": "string"
          },
          "cancelSubscriptionConfirmPayAsYouGoText": {
            "type": "string"
          },
          "cancelSubscriptionConfirmPrepaidText": {
            "type": "string"
          },
          "cancelSubscriptionMinimumBillingIterationsMessage": {
            "type": "string"
          },
          "cancelSubscriptionPayAsYouGoButtonText": {
            "type": "string"
          },
          "cancelSubscriptionPrepaidButtonText": {
            "type": "string"
          },
          "cancellationDateTitleText": {
            "type": "string"
          },
          "cancellationNoteTitleText": {
            "type": "string"
          },
          "cardExpiryText": {
            "type": "string"
          },
          "cardHolderNameText": {
            "type": "string"
          },
          "cardLastFourDigitText": {
            "type": "string"
          },
          "cardTypeText": {
            "type": "string"
          },
          "changeAddressMessageOnPause": {
            "type": "string"
          },
          "changeDateMessageOnPause": {
            "type": "string"
          },
          "changeNextOrderDate": {
            "type": "boolean"
          },
          "changeOrderFrequency": {
            "type": "boolean"
          },
          "changePaymentMessage": {
            "type": "string"
          },
          "changeShippingAddressFlag": {
            "type": "boolean"
          },
          "changeVariantLabelText": {
            "type": "string"
          },
          "chooseAnotherPaymentMethodTitleText": {
            "type": "string"
          },
          "chooseDifferentProductActionText": {
            "type": "string"
          },
          "chooseDifferentProductText": {
            "type": "string"
          },
          "choosePurchaseOptionLabelText": {
            "type": "string"
          },
          "cityLabelText": {
            "type": "string"
          },
          "clickHereText": {
            "type": "string"
          },
          "closeBadgeText": {
            "type": "string"
          },
          "closeBtnText": {
            "type": "string"
          },
          "companyLabelText": {
            "type": "string"
          },
          "confirmAddProduct": {
            "type": "string"
          },
          "confirmCommonText": {
            "type": "string"
          },
          "confirmSkipFulfillmentBtnText": {
            "type": "string"
          },
          "confirmSkipOrder": {
            "type": "string"
          },
          "confirmSwapText": {
            "type": "string"
          },
          "continueText": {
            "type": "string"
          },
          "contractCancelledBadgeText": {
            "type": "string"
          },
          "contractErrorMessageText": {
            "type": "string"
          },
          "contractUpdateMessageText": {
            "type": "string"
          },
          "countryCodeLabelText": {
            "type": "string"
          },
          "countryLabelText": {
            "type": "string"
          },
          "createAdditionalOrder": {
            "type": "boolean"
          },
          "creditCardText": {
            "type": "string"
          },
          "customJs": {
            "type": "string"
          },
          "customerIdText": {
            "type": "string"
          },
          "customerPortalLandingPage": {
            "type": "string"
          },
          "customerPortalSettingJson": {
            "type": "string"
          },
          "dateFormat": {
            "type": "string"
          },
          "dayText": {
            "type": "string"
          },
          "deleteButtonText": {
            "type": "string"
          },
          "deleteConfirmationMsgText": {
            "type": "string"
          },
          "deleteMsgText": {
            "type": "string"
          },
          "deleteOneTimePurchaseProduct": {
            "type": "boolean"
          },
          "deleteProductFlag": {
            "type": "boolean"
          },
          "deleteProductTitleText": {
            "type": "string"
          },
          "deliveryFrequencyText": {
            "type": "string"
          },
          "deliveryPriceText": {
            "type": "string"
          },
          "disAllowProductIdsForOneTimeProductAdd": {
            "type": "string"
          },
          "disAllowProductTagsForSubscriptionProductAdd": {
            "type": "string"
          },
          "disAllowVariantIdsForOneTimeProductAdd": {
            "type": "string"
          },
          "disAllowVariantIdsForSubscriptionProductAdd": {
            "type": "string"
          },
          "disableRescheduleTimeSelector": {
            "type": "boolean"
          },
          "disabledKeyFieldFlag": {
            "type": "boolean"
          },
          "discountAccordionTitle": {
            "type": "string"
          },
          "discountAlreadyUsedWarningText": {
            "type": "string"
          },
          "discountAppliedTextV2": {
            "type": "string"
          },
          "discountCarryForward": {
            "enum": [
              "NONE",
              "EXISTING_PLAN",
              "PRODUCT_PLAN",
              "PRODUCT_THEN_EXISTING"
            ],
            "type": "string"
          },
          "discountCode": {
            "type": "boolean"
          },
          "discountCodeApplyButtonText": {
            "type": "string"
          },
          "discountCodeText": {
            "type": "string"
          },
          "discountCouponAppliedText": {
            "type": "string"
          },
          "discountCouponNotAppliedText": {
            "type": "string"
          },
          "discountCouponRemoveText": {
            "type": "string"
          },
          "discountDetailsTitleText": {
            "type": "string"
          },
          "discountMessageOnCancellation": {
            "type": "string"
          },
          "discountMessageOnPause": {
            "type": "string"
          },
          "discountNoteTitle": {
            "type": "string"
          },
          "discountPercentageOnCancellation": {
            "type": "string"
          },
          "discountRecurringCycleLimitOnCancellation": {
            "type": "string"
          },
          "displayCountryByLanguage": {
            "type": "boolean"
          },
          "editChangeOrderBtnText": {
            "type": "string"
          },
          "editCommonText": {
            "type": "string"
          },
          "editDeliveryInternalText": {
            "type": "string"
          },
          "editFrequencyBtnText": {
            "type": "string"
          },
          "editProductButtonText": {
            "type": "string"
          },
          "editProductFlag": {
            "type": "boolean"
          },
          "editQuantityLabelText": {
            "type": "string"
          },
          "emailAddressText": {
            "type": "string"
          },
          "emailMagicLinkText": {
            "type": "string"
          },
          "enableAllowOnlyOneDiscountCode": {
            "type": "boolean"
          },
          "enableEditAttributes": {
            "type": "boolean"
          },
          "enableEditOrderNotes": {
            "type": "boolean"
          },
          "enableMergeContract": {
            "type": "boolean"
          },
          "enableProductDescription": {
            "type": "boolean"
          },
          "enableRedirectMyAccountButton": {
            "type": "boolean"
          },
          "enableRedirectToProductPage": {
            "type": "boolean"
          },
          "enableSkipFulFillment": {
            "type": "boolean"
          },
          "enableSkipIndividualProduct": {
            "type": "boolean"
          },
          "enableSplitContract": {
            "type": "boolean"
          },
          "enableSwapProductFeature": {
            "type": "boolean"
          },
          "enableSwapProductVariant": {
            "type": "boolean"
          },
          "enableTabletForceView": {
            "type": "boolean"
          },
          "enableUpdateDeliveryMethod": {
            "type": "boolean"
          },
          "enableUpsellProducts": {
            "type": "boolean"
          },
          "enableViewAttributes": {
            "type": "boolean"
          },
          "endingWithText": {
            "type": "string"
          },
          "everyLabelText": {
            "type": "string"
          },
          "expectedShopCustomizationData": {
            "items": {
              "$ref": "#/components/schemas/UpdateShopCustomizationRequest"
            },
            "type": "array"
          },
          "expiredTokenText": {
            "type": "string"
          },
          "failureText": {
            "type": "string"
          },
          "filterDeliveryFrequencyOnCustomerTags": {
            "type": "boolean"
          },
          "finishLabelText": {
            "type": "string"
          },
          "firstNameLabelText": {
            "type": "string"
          },
          "freezeOrderTillMinCycle": {
            "type": "boolean"
          },
          "freezeUpdateSubscriptionMessage": {
            "type": "string"
          },
          "frequencyChangeWarningDescription": {
            "type": "string"
          },
          "frequencyChangeWarningTitle": {
            "type": "string"
          },
          "fromDeliveryDateAddDay": {
            "format": "int32",
            "type": "integer"
          },
          "fulfilledText": {
            "type": "string"
          },
          "giftMessageOnPause": {
            "type": "string"
          },
          "goBackButtonText": {
            "type": "string"
          },
          "goBackRedirectLink": {
            "type": "string"
          },
          "greetingText": {
            "type": "string"
          },
          "hasBeenRemovedText": {
            "type": "string"
          },
          "helloNameText": {
            "type": "string"
          },
          "hideAddSubscriptionProductSection": {
            "type": "boolean"
          },
          "hideAttributeAddition": {
            "type": "boolean"
          },
          "hideDetailsText": {
            "type": "string"
          },
          "hideHistoryTabNewCp": {
            "type": "boolean"
          },
          "hideLoyaltyTable": {
            "type": "boolean"
          },
          "hidePaymentMethodEdit": {
            "type": "boolean"
          },
          "hideRescheduleTimeInExtension": {
            "type": "boolean"
          },
          "hideResumeButtonWhenMaxCycleReached": {
            "type": "boolean"
          },
          "hideSchedulesTabNewCp": {
            "type": "boolean"
          },
          "historyTabHeaderHTML": {
            "type": "string"
          },
          "historyTabTitle": {
            "type": "string"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "includeOutOfStockProduct": {
            "type": "boolean"
          },
          "initialDiscountNoteDescription": {
            "type": "string"
          },
          "lastNameLabelText": {
            "type": "string"
          },
          "localeDate": {
            "type": "string"
          },
          "magicLinkEmailFlag": {
            "type": "boolean"
          },
          "manageSubscriptionButtonText": {
            "type": "string"
          },
          "maxCycleText": {
            "type": "string"
          },
          "maxIterationReachedText": {
            "type": "string"
          },
          "minCycleText": {
            "type": "string"
          },
          "minOrderValue": {
            "format": "double",
            "type": "number"
          },
          "minProductsInSubscriptionContract": {
            "type": "string"
          },
          "minQtyToAllowDuringAddProduct": {
            "format": "int32",
            "type": "integer"
          },
          "monthText": {
            "type": "string"
          },
          "multiCurrencyAvailable": {
            "type": "boolean"
          },
          "nextBtnText": {
            "type": "string"
          },
          "nextDeliveryDate": {
            "type": "string"
          },
          "nextOrderDateLbl": {
            "type": "string"
          },
          "nextOrderText": {
            "type": "string"
          },
          "nextTierAmountTieredDiscountText": {
            "type": "string"
          },
          "nextTierPercentageTieredDiscountText": {
            "type": "string"
          },
          "noBtnText": {
            "type": "string"
          },
          "noDeliveryMethodLabelText": {
            "type": "string"
          },
          "noOrderNotAvailableMessage": {
            "type": "string"
          },
          "noSubscriptionMessage": {
            "type": "string"
          },
          "offerDiscountOnCancellation": {
            "type": "boolean"
          },
          "oneTimePurchaseDisplayMessageText": {
            "type": "string"
          },
          "oneTimePurchaseMessageText": {
            "type": "string"
          },
          "oneTimePurchaseNoteText": {
            "type": "string"
          },
          "oneTimePurchaseOnlyText": {
            "type": "string"
          },
          "oneTimePurchaseTitleCP": {
            "type": "string"
          },
          "openBadgeText": {
            "type": "string"
          },
          "orderDateText": {
            "type": "string"
          },
          "orderFrequencyText": {
            "type": "string"
          },
          "orderNoLbl": {
            "type": "string"
          },
          "orderNoteFlag": {
            "type": "boolean"
          },
          "orderNoteText": {
            "type": "string"
          },
          "orderNowDescriptionText": {
            "type": "string"
          },
          "orderNowText": {
            "type": "string"
          },
          "orderTotalText": {
            "type": "string"
          },
          "overrideDaysToRescheduleOrder": {
            "type": "boolean"
          },
          "pauseAccordionTitle": {
            "type": "string"
          },
          "pauseBadgeText": {
            "type": "string"
          },
          "pauseMessageOnPause": {
            "type": "string"
          },
          "pauseNoteTitleText": {
            "type": "string"
          },
          "pauseResumeSub": {
            "type": "boolean"
          },
          "pauseSubscriptionText": {
            "type": "string"
          },
          "pauseTillDateTitleText": {
            "type": "string"
          },
          "paymentDetailAccordionTitle": {
            "type": "string"
          },
          "paymentInfoText": {
            "type": "string"
          },
          "paymentMethodTypeText": {
            "type": "string"
          },
          "paymentNotificationText": {
            "type": "string"
          },
          "paypalLblText": {
            "type": "string"
          },
          "percentageTieredDiscountText": {
            "type": "string"
          },
          "phoneLabelText": {
            "type": "string"
          },
          "pleaseSelectText": {
            "type": "string"
          },
          "pleaseWaitLoaderText": {
            "type": "string"
          },
          "popUpErrorMessage": {
            "type": "string"
          },
          "popUpSuccessMessage": {
            "type": "string"
          },
          "portalLoginLinkText": {
            "type": "string"
          },
          "preventAddRemoveSwapBeforeDays": {
            "type": "string"
          },
          "preventCancellationBeforeDays": {
            "type": "string"
          },
          "preventCancellationBeforeDaysMessage": {
            "type": "string"
          },
          "preventChildProductSwap": {
            "type": "boolean"
          },
          "previousBtnText": {
            "type": "string"
          },
          "priceLbl": {
            "type": "string"
          },
          "productAddMessageText": {
            "type": "string"
          },
          "productFilterConfig": {
            "type": "string"
          },
          "productInSubscriptionText": {
            "type": "string"
          },
          "productLabelText": {
            "type": "string"
          },
          "productLblText": {
            "type": "string"
          },
          "productRemovedTooltip": {
            "type": "string"
          },
          "productSelectionOption": {
            "enum": [
              "ALL_PRODUCTS",
              "PRODUCTS_FROM_ALL_PLANS",
              "PRODUCTS_FROM_CURRENT_PLAN"
            ],
            "type": "string"
          },
          "provinceCodeLabelText": {
            "type": "string"
          },
          "provinceLabelText": {
            "type": "string"
          },
          "purchaseOptionLabelText": {
            "type": "string"
          },
          "quantityLbl": {
            "type": "string"
          },
          "queueBadgeText": {
            "type": "string"
          },
          "redeemRewardsTextV2": {
            "type": "string"
          },
          "removeDiscountCodeAlertText": {
            "type": "string"
          },
          "removeDiscountCodeAutomatically": {
            "type": "boolean"
          },
          "removeDiscountCodeLabel": {
            "type": "string"
          },
          "removeSwapSourceProductLimit": {
            "type": "boolean"
          },
          "requireFieldMessage": {
            "type": "string"
          },
          "rescheduleOrderDescription": {
            "type": "string"
          },
          "rescheduleText": {
            "type": "string"
          },
          "reschedulingPolicies": {
            "type": "string"
          },
          "resumeSub": {
            "type": "boolean"
          },
          "resumeSubAfterCancellation": {
            "type": "boolean"
          },
          "resumeSubscriptionText": {
            "type": "string"
          },
          "retriveMagicLinkText": {
            "type": "string"
          },
          "retryFailedOrderConfirmationTextV2": {
            "type": "string"
          },
          "retryFailedOrderDescriptionTextV2": {
            "type": "string"
          },
          "rewardsTextV2": {
            "type": "string"
          },
          "saveButtonText": {
            "type": "string"
          },
          "scheduledTabTitle": {
            "type": "string"
          },
          "schedulesTabHeaderHTML": {
            "type": "string"
          },
          "searchProductBtnText": {
            "type": "string"
          },
          "sectionMinMaxTextV2": {
            "type": "string"
          },
          "sectionTitleText": {
            "type": "string"
          },
          "sectionedBabBadgeText": {
            "type": "string"
          },
          "seeMoreDetailsText": {
            "type": "string"
          },
          "seeMoreProductBtnText": {
            "type": "string"
          },
          "selectCancellationReasonLabelText": {
            "type": "string"
          },
          "selectPaymentMethodTitleText": {
            "type": "string"
          },
          "selectProductLabelText": {
            "type": "string"
          },
          "selectProductToAdd": {
            "type": "string"
          },
          "selectSplitMethodLabelText": {
            "type": "string"
          },
          "selectedCancellationReasonTitleText": {
            "type": "string"
          },
          "selectedPauseReasonTitleText": {
            "type": "string"
          },
          "selectedProductLabelTextV2": {
            "type": "string"
          },
          "sellingPlanFrequencyOptionMode": {
            "enum": [
              "LEGACY_UNION",
              "COMPATIBLE_ONLY"
            ],
            "type": "string"
          },
          "sellingPlanNameText": {
            "type": "string"
          },
          "sendEmailText": {
            "type": "string"
          },
          "settingsVersion": {
            "type": "string"
          },
          "shippingAddressNotAvailableText": {
            "type": "string"
          },
          "shippingLabelText": {
            "type": "string"
          },
          "shippingOptionText": {
            "type": "string"
          },
          "shop": {
            "type": "string"
          },
          "shopCustomizationData": {
            "items": {
              "$ref": "#/components/schemas/UpdateShopCustomizationRequest"
            },
            "type": "array"
          },
          "shopPayLblText": {
            "type": "string"
          },
          "shopPayPaymentUpdateText": {
            "type": "string"
          },
          "showNextOrderDeliveryDate": {
            "type": "boolean"
          },
          "showSellingPlanFrequencies": {
            "type": "boolean"
          },
          "showShipment": {
            "type": "boolean"
          },
          "showSwapOnlyForOutOfStockBABProducts": {
            "type": "boolean"
          },
          "singleBABDeletedProductPlaceholderImage": {
            "type": "string"
          },
          "skipBadgeText": {
            "type": "string"
          },
          "skipDaysFromCurrentDate": {
            "format": "int32",
            "type": "integer"
          },
          "skipDaysToCurrentDate": {
            "format": "int32",
            "type": "integer"
          },
          "skipFulfillmentButtonText": {
            "type": "string"
          },
          "skipMessageOnPause": {
            "type": "string"
          },
          "skipOrderButtonText": {
            "type": "string"
          },
          "splitContractConfirmButtonText": {
            "type": "string"
          },
          "splitContractMessage": {
            "type": "string"
          },
          "splitContractNoteText": {
            "type": "string"
          },
          "splitContractText": {
            "type": "string"
          },
          "splitWithOrderPlacedSelectOptionHelpText": {
            "type": "string"
          },
          "splitWithOrderPlacedSelectOptionText": {
            "type": "string"
          },
          "splitWithoutOrderPlacedSelectOptionHelpText": {
            "type": "string"
          },
          "splitWithoutOrderPlacedSelectOptionText": {
            "type": "string"
          },
          "statusLbl": {
            "type": "string"
          },
          "statusText": {
            "type": "string"
          },
          "subTotalLabelText": {
            "type": "string"
          },
          "subscriptionActivatedMessageText": {
            "type": "string"
          },
          "subscriptionContractFreezeMessage": {
            "type": "string"
          },
          "subscriptionDiscount": {
            "format": "double",
            "type": "number"
          },
          "subscriptionDiscountTypeUnit": {
            "enum": [
              "PERCENTAGE",
              "AMOUNT"
            ],
            "type": "string"
          },
          "subscriptionNoText": {
            "type": "string"
          },
          "subscriptionPausedMessageText": {
            "type": "string"
          },
          "successText": {
            "type": "string"
          },
          "swapMessageOnPause": {
            "type": "string"
          },
          "swapProductBtnText": {
            "type": "string"
          },
          "swapProductLabelText": {
            "type": "string"
          },
          "swapProductSearchBarText": {
            "type": "string"
          },
          "toDeliveryDateAddDay": {
            "format": "int32",
            "type": "integer"
          },
          "topHtml": {
            "type": "string"
          },
          "totalLblText": {
            "type": "string"
          },
          "totalPricePerDeliveryText": {
            "type": "string"
          },
          "totalProductsText": {
            "type": "string"
          },
          "unableToUpdateSubscriptionStatusMessageText": {
            "type": "string"
          },
          "unknownPaymentReachoutUsText": {
            "type": "string"
          },
          "upSellMessage": {
            "type": "string"
          },
          "upcomingFulfillmentText": {
            "type": "string"
          },
          "upcomingOrderAccordionTitle": {
            "type": "string"
          },
          "upcomingOrderChangePopupFailureClosebtnText": {
            "type": "string"
          },
          "upcomingOrderChangePopupFailureDescriptionText": {
            "type": "string"
          },
          "upcomingOrderChangePopupFailureTitleText": {
            "type": "string"
          },
          "upcomingOrderChangePopupSuccessClosebtnText": {
            "type": "string"
          },
          "upcomingOrderChangePopupSuccessDescriptionText": {
            "type": "string"
          },
          "upcomingOrderChangePopupSuccessTitleText": {
            "type": "string"
          },
          "upcomingOrderPlaceNowAlertText": {
            "type": "string"
          },
          "upcomingOrderSkipAlertText": {
            "type": "string"
          },
          "upcomingTabHeaderHTML": {
            "type": "string"
          },
          "upcomingTabTitle": {
            "type": "string"
          },
          "updateButtonText": {
            "type": "string"
          },
          "updateChangeOrderBtnText": {
            "type": "string"
          },
          "updateEditShippingButtonText": {
            "type": "string"
          },
          "updateFreqBtnText": {
            "type": "string"
          },
          "updateFrequencyMessageOnPause": {
            "type": "string"
          },
          "updatePaymentBtnText": {
            "type": "string"
          },
          "updatePaymentMessage": {
            "type": "string"
          },
          "updatePaymentMethodTitleText": {
            "type": "string"
          },
          "updateShipmentBillingDate": {
            "type": "boolean"
          },
          "upsellOrderForAllProducts": {
            "type": "boolean"
          },
          "useUrlWithCustomerId": {
            "type": "boolean"
          },
          "validEmailMessage": {
            "type": "string"
          },
          "validNumberRequiredMessage": {
            "type": "string"
          },
          "variantIdsToFreezeEditRemove": {
            "type": "string"
          },
          "variantLbl": {
            "type": "string"
          },
          "variantLblText": {
            "type": "string"
          },
          "viewAttributeLabelText": {
            "type": "string"
          },
          "viewMoreText": {
            "type": "string"
          },
          "weekText": {
            "type": "string"
          },
          "welcomeText": {
            "type": "string"
          },
          "yearText": {
            "type": "string"
          },
          "yesBtnText": {
            "type": "string"
          },
          "yourAvailableRewardsPointsTextV2": {
            "type": "string"
          },
          "yourRewardsTextV2": {
            "type": "string"
          },
          "zipLabelText": {
            "type": "string"
          }
        },
        "required": [
          "amountLbl",
          "cancelAccordionTitle",
          "cancelFreqBtnText",
          "cancelSubscriptionBtnText",
          "cardExpiryText",
          "cardHolderNameText",
          "cardLastFourDigitText",
          "cardTypeText",
          "editFrequencyBtnText",
          "nextOrderDateLbl",
          "nextOrderText",
          "noSubscriptionMessage",
          "orderFrequencyText",
          "orderNoLbl",
          "paymentDetailAccordionTitle",
          "paymentInfoText",
          "paymentMethodTypeText",
          "quantityLbl",
          "shop",
          "statusLbl",
          "statusText",
          "subscriptionNoText",
          "totalProductsText",
          "upcomingOrderAccordionTitle",
          "updateFreqBtnText",
          "updatePaymentBtnText",
          "updatePaymentMessage"
        ],
        "type": "object"
      },
      "CustomerRetentionActivityResponse": {
        "properties": {
          "activityOn": {
            "type": "string"
          },
          "additionalInfo": {
            "type": "string"
          },
          "cancellationReason": {
            "type": "string"
          },
          "contractId": {
            "format": "int64",
            "type": "integer"
          },
          "customerEmail": {
            "type": "string"
          },
          "customerName": {
            "type": "string"
          },
          "discountApplied": {
            "type": "string"
          },
          "eventSource": {
            "enum": [
              "PAUSE",
              "CANCELLATION"
            ],
            "type": "string"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "retentionAction": {
            "type": "string"
          },
          "shop": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "CustomerTokenInfo": {
        "properties": {
          "appstleExternalToken": {
            "type": "string"
          },
          "customerId": {
            "format": "int64",
            "type": "integer"
          },
          "token": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "CycleDiscount": {
        "properties": {
          "adjustmentType": {
            "enum": [
              "PERCENTAGE",
              "FIXED_AMOUNT",
              "PRICE",
              "$UNKNOWN"
            ],
            "type": "string"
          },
          "adjustmentValue": {
            "$ref": "#/components/schemas/AdjustmentValue"
          },
          "afterCycle": {
            "format": "int32",
            "type": "integer"
          },
          "computedPrice": {
            "$ref": "#/components/schemas/ComputedPrice"
          },
          "get__typename": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "Data": {
        "properties": {
          "subscriptionContract": {
            "$ref": "#/components/schemas/SubscriptionContract"
          }
        },
        "type": "object"
      },
      "DeliveryCountryInfo": {
        "properties": {
          "code": {
            "type": "string"
          },
          "provinceCode": {
            "type": "string"
          },
          "restOfWorld": {
            "type": "boolean"
          },
          "shouldIncludeAllProvince": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "DeliveryMethod": {
        "properties": {
          "get__typename": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "DeliveryMethodInfo": {
        "properties": {
          "amount": {
            "format": "double",
            "type": "number"
          },
          "carrierRate": {
            "type": "boolean"
          },
          "carrierServiceId": {
            "type": "string"
          },
          "currencyCode": {
            "enum": [
              "USD",
              "EUR",
              "GBP",
              "CAD",
              "AFN",
              "ALL",
              "DZD",
              "AOA",
              "ARS",
              "AMD",
              "AWG",
              "AUD",
              "BBD",
              "AZN",
              "BDT",
              "BSD",
              "BHD",
              "BIF",
              "BYN",
              "BZD",
              "BMD",
              "BTN",
              "BAM",
              "BRL",
              "BOB",
              "BWP",
              "BND",
              "BGN",
              "MMK",
              "KHR",
              "CVE",
              "KYD",
              "XAF",
              "CLP",
              "CNY",
              "COP",
              "KMF",
              "CDF",
              "CRC",
              "HRK",
              "CZK",
              "DKK",
              "DJF",
              "DOP",
              "XCD",
              "EGP",
              "ERN",
              "ETB",
              "FKP",
              "XPF",
              "FJD",
              "GIP",
              "GMD",
              "GHS",
              "GTQ",
              "GYD",
              "GEL",
              "GNF",
              "HTG",
              "HNL",
              "HKD",
              "HUF",
              "ISK",
              "INR",
              "IDR",
              "ILS",
              "IRR",
              "IQD",
              "JMD",
              "JPY",
              "JEP",
              "JOD",
              "KZT",
              "KES",
              "KID",
              "KWD",
              "KGS",
              "LAK",
              "LVL",
              "LBP",
              "LSL",
              "LRD",
              "LYD",
              "LTL",
              "MGA",
              "MKD",
              "MOP",
              "MWK",
              "MVR",
              "MRU",
              "MXN",
              "MYR",
              "MUR",
              "MDL",
              "MAD",
              "MNT",
              "MZN",
              "NAD",
              "NPR",
              "ANG",
              "NZD",
              "NIO",
              "NGN",
              "NOK",
              "OMR",
              "PAB",
              "PKR",
              "PGK",
              "PYG",
              "PEN",
              "PHP",
              "PLN",
              "QAR",
              "RON",
              "RUB",
              "RWF",
              "WST",
              "SHP",
              "SAR",
              "RSD",
              "SCR",
              "SLL",
              "SGD",
              "SDG",
              "SOS",
              "SYP",
              "ZAR",
              "KRW",
              "SSP",
              "SBD",
              "LKR",
              "SRD",
              "SZL",
              "SEK",
              "CHF",
              "TWD",
              "THB",
              "TJS",
              "TZS",
              "TOP",
              "TTD",
              "TND",
              "TRY",
              "TMT",
              "UGX",
              "UAH",
              "AED",
              "UYU",
              "UZS",
              "VUV",
              "VES",
              "VND",
              "XOF",
              "YER",
              "ZMW",
              "USDC",
              "BYR",
              "STD",
              "STN",
              "VED",
              "VEF",
              "XXX",
              "$UNKNOWN"
            ],
            "type": "string"
          },
          "deliveryConditionType": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "priceConditions": {
            "items": {
              "$ref": "#/components/schemas/PriceCondition"
            },
            "type": "array"
          },
          "weightConditions": {
            "items": {
              "$ref": "#/components/schemas/WeightCondition"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "DeliveryMethodInfoV3": {
        "properties": {
          "amount": {
            "format": "double",
            "type": "number"
          },
          "carrierFixedFee": {
            "format": "double",
            "type": "number"
          },
          "carrierPercentageFee": {
            "format": "double",
            "type": "number"
          },
          "carrierServiceId": {
            "type": "string"
          },
          "currencyCode": {
            "enum": [
              "USD",
              "EUR",
              "GBP",
              "CAD",
              "AFN",
              "ALL",
              "DZD",
              "AOA",
              "ARS",
              "AMD",
              "AWG",
              "AUD",
              "BBD",
              "AZN",
              "BDT",
              "BSD",
              "BHD",
              "BIF",
              "BYN",
              "BZD",
              "BMD",
              "BTN",
              "BAM",
              "BRL",
              "BOB",
              "BWP",
              "BND",
              "BGN",
              "MMK",
              "KHR",
              "CVE",
              "KYD",
              "XAF",
              "CLP",
              "CNY",
              "COP",
              "KMF",
              "CDF",
              "CRC",
              "HRK",
              "CZK",
              "DKK",
              "DJF",
              "DOP",
              "XCD",
              "EGP",
              "ERN",
              "ETB",
              "FKP",
              "XPF",
              "FJD",
              "GIP",
              "GMD",
              "GHS",
              "GTQ",
              "GYD",
              "GEL",
              "GNF",
              "HTG",
              "HNL",
              "HKD",
              "HUF",
              "ISK",
              "INR",
              "IDR",
              "ILS",
              "IRR",
              "IQD",
              "JMD",
              "JPY",
              "JEP",
              "JOD",
              "KZT",
              "KES",
              "KID",
              "KWD",
              "KGS",
              "LAK",
              "LVL",
              "LBP",
              "LSL",
              "LRD",
              "LYD",
              "LTL",
              "MGA",
              "MKD",
              "MOP",
              "MWK",
              "MVR",
              "MRU",
              "MXN",
              "MYR",
              "MUR",
              "MDL",
              "MAD",
              "MNT",
              "MZN",
              "NAD",
              "NPR",
              "ANG",
              "NZD",
              "NIO",
              "NGN",
              "NOK",
              "OMR",
              "PAB",
              "PKR",
              "PGK",
              "PYG",
              "PEN",
              "PHP",
              "PLN",
              "QAR",
              "RON",
              "RUB",
              "RWF",
              "WST",
              "SHP",
              "SAR",
              "RSD",
              "SCR",
              "SLL",
              "SGD",
              "SDG",
              "SOS",
              "SYP",
              "ZAR",
              "KRW",
              "SSP",
              "SBD",
              "LKR",
              "SRD",
              "SZL",
              "SEK",
              "CHF",
              "TWD",
              "THB",
              "TJS",
              "TZS",
              "TOP",
              "TTD",
              "TND",
              "TRY",
              "TMT",
              "UGX",
              "UAH",
              "AED",
              "UYU",
              "UZS",
              "VUV",
              "VES",
              "VND",
              "XOF",
              "YER",
              "ZMW",
              "USDC",
              "BYR",
              "STD",
              "STN",
              "VED",
              "VEF",
              "XXX",
              "$UNKNOWN"
            ],
            "type": "string"
          },
          "definitionType": {
            "type": "string"
          },
          "deliveryConditionType": {
            "type": "string"
          },
          "maxValue": {
            "format": "double",
            "type": "number"
          },
          "minValue": {
            "format": "double",
            "type": "number"
          },
          "name": {
            "type": "string"
          },
          "weightUnit": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "DeliveryPolicy": {
        "properties": {
          "anchors": {
            "items": {
              "$ref": "#/components/schemas/Anchor1"
            },
            "type": "array"
          },
          "get__typename": {
            "type": "string"
          },
          "interval": {
            "enum": [
              "DAY",
              "WEEK",
              "MONTH",
              "YEAR",
              "$UNKNOWN"
            ],
            "type": "string"
          },
          "intervalCount": {
            "format": "int32",
            "type": "integer"
          }
        },
        "type": "object"
      },
      "DeliveryPrice": {
        "properties": {
          "amount": {
            "type": "object"
          },
          "currencyCode": {
            "enum": [
              "USD",
              "EUR",
              "GBP",
              "CAD",
              "AFN",
              "ALL",
              "DZD",
              "AOA",
              "ARS",
              "AMD",
              "AWG",
              "AUD",
              "BBD",
              "AZN",
              "BDT",
              "BSD",
              "BHD",
              "BIF",
              "BYN",
              "BZD",
              "BMD",
              "BTN",
              "BAM",
              "BRL",
              "BOB",
              "BWP",
              "BND",
              "BGN",
              "MMK",
              "KHR",
              "CVE",
              "KYD",
              "XAF",
              "CLP",
              "CNY",
              "COP",
              "KMF",
              "CDF",
              "CRC",
              "HRK",
              "CZK",
              "DKK",
              "DJF",
              "DOP",
              "XCD",
              "EGP",
              "ERN",
              "ETB",
              "FKP",
              "XPF",
              "FJD",
              "GIP",
              "GMD",
              "GHS",
              "GTQ",
              "GYD",
              "GEL",
              "GNF",
              "HTG",
              "HNL",
              "HKD",
              "HUF",
              "ISK",
              "INR",
              "IDR",
              "ILS",
              "IRR",
              "IQD",
              "JMD",
              "JPY",
              "JEP",
              "JOD",
              "KZT",
              "KES",
              "KID",
              "KWD",
              "KGS",
              "LAK",
              "LVL",
              "LBP",
              "LSL",
              "LRD",
              "LYD",
              "LTL",
              "MGA",
              "MKD",
              "MOP",
              "MWK",
              "MVR",
              "MRU",
              "MXN",
              "MYR",
              "MUR",
              "MDL",
              "MAD",
              "MNT",
              "MZN",
              "NAD",
              "NPR",
              "ANG",
              "NZD",
              "NIO",
              "NGN",
              "NOK",
              "OMR",
              "PAB",
              "PKR",
              "PGK",
              "PYG",
              "PEN",
              "PHP",
              "PLN",
              "QAR",
              "RON",
              "RUB",
              "RWF",
              "WST",
              "SHP",
              "SAR",
              "RSD",
              "SCR",
              "SLL",
              "SGD",
              "SDG",
              "SOS",
              "SYP",
              "ZAR",
              "KRW",
              "SSP",
              "SBD",
              "LKR",
              "SRD",
              "SZL",
              "SEK",
              "CHF",
              "TWD",
              "THB",
              "TJS",
              "TZS",
              "TOP",
              "TTD",
              "TND",
              "TRY",
              "TMT",
              "UGX",
              "UAH",
              "AED",
              "UYU",
              "UZS",
              "VUV",
              "VES",
              "VND",
              "XOF",
              "YER",
              "ZMW",
              "USDC",
              "BYR",
              "STD",
              "STN",
              "VED",
              "VEF",
              "XXX",
              "$UNKNOWN"
            ],
            "type": "string"
          },
          "get__typename": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "DeliveryProfileDTO": {
        "properties": {
          "deliveryProfileId": {
            "type": "string"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "sellerGroupIds": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "uniqueItems": true
          },
          "shop": {
            "type": "string"
          }
        },
        "required": [
          "deliveryProfileId",
          "shop"
        ],
        "type": "object"
      },
      "Discount": {
        "properties": {
          "get__typename": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "DiscountAllocation": {
        "properties": {
          "amount": {
            "$ref": "#/components/schemas/Amount"
          },
          "discount": {
            "$ref": "#/components/schemas/Discount"
          },
          "get__typename": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "DiscountCodeRequest": {
        "description": "Discount Code Request",
        "properties": {
          "cart": {
            "$ref": "#/components/schemas/Cart"
          }
        },
        "type": "object"
      },
      "DiscountCodeResponse": {
        "properties": {
          "discountAmount": {
            "format": "double",
            "type": "number"
          },
          "discountCode": {
            "type": "string"
          },
          "discountNeeded": {
            "type": "boolean"
          },
          "errorMessage": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "Discounts": {
        "properties": {
          "get__typename": {
            "type": "string"
          },
          "nodes": {
            "items": {
              "$ref": "#/components/schemas/Node2"
            },
            "type": "array"
          },
          "pageInfo": {
            "$ref": "#/components/schemas/PageInfo2"
          }
        },
        "type": "object"
      },
      "FeaturedImage": {
        "properties": {
          "alt": {
            "type": "string"
          },
          "aspect_ratio": {
            "format": "int64",
            "type": "integer"
          },
          "height": {
            "format": "int64",
            "type": "integer"
          },
          "url": {
            "type": "string"
          },
          "width": {
            "format": "int64",
            "type": "integer"
          }
        },
        "type": "object"
      },
      "FixedBillingDate": {
        "properties": {
          "day": {
            "format": "int32",
            "type": "integer"
          },
          "month": {
            "format": "int32",
            "type": "integer"
          }
        },
        "type": "object"
      },
      "FreeProductEntry": {
        "description": "A single free product gifted on a FREE_PRODUCT cycle rule",
        "properties": {
          "freeProductHandle": {
            "description": "Product handle of the free product",
            "example": "free-gift-product",
            "type": "string"
          },
          "freeProductImage": {
            "description": "Image URL of the free product",
            "example": "https://cdn.shopify.com/s/files/1/0000/0000/products/mug.jpg",
            "type": "string"
          },
          "freeProductTitle": {
            "description": "Display title of the free product",
            "example": "Ceramic Mug",
            "type": "string"
          },
          "freeVariantId": {
            "description": "Variant ID of the free product",
            "example": 42549172011164,
            "format": "int64",
            "type": "integer"
          }
        },
        "type": "object"
      },
      "FrequencyInfoDTO": {
        "properties": {
          "afterCycle1": {
            "format": "int32",
            "type": "integer"
          },
          "afterCycle2": {
            "format": "int32",
            "type": "integer"
          },
          "appstleCycles": {
            "items": {
              "$ref": "#/components/schemas/AppstleCycle"
            },
            "type": "array"
          },
          "billingFrequencyCount": {
            "format": "int32",
            "type": "integer"
          },
          "billingFrequencyInterval": {
            "enum": [
              "DAY",
              "WEEK",
              "MONTH",
              "YEAR"
            ],
            "type": "string"
          },
          "cutOff": {
            "format": "int32",
            "type": "integer"
          },
          "defaultSelectedPlan": {
            "type": "boolean"
          },
          "deliveryPolicyPreAnchorBehavior": {
            "enum": [
              "ASAP",
              "NEXT",
              "$UNKNOWN"
            ],
            "type": "string"
          },
          "discountEnabled": {
            "type": "boolean"
          },
          "discountEnabled2": {
            "type": "boolean"
          },
          "discountEnabled2Masked": {
            "type": "boolean"
          },
          "discountEnabledMasked": {
            "type": "boolean"
          },
          "discountOffer": {
            "format": "double",
            "type": "number"
          },
          "discountOffer2": {
            "format": "double",
            "type": "number"
          },
          "discountType": {
            "enum": [
              "PERCENTAGE",
              "FIXED",
              "PRICE"
            ],
            "type": "string"
          },
          "discountType2": {
            "enum": [
              "PERCENTAGE",
              "FIXED",
              "PRICE"
            ],
            "type": "string"
          },
          "fixedBillingDates": {
            "items": {
              "$ref": "#/components/schemas/FixedBillingDate"
            },
            "type": "array"
          },
          "formFieldJson": {
            "type": "string"
          },
          "freeTrialCount": {
            "format": "int32",
            "type": "integer"
          },
          "freeTrialEnabled": {
            "type": "boolean"
          },
          "freeTrialInterval": {
            "enum": [
              "DAY",
              "WEEK",
              "MONTH",
              "YEAR"
            ],
            "type": "string"
          },
          "frequencyCount": {
            "format": "int32",
            "type": "integer"
          },
          "frequencyDescription": {
            "type": "string"
          },
          "frequencyInterval": {
            "enum": [
              "DAY",
              "WEEK",
              "MONTH",
              "YEAR"
            ],
            "type": "string"
          },
          "frequencyName": {
            "type": "string"
          },
          "frequencyNameTranslations": {
            "additionalProperties": {
              "additionalProperties": {
                "type": "string"
              },
              "type": "object"
            },
            "type": "object"
          },
          "frequencySequence": {
            "format": "int32",
            "type": "integer"
          },
          "frequencyType": {
            "enum": [
              "ON_PURCHASE_DAY",
              "ON_SPECIFIC_DAY",
              "ON_FIXED_DATES"
            ],
            "type": "string"
          },
          "gift": {
            "type": "boolean"
          },
          "giftSendMaxDays": {
            "format": "int32",
            "type": "integer"
          },
          "groupId": {
            "format": "int64",
            "type": "integer"
          },
          "groupName": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "idNew": {
            "type": "string"
          },
          "inventoryPolicyReserve": {
            "enum": [
              "ON_FULFILLMENT",
              "ON_SALE",
              "$UNKNOWN"
            ],
            "type": "string"
          },
          "keepOriginalNextBillingDateAfterTrial": {
            "type": "boolean"
          },
          "maxCycles": {
            "format": "int32",
            "type": "integer"
          },
          "memberExclusiveTags": {
            "type": "string"
          },
          "memberInclusiveTags": {
            "type": "string"
          },
          "memberOnly": {
            "type": "boolean"
          },
          "minCycles": {
            "format": "int32",
            "type": "integer"
          },
          "minQuantity": {
            "format": "int32",
            "type": "integer"
          },
          "nonMemberOnly": {
            "type": "boolean"
          },
          "payAsYouGoPrepaidBillingFrequencyCount": {
            "format": "int32",
            "type": "integer"
          },
          "planType": {
            "enum": [
              "PAY_AS_YOU_GO",
              "PREPAID",
              "ADVANCED_PREPAID",
              "PAY_AS_YOU_GO_PREPAID"
            ],
            "type": "string"
          },
          "prepaidFlag": {
            "type": "string"
          },
          "repeatingCycle": {
            "type": "boolean"
          },
          "repeatingNumberOfCycle": {
            "format": "int32",
            "type": "integer"
          },
          "specificDayEnabled": {
            "type": "boolean"
          },
          "specificDayValue": {
            "format": "int32",
            "type": "integer"
          },
          "specificMonthValue": {
            "format": "int32",
            "type": "integer"
          },
          "upcomingOrderEmailBuffer": {
            "format": "int32",
            "type": "integer"
          }
        },
        "type": "object"
      },
      "FulfillmentOrders": {
        "properties": {
          "get__typename": {
            "type": "string"
          },
          "nodes": {
            "items": {
              "$ref": "#/components/schemas/Node1"
            },
            "type": "array"
          },
          "pageInfo": {
            "$ref": "#/components/schemas/PageInfo1"
          }
        },
        "type": "object"
      },
      "Instrument": {
        "properties": {
          "get__typename": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "Item": {
        "properties": {
          "discounted_price": {
            "format": "int64",
            "type": "integer"
          },
          "discounts": {
            "items": {
              "type": "object"
            },
            "type": "array"
          },
          "featured_image": {
            "$ref": "#/components/schemas/FeaturedImage"
          },
          "final_line_price": {
            "format": "int64",
            "type": "integer"
          },
          "final_price": {
            "format": "int64",
            "type": "integer"
          },
          "gift_card": {
            "type": "boolean"
          },
          "grams": {
            "format": "int64",
            "type": "integer"
          },
          "handle": {
            "type": "string"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "image": {
            "type": "string"
          },
          "key": {
            "type": "string"
          },
          "line_level_discount_allocations": {
            "items": {
              "type": "object"
            },
            "type": "array"
          },
          "line_level_total_discount": {
            "format": "int64",
            "type": "integer"
          },
          "line_price": {
            "format": "int64",
            "type": "integer"
          },
          "options_with_values": {
            "items": {
              "$ref": "#/components/schemas/OptionsWithValue"
            },
            "type": "array"
          },
          "original_line_price": {
            "format": "int64",
            "type": "integer"
          },
          "original_price": {
            "format": "int64",
            "type": "integer"
          },
          "price": {
            "format": "int64",
            "type": "integer"
          },
          "product_description": {
            "type": "string"
          },
          "product_has_only_default_variant": {
            "type": "boolean"
          },
          "product_id": {
            "format": "int64",
            "type": "integer"
          },
          "product_title": {
            "type": "string"
          },
          "product_type": {
            "type": "string"
          },
          "properties": {
            "$ref": "#/components/schemas/Properties"
          },
          "quantity": {
            "format": "int64",
            "type": "integer"
          },
          "requires_shipping": {
            "type": "boolean"
          },
          "sku": {
            "type": "string"
          },
          "taxable": {
            "type": "boolean"
          },
          "title": {
            "type": "string"
          },
          "total_discount": {
            "format": "int64",
            "type": "integer"
          },
          "url": {
            "type": "string"
          },
          "variant_id": {
            "format": "int64",
            "type": "integer"
          },
          "variant_options": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "variant_title": {
            "type": "object"
          },
          "vendor": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "LineDiscountedPrice": {
        "properties": {
          "amount": {
            "type": "object"
          },
          "currencyCode": {
            "enum": [
              "USD",
              "EUR",
              "GBP",
              "CAD",
              "AFN",
              "ALL",
              "DZD",
              "AOA",
              "ARS",
              "AMD",
              "AWG",
              "AUD",
              "BBD",
              "AZN",
              "BDT",
              "BSD",
              "BHD",
              "BIF",
              "BYN",
              "BZD",
              "BMD",
              "BTN",
              "BAM",
              "BRL",
              "BOB",
              "BWP",
              "BND",
              "BGN",
              "MMK",
              "KHR",
              "CVE",
              "KYD",
              "XAF",
              "CLP",
              "CNY",
              "COP",
              "KMF",
              "CDF",
              "CRC",
              "HRK",
              "CZK",
              "DKK",
              "DJF",
              "DOP",
              "XCD",
              "EGP",
              "ERN",
              "ETB",
              "FKP",
              "XPF",
              "FJD",
              "GIP",
              "GMD",
              "GHS",
              "GTQ",
              "GYD",
              "GEL",
              "GNF",
              "HTG",
              "HNL",
              "HKD",
              "HUF",
              "ISK",
              "INR",
              "IDR",
              "ILS",
              "IRR",
              "IQD",
              "JMD",
              "JPY",
              "JEP",
              "JOD",
              "KZT",
              "KES",
              "KID",
              "KWD",
              "KGS",
              "LAK",
              "LVL",
              "LBP",
              "LSL",
              "LRD",
              "LYD",
              "LTL",
              "MGA",
              "MKD",
              "MOP",
              "MWK",
              "MVR",
              "MRU",
              "MXN",
              "MYR",
              "MUR",
              "MDL",
              "MAD",
              "MNT",
              "MZN",
              "NAD",
              "NPR",
              "ANG",
              "NZD",
              "NIO",
              "NGN",
              "NOK",
              "OMR",
              "PAB",
              "PKR",
              "PGK",
              "PYG",
              "PEN",
              "PHP",
              "PLN",
              "QAR",
              "RON",
              "RUB",
              "RWF",
              "WST",
              "SHP",
              "SAR",
              "RSD",
              "SCR",
              "SLL",
              "SGD",
              "SDG",
              "SOS",
              "SYP",
              "ZAR",
              "KRW",
              "SSP",
              "SBD",
              "LKR",
              "SRD",
              "SZL",
              "SEK",
              "CHF",
              "TWD",
              "THB",
              "TJS",
              "TZS",
              "TOP",
              "TTD",
              "TND",
              "TRY",
              "TMT",
              "UGX",
              "UAH",
              "AED",
              "UYU",
              "UZS",
              "VUV",
              "VES",
              "VND",
              "XOF",
              "YER",
              "ZMW",
              "USDC",
              "BYR",
              "STD",
              "STN",
              "VED",
              "VEF",
              "XXX",
              "$UNKNOWN"
            ],
            "type": "string"
          },
          "get__typename": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "Lines": {
        "properties": {
          "get__typename": {
            "type": "string"
          },
          "nodes": {
            "items": {
              "$ref": "#/components/schemas/Node"
            },
            "type": "array"
          },
          "pageInfo": {
            "$ref": "#/components/schemas/PageInfo"
          }
        },
        "type": "object"
      },
      "LocationInfo": {
        "properties": {
          "countryInfos": {
            "items": {
              "$ref": "#/components/schemas/CountryInfo"
            },
            "type": "array"
          },
          "locationId": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "LocationInfoV3": {
        "properties": {
          "label": {
            "type": "string"
          },
          "value": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "LongFilter": {
        "properties": {
          "equals": {
            "format": "int64",
            "type": "integer"
          },
          "greaterThan": {
            "format": "int64",
            "type": "integer"
          },
          "greaterThanOrEqual": {
            "format": "int64",
            "type": "integer"
          },
          "in": {
            "items": {
              "format": "int64",
              "type": "integer"
            },
            "type": "array"
          },
          "lessThan": {
            "format": "int64",
            "type": "integer"
          },
          "lessThanOrEqual": {
            "format": "int64",
            "type": "integer"
          },
          "notEquals": {
            "format": "int64",
            "type": "integer"
          },
          "notIn": {
            "items": {
              "format": "int64",
              "type": "integer"
            },
            "type": "array"
          },
          "specified": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "Node": {
        "properties": {
          "currentPrice": {
            "$ref": "#/components/schemas/CurrentPrice"
          },
          "customAttributes": {
            "items": {
              "$ref": "#/components/schemas/CustomAttribute"
            },
            "type": "array"
          },
          "discountAllocations": {
            "items": {
              "$ref": "#/components/schemas/DiscountAllocation"
            },
            "type": "array"
          },
          "get__typename": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "lineDiscountedPrice": {
            "$ref": "#/components/schemas/LineDiscountedPrice"
          },
          "pricingPolicy": {
            "$ref": "#/components/schemas/PricingPolicy"
          },
          "productId": {
            "type": "string"
          },
          "quantity": {
            "format": "int32",
            "type": "integer"
          },
          "sellingPlanId": {
            "type": "string"
          },
          "sellingPlanName": {
            "type": "string"
          },
          "sku": {
            "type": "string"
          },
          "taxable": {
            "type": "boolean"
          },
          "title": {
            "type": "string"
          },
          "variantId": {
            "type": "string"
          },
          "variantImage": {
            "$ref": "#/components/schemas/VariantImage"
          },
          "variantTitle": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "Node1": {
        "properties": {
          "fulfillAt": {
            "type": "object"
          },
          "get__typename": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "status": {
            "enum": [
              "OPEN",
              "IN_PROGRESS",
              "CANCELLED",
              "INCOMPLETE",
              "CLOSED",
              "SCHEDULED",
              "ON_HOLD",
              "$UNKNOWN"
            ],
            "type": "string"
          }
        },
        "type": "object"
      },
      "Node2": {
        "properties": {
          "get__typename": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "recurringCycleLimit": {
            "format": "int32",
            "type": "integer"
          },
          "rejectionReason": {
            "enum": [
              "NOT_FOUND",
              "NO_ENTITLED_LINE_ITEMS",
              "QUANTITY_NOT_IN_RANGE",
              "PURCHASE_NOT_IN_RANGE",
              "CUSTOMER_NOT_ELIGIBLE",
              "USAGE_LIMIT_REACHED",
              "CUSTOMER_USAGE_LIMIT_REACHED",
              "CURRENTLY_INACTIVE",
              "NO_ENTITLED_SHIPPING_LINES",
              "INCOMPATIBLE_PURCHASE_TYPE",
              "INTERNAL_ERROR",
              "$UNKNOWN"
            ],
            "type": "string"
          },
          "targetType": {
            "enum": [
              "LINE_ITEM",
              "SHIPPING_LINE",
              "$UNKNOWN"
            ],
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "type": {
            "enum": [
              "MANUAL",
              "CODE_DISCOUNT",
              "AUTOMATIC_DISCOUNT",
              "$UNKNOWN"
            ],
            "type": "string"
          },
          "usageCount": {
            "format": "int32",
            "type": "integer"
          },
          "value": {
            "$ref": "#/components/schemas/Value"
          }
        },
        "type": "object"
      },
      "Node3": {
        "properties": {
          "completedAt": {
            "type": "object"
          },
          "createdAt": {
            "type": "object"
          },
          "get__typename": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "idempotencyKey": {
            "type": "string"
          },
          "ready": {
            "deprecated": true,
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "OptionsWithValue": {
        "properties": {
          "name": {
            "type": "string"
          },
          "value": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "Order": {
        "properties": {
          "fulfillmentOrders": {
            "$ref": "#/components/schemas/FulfillmentOrders"
          },
          "get__typename": {
            "type": "string"
          },
          "id": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "OrderNoteAttribute": {
        "description": "A custom attribute consisting of a key and value",
        "properties": {
          "key": {
            "description": "The attribute key. Should be a unique identifier for this attribute. Use descriptive keys like 'gift_message', 'delivery_instructions', etc.",
            "example": "gift_message",
            "type": "string"
          },
          "value": {
            "description": "The attribute value. Can be any string value including JSON-encoded data. Set to empty string to clear an attribute.",
            "example": "Happy Birthday! Enjoy your subscription!",
            "type": "string"
          }
        },
        "required": [
          "key"
        ],
        "type": "object"
      },
      "OriginOrder": {
        "properties": {
          "fulfillmentOrders": {
            "$ref": "#/components/schemas/FulfillmentOrders"
          },
          "get__typename": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "PageInfo": {
        "properties": {
          "endCursor": {
            "type": "string"
          },
          "get__typename": {
            "type": "string"
          },
          "hasNextPage": {
            "type": "boolean"
          },
          "hasPreviousPage": {
            "type": "boolean"
          },
          "startCursor": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "PageInfo1": {
        "properties": {
          "endCursor": {
            "type": "string"
          },
          "get__typename": {
            "type": "string"
          },
          "hasNextPage": {
            "type": "boolean"
          },
          "hasPreviousPage": {
            "type": "boolean"
          },
          "startCursor": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "PageInfo2": {
        "properties": {
          "endCursor": {
            "type": "string"
          },
          "get__typename": {
            "type": "string"
          },
          "hasNextPage": {
            "type": "boolean"
          },
          "hasPreviousPage": {
            "type": "boolean"
          },
          "startCursor": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "Pageable": {
        "properties": {
          "page": {
            "format": "int32",
            "minimum": 0,
            "type": "integer"
          },
          "size": {
            "format": "int32",
            "minimum": 1,
            "type": "integer"
          },
          "sort": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "PaymentMethods": {
        "properties": {
          "get__typename": {
            "type": "string"
          },
          "nodes": {
            "items": {
              "$ref": "#/components/schemas/Node"
            },
            "type": "array"
          },
          "pageInfo": {
            "$ref": "#/components/schemas/PageInfo"
          }
        },
        "type": "object"
      },
      "PriceCondition": {
        "properties": {
          "amount": {
            "format": "double",
            "type": "number"
          },
          "deliverCondtion": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "PricingPolicy": {
        "properties": {
          "basePrice": {
            "$ref": "#/components/schemas/BasePrice"
          },
          "cycleDiscounts": {
            "items": {
              "$ref": "#/components/schemas/CycleDiscount"
            },
            "type": "array"
          },
          "get__typename": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "Problem": {
        "properties": {
          "detail": {
            "type": "string"
          },
          "instance": {
            "format": "uri",
            "type": "string"
          },
          "parameters": {
            "additionalProperties": {
              "type": "object"
            },
            "type": "object"
          },
          "status": {
            "$ref": "#/components/schemas/StatusType"
          },
          "title": {
            "type": "string"
          },
          "type": {
            "format": "uri",
            "type": "string"
          }
        },
        "type": "object"
      },
      "ProductInfo": {
        "properties": {
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "productHandle": {
            "type": "string"
          },
          "productId": {
            "format": "int64",
            "type": "integer"
          },
          "productTitle": {
            "type": "string"
          },
          "shop": {
            "type": "string"
          }
        },
        "required": [
          "shop"
        ],
        "type": "object"
      },
      "ProductSwapDTO": {
        "properties": {
          "carryDiscountForward": {
            "type": "boolean"
          },
          "changeNextOrderDateBy": {
            "format": "int32",
            "type": "integer"
          },
          "checkForEveryRecurringOrder": {
            "type": "boolean"
          },
          "destinationVariants": {
            "type": "string"
          },
          "discountCarryForward": {
            "enum": [
              "NONE",
              "EXISTING_PLAN",
              "PRODUCT_PLAN",
              "PRODUCT_THEN_EXISTING"
            ],
            "type": "string"
          },
          "forBillingCycle": {
            "format": "int32",
            "type": "integer"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "ruleSequence": {
            "format": "int32",
            "type": "integer"
          },
          "shop": {
            "type": "string"
          },
          "sourceVariants": {
            "type": "string"
          },
          "stopSwapEmails": {
            "type": "boolean"
          },
          "updatedFirstOrder": {
            "type": "boolean"
          }
        },
        "required": [
          "shop"
        ],
        "type": "object"
      },
      "ProductVariantDTO": {
        "properties": {
          "allProduct": {
            "type": "boolean"
          },
          "collectionId": {
            "type": "string"
          },
          "deleteAllProduct": {
            "type": "boolean"
          },
          "productDetails": {
            "type": "string"
          },
          "productIds": {
            "items": {
              "format": "int64",
              "type": "integer"
            },
            "type": "array"
          },
          "variantDetails": {
            "type": "string"
          },
          "variantIds": {
            "items": {
              "format": "int64",
              "type": "integer"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "Properties": {
        "type": "object"
      },
      "Province": {
        "properties": {
          "label": {
            "type": "string"
          },
          "value": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "ReplaceVariantsInfoV3": {
        "description": "Product replacement configuration for subscription contracts. Allows replacing existing subscription products with new ones, managing quantities, and handling one-time purchases.",
        "properties": {
          "carryForwardDiscount": {
            "description": "Determines how discounts are applied to new products when replacing variants. If not specified, uses the merchant's default setting.",
            "enum": [
              "NONE",
              "EXISTING_PLAN",
              "PRODUCT_PLAN",
              "PRODUCT_THEN_EXISTING",
              "PRODUCT_THEN_EXISTING",
              "PRODUCT_PLAN",
              "EXISTING_PLAN"
            ],
            "example": "PRODUCT_THEN_EXISTING",
            "type": "string"
          },
          "contractId": {
            "description": "The ID of the subscription contract to modify",
            "example": 123456789,
            "format": "int64",
            "type": "integer"
          },
          "newOneTimeVariants": {
            "additionalProperties": {
              "description": "Map of one-time product variant IDs to add with their quantities. These products will be charged only once with the next order and won't recur. Useful for add-ons, samples, or limited-time offers.",
              "format": "int32",
              "type": "integer"
            },
            "description": "Map of one-time product variant IDs to add with their quantities. These products will be charged only once with the next order and won't recur. Useful for add-ons, samples, or limited-time offers.",
            "example": {
              "42549172066666": 1,
              "42549172077777": 2
            },
            "type": "object"
          },
          "newVariants": {
            "additionalProperties": {
              "description": "Map of new variant IDs to their quantities. Key is the numeric Shopify variant ID, value is the desired quantity. If a variant already exists in the subscription and the system is configured to update existing quantities, the quantity will be added to the existing quantity.",
              "format": "int32",
              "type": "integer"
            },
            "description": "Map of new variant IDs to their quantities. Key is the numeric Shopify variant ID, value is the desired quantity. If a variant already exists in the subscription and the system is configured to update existing quantities, the quantity will be added to the existing quantity.",
            "example": {
              "42549172033333": 2,
              "42549172044444": 1
            },
            "type": "object"
          },
          "oldLineId": {
            "description": "Specific subscription line ID to replace. Use this for targeted replacement of a single line item. When provided, oldVariants should be empty. Format: gid://shopify/SubscriptionLine/[ID]",
            "example": "gid://shopify/SubscriptionLine/987654321",
            "type": "string"
          },
          "oldOneTimeVariants": {
            "description": "List of one-time product variant IDs to remove from the subscription. Only removes one-time products that haven't been fulfilled yet.",
            "example": [
              42549172055555,
              42549172088888
            ],
            "items": {
              "description": "List of one-time product variant IDs to remove from the subscription. Only removes one-time products that haven't been fulfilled yet.",
              "format": "int64",
              "type": "integer"
            },
            "type": "array"
          },
          "oldVariants": {
            "description": "List of variant IDs to remove from the subscription. These are numeric Shopify variant IDs. Either provide oldVariants OR oldLineId, not both.",
            "example": [
              42549172011164,
              42549172022222
            ],
            "items": {
              "description": "List of variant IDs to remove from the subscription. These are numeric Shopify variant IDs. Either provide oldVariants OR oldLineId, not both.",
              "format": "int64",
              "type": "integer"
            },
            "type": "array"
          },
          "stopSwapEmails": {
            "default": false,
            "description": "If true, suppresses email notifications about the product swap. Default is false (emails will be sent).",
            "example": false,
            "type": "boolean"
          }
        },
        "required": [
          "contractId"
        ],
        "type": "object"
      },
      "SellingPlanGroupInfo": {
        "properties": {
          "label": {
            "type": "string"
          },
          "value": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "SourceProductDTO": {
        "properties": {
          "addSubProductIds": {
            "items": {
              "format": "int64",
              "type": "integer"
            },
            "type": "array"
          },
          "addSubVariantIds": {
            "items": {
              "format": "int64",
              "type": "integer"
            },
            "type": "array"
          },
          "deleteSubProductIds": {
            "items": {
              "format": "int64",
              "type": "integer"
            },
            "type": "array"
          },
          "deleteSubVariantIds": {
            "items": {
              "format": "int64",
              "type": "integer"
            },
            "type": "array"
          },
          "sourceProductId": {
            "format": "int64",
            "type": "integer"
          }
        },
        "type": "object"
      },
      "StatusType": {
        "properties": {
          "reasonPhrase": {
            "type": "string"
          },
          "statusCode": {
            "format": "int32",
            "type": "integer"
          }
        },
        "type": "object"
      },
      "StringFilter": {
        "properties": {
          "contains": {
            "type": "string"
          },
          "doesNotContain": {
            "type": "string"
          },
          "equals": {
            "type": "string"
          },
          "in": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "notEquals": {
            "type": "string"
          },
          "notIn": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "specified": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "SubscriptionBillingAttempt": {
        "properties": {
          "applyUsageCharge": {
            "type": "boolean"
          },
          "attemptCount": {
            "format": "int32",
            "type": "integer"
          },
          "attemptTime": {
            "format": "date-time",
            "type": "string"
          },
          "billingAttemptId": {
            "type": "string"
          },
          "billingAttemptResponseMessage": {
            "type": "string"
          },
          "billingDate": {
            "format": "date-time",
            "type": "string"
          },
          "consolidatedIntoAttemptId": {
            "format": "int64",
            "type": "integer"
          },
          "contractId": {
            "format": "int64",
            "type": "integer"
          },
          "graphOrderId": {
            "type": "string"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "inventorySkippedAttemptCount": {
            "format": "int32",
            "type": "integer"
          },
          "inventorySkippedRetryingNeeded": {
            "type": "boolean"
          },
          "lastShippingUpdatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "orderAmount": {
            "format": "double",
            "type": "number"
          },
          "orderAmountContractCurrency": {
            "format": "double",
            "type": "number"
          },
          "orderAmountShopCurrency": {
            "format": "double",
            "type": "number"
          },
          "orderAmountUSD": {
            "format": "double",
            "type": "number"
          },
          "orderId": {
            "format": "int64",
            "type": "integer"
          },
          "orderName": {
            "type": "string"
          },
          "orderNote": {
            "type": "string"
          },
          "partialLinesSkipped": {
            "enum": [
              "INVENTORY_MANAGEMENT",
              "MANUAL",
              "ORPHANED_FREE_PRODUCT"
            ],
            "type": "string"
          },
          "progressAttemptCount": {
            "format": "int32",
            "type": "integer"
          },
          "recurringChargeId": {
            "format": "int64",
            "type": "integer"
          },
          "retryingNeeded": {
            "type": "boolean"
          },
          "securityChallengeSentStatus": {
            "enum": [
              "SENT",
              "UNSENT",
              "FAILED",
              "EMAIL_SETTINGS_DISABLED",
              "CONTRACT_CANCELLED"
            ],
            "type": "string"
          },
          "shop": {
            "type": "string"
          },
          "status": {
            "enum": [
              "SUCCESS",
              "FAILURE",
              "REQUESTING",
              "PROGRESS",
              "QUEUED",
              "SKIPPED",
              "SOCIAL_CONNECTION_NULL",
              "CONTRACT_CANCELLED",
              "CONTRACT_ENDED",
              "CONTRACT_PAUSED",
              "AUTO_CHARGE_DISABLED",
              "SHOPIFY_EXCEPTION",
              "SKIPPED_DUNNING_MGMT",
              "SKIPPED_INVENTORY_MGMT",
              "IMMEDIATE_TRIGGERED",
              "SECURITY_CHALLENGE",
              "CONTRACT_PAUSED_MAX_CYCLES",
              "REFUNDED",
              "SKIPPED_DEMO_SHOP",
              "SKIPPED_SHOP_INFO_NOT_FOUND",
              "SKIPPED_BILLING_DATE_STALE",
              "SKIPPED_DUNNING_NOT_CONFIGURED",
              "PENDING_CONSOLIDATION"
            ],
            "type": "string"
          },
          "transactionFailedEmailSentStatus": {
            "enum": [
              "SENT",
              "UNSENT",
              "FAILED",
              "EMAIL_SETTINGS_DISABLED",
              "CUSTOMER_PAYMENT_EMPTY",
              "CONTRACT_CANCELLED"
            ],
            "type": "string"
          },
          "transactionFailedSmsSentStatus": {
            "enum": [
              "SENT",
              "UNSENT",
              "FAILED",
              "SMS_SETTINGS_DISABLED",
              "CUSTOMER_PAYMENT_EMPTY",
              "CONTRACT_CANCELLED",
              "PHONE_NUMBER_EMPTY"
            ],
            "type": "string"
          },
          "transactionRate": {
            "format": "double",
            "type": "number"
          },
          "upcomingOrderEmailSentStatus": {
            "enum": [
              "SENT",
              "UNSENT",
              "FAILED",
              "EMAIL_SETTINGS_DISABLED",
              "CUSTOMER_PAYMENT_EMPTY",
              "CONTRACT_CANCELLED",
              "STOP_FROM_CONTRACT",
              "CONTRACT_PAUSED"
            ],
            "type": "string"
          },
          "upcomingOrderSmsSentStatus": {
            "enum": [
              "SENT",
              "UNSENT",
              "FAILED",
              "SMS_SETTINGS_DISABLED",
              "CUSTOMER_PAYMENT_EMPTY",
              "CONTRACT_CANCELLED",
              "STOP_FROM_CONTRACT",
              "CONTRACT_PAUSED",
              "PHONE_NUMBER_EMPTY"
            ],
            "type": "string"
          },
          "usageChargeStatus": {
            "enum": [
              "SUCCESS",
              "FAILED",
              "TO_BE_TRIED"
            ],
            "type": "string"
          }
        },
        "required": [
          "retryingNeeded",
          "shop"
        ],
        "type": "object"
      },
      "SubscriptionBillingAttemptDTO": {
        "properties": {
          "applyUsageCharge": {
            "type": "boolean"
          },
          "attemptCount": {
            "format": "int32",
            "type": "integer"
          },
          "attemptTime": {
            "format": "date-time",
            "type": "string"
          },
          "billingAttemptId": {
            "type": "string"
          },
          "billingAttemptResponseMessage": {
            "type": "string"
          },
          "billingDate": {
            "format": "date-time",
            "type": "string"
          },
          "contractId": {
            "format": "int64",
            "type": "integer"
          },
          "graphOrderId": {
            "type": "string"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "inventorySkippedAttemptCount": {
            "format": "int32",
            "type": "integer"
          },
          "inventorySkippedRetryingNeeded": {
            "type": "boolean"
          },
          "lastShippingUpdatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "orderAmount": {
            "format": "double",
            "type": "number"
          },
          "orderAmountContractCurrency": {
            "format": "double",
            "type": "number"
          },
          "orderAmountShopCurrency": {
            "format": "double",
            "type": "number"
          },
          "orderAmountUSD": {
            "format": "double",
            "type": "number"
          },
          "orderAttributes": {
            "items": {
              "$ref": "#/components/schemas/AttributeInfo"
            },
            "type": "array"
          },
          "orderCancelReason": {
            "enum": [
              "CUSTOMER",
              "DECLINED",
              "FRAUD",
              "INVENTORY",
              "STAFF",
              "OTHER",
              "$UNKNOWN"
            ],
            "type": "string"
          },
          "orderCancelledAt": {
            "format": "date-time",
            "type": "string"
          },
          "orderClosed": {
            "type": "boolean"
          },
          "orderClosedAt": {
            "format": "date-time",
            "type": "string"
          },
          "orderConfirmed": {
            "type": "boolean"
          },
          "orderDisplayFinancialStatus": {
            "enum": [
              "PENDING",
              "AUTHORIZED",
              "PARTIALLY_PAID",
              "PARTIALLY_REFUNDED",
              "VOIDED",
              "PAID",
              "REFUNDED",
              "EXPIRED",
              "$UNKNOWN"
            ],
            "type": "string"
          },
          "orderDisplayFulfillmentStatus": {
            "enum": [
              "UNFULFILLED",
              "PARTIALLY_FULFILLED",
              "FULFILLED",
              "RESTOCKED",
              "PENDING_FULFILLMENT",
              "OPEN",
              "IN_PROGRESS",
              "ON_HOLD",
              "SCHEDULED",
              "REQUEST_DECLINED",
              "$UNKNOWN"
            ],
            "type": "string"
          },
          "orderId": {
            "format": "int64",
            "type": "integer"
          },
          "orderName": {
            "type": "string"
          },
          "orderNote": {
            "type": "string"
          },
          "orderProcessedAt": {
            "format": "date-time",
            "type": "string"
          },
          "partialLinesSkipped": {
            "enum": [
              "INVENTORY_MANAGEMENT",
              "MANUAL",
              "ORPHANED_FREE_PRODUCT"
            ],
            "type": "string"
          },
          "progressAttemptCount": {
            "format": "int32",
            "type": "integer"
          },
          "recurringChargeId": {
            "format": "int64",
            "type": "integer"
          },
          "retryingNeeded": {
            "type": "boolean"
          },
          "securityChallengeSentStatus": {
            "enum": [
              "SENT",
              "UNSENT",
              "FAILED",
              "EMAIL_SETTINGS_DISABLED",
              "CONTRACT_CANCELLED"
            ],
            "type": "string"
          },
          "shop": {
            "type": "string"
          },
          "status": {
            "enum": [
              "SUCCESS",
              "FAILURE",
              "REQUESTING",
              "PROGRESS",
              "QUEUED",
              "SKIPPED",
              "SOCIAL_CONNECTION_NULL",
              "CONTRACT_CANCELLED",
              "CONTRACT_ENDED",
              "CONTRACT_PAUSED",
              "AUTO_CHARGE_DISABLED",
              "SHOPIFY_EXCEPTION",
              "SKIPPED_DUNNING_MGMT",
              "SKIPPED_INVENTORY_MGMT",
              "IMMEDIATE_TRIGGERED",
              "SECURITY_CHALLENGE",
              "CONTRACT_PAUSED_MAX_CYCLES",
              "REFUNDED",
              "SKIPPED_DEMO_SHOP",
              "SKIPPED_SHOP_INFO_NOT_FOUND",
              "SKIPPED_BILLING_DATE_STALE",
              "SKIPPED_DUNNING_NOT_CONFIGURED",
              "PENDING_CONSOLIDATION"
            ],
            "type": "string"
          },
          "transactionFailedEmailSentStatus": {
            "enum": [
              "SENT",
              "UNSENT",
              "FAILED",
              "EMAIL_SETTINGS_DISABLED",
              "CUSTOMER_PAYMENT_EMPTY",
              "CONTRACT_CANCELLED"
            ],
            "type": "string"
          },
          "transactionFailedSmsSentStatus": {
            "enum": [
              "SENT",
              "UNSENT",
              "FAILED",
              "SMS_SETTINGS_DISABLED",
              "CUSTOMER_PAYMENT_EMPTY",
              "CONTRACT_CANCELLED",
              "PHONE_NUMBER_EMPTY"
            ],
            "type": "string"
          },
          "transactionRate": {
            "format": "double",
            "type": "number"
          },
          "upcomingOrderEmailSentStatus": {
            "enum": [
              "SENT",
              "UNSENT",
              "FAILED",
              "EMAIL_SETTINGS_DISABLED",
              "CUSTOMER_PAYMENT_EMPTY",
              "CONTRACT_CANCELLED",
              "STOP_FROM_CONTRACT",
              "CONTRACT_PAUSED"
            ],
            "type": "string"
          },
          "upcomingOrderSmsSentStatus": {
            "enum": [
              "SENT",
              "UNSENT",
              "FAILED",
              "SMS_SETTINGS_DISABLED",
              "CUSTOMER_PAYMENT_EMPTY",
              "CONTRACT_CANCELLED",
              "STOP_FROM_CONTRACT",
              "CONTRACT_PAUSED",
              "PHONE_NUMBER_EMPTY"
            ],
            "type": "string"
          },
          "usageChargeStatus": {
            "enum": [
              "SUCCESS",
              "FAILED",
              "TO_BE_TRIED"
            ],
            "type": "string"
          },
          "variantList": {
            "items": {
              "$ref": "#/components/schemas/VariantQuantity"
            },
            "type": "array"
          }
        },
        "required": [
          "retryingNeeded",
          "shop"
        ],
        "type": "object"
      },
      "SubscriptionBillingAttemptDetails": {
        "properties": {
          "subscriptionBillingAttempt": {
            "$ref": "#/components/schemas/SubscriptionBillingAttempt"
          },
          "subscriptionContractDetails": {
            "$ref": "#/components/schemas/SubscriptionContractDetails"
          }
        },
        "type": "object"
      },
      "SubscriptionBundleSettingsDTO": {
        "properties": {
          "addButtonText": {
            "type": "string"
          },
          "additionalProperty": {
            "additionalProperties": {
              "type": "object"
            },
            "type": "object",
            "writeOnly": true
          },
          "allowAddUnavailableProduct": {
            "type": "boolean"
          },
          "backgroundColor": {
            "type": "string"
          },
          "bundleBottomHtml": {
            "type": "string"
          },
          "bundleRedirect": {
            "enum": [
              "CART",
              "CHECKOUT",
              "CUSTOM"
            ],
            "type": "string"
          },
          "bundleTopHtml": {
            "type": "string"
          },
          "buttonBackgroundColor": {
            "type": "string"
          },
          "buttonColor": {
            "type": "string"
          },
          "buyQuantityGetDiscount": {
            "type": "string"
          },
          "cart": {
            "type": "string"
          },
          "checkoutMessage": {
            "type": "string"
          },
          "congratsMessageText": {
            "type": "string"
          },
          "continueShopping": {
            "type": "string"
          },
          "currencySwitcherClassName": {
            "type": "string"
          },
          "customRedirectURL": {
            "type": "string"
          },
          "descriptionLength": {
            "format": "int32",
            "type": "integer"
          },
          "disableInventoryCheck": {
            "type": "boolean"
          },
          "disableProductCardImageSlider": {
            "type": "boolean"
          },
          "disableProductDescription": {
            "type": "boolean"
          },
          "displayUnavailableProduct": {
            "type": "boolean"
          },
          "editQuantity": {
            "type": "string"
          },
          "enableClearCartSelectedProducts": {
            "type": "boolean"
          },
          "enableCustomAdvancedFields": {
            "type": "boolean"
          },
          "enableDisplayProductType": {
            "type": "boolean"
          },
          "enableDisplayProductVendor": {
            "type": "boolean"
          },
          "enableEditQuantityTextbox": {
            "type": "boolean"
          },
          "enableOpeningSidebar": {
            "type": "boolean"
          },
          "enableProductDetailButton": {
            "type": "boolean"
          },
          "enableRedirectToProductPage": {
            "type": "boolean"
          },
          "enableShowProductBasePrice": {
            "type": "boolean"
          },
          "enableSkieyBABHeader": {
            "type": "boolean"
          },
          "failedToAddMsgText": {
            "type": "string"
          },
          "failedToAddTitleText": {
            "type": "string"
          },
          "hideProductSearchBox": {
            "type": "boolean"
          },
          "hideProductTags": {
            "type": "boolean"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "isBundleWithoutScroll": {
            "type": "boolean"
          },
          "isMergeIntoSingleBABVariantDropdown": {
            "type": "boolean"
          },
          "itemsText": {
            "type": "string"
          },
          "leftSidebarHTML": {
            "type": "string"
          },
          "moveOneTimePurchaseToTop": {
            "type": "boolean"
          },
          "myDeliveryText": {
            "type": "string"
          },
          "okBtnText": {
            "type": "string"
          },
          "openingSidebarType": {
            "enum": [
              "DEFAULT",
              "MAX_QUANTITY",
              "STOP_AUTO_OPEN",
              "MIN_AMOUNT"
            ],
            "type": "string"
          },
          "pageBackgroundColor": {
            "type": "string"
          },
          "proceedToCheckoutButtonText": {
            "type": "string"
          },
          "productDetails": {
            "type": "string"
          },
          "productFilterConfig": {
            "type": "string"
          },
          "productPriceFormatField": {
            "type": "string"
          },
          "productTitleFontColor": {
            "type": "string"
          },
          "productsToProceedText": {
            "type": "string"
          },
          "quantityLabel": {
            "type": "string"
          },
          "removeItem": {
            "type": "string"
          },
          "restrictPriceRateCalculation": {
            "type": "boolean"
          },
          "rightSidebarHTML": {
            "type": "string"
          },
          "selectMinimumProductButtonText": {
            "type": "string"
          },
          "selectedFrequencyLabelText": {
            "type": "string"
          },
          "shop": {
            "type": "string"
          },
          "shopCustomizationData": {
            "items": {
              "$ref": "#/components/schemas/UpdateShopCustomizationRequest"
            },
            "type": "array"
          },
          "shoppingCart": {
            "type": "string"
          },
          "showCompareAtPrice": {
            "type": "boolean"
          },
          "showFullProductDescription": {
            "type": "boolean"
          },
          "showOrderNoteField": {
            "type": "boolean"
          },
          "showSubLoyaltyTable": {
            "type": "boolean"
          },
          "skipFilterVariantsByAllocationsId": {
            "type": "boolean"
          },
          "skipFirstPage": {
            "type": "boolean"
          },
          "spendAmountGetDiscount": {
            "type": "string"
          },
          "spentText": {
            "type": "string"
          },
          "stickyCheckoutButton": {
            "type": "boolean"
          },
          "subtotal": {
            "type": "string"
          },
          "tieredDiscount": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "variantLabelTextV2": {
            "type": "string"
          },
          "variantNotAvailable": {
            "type": "string"
          },
          "viewProduct": {
            "type": "string"
          }
        },
        "required": [
          "addButtonText",
          "myDeliveryText",
          "proceedToCheckoutButtonText",
          "productsToProceedText",
          "selectMinimumProductButtonText",
          "selectedFrequencyLabelText",
          "shop"
        ],
        "type": "object"
      },
      "SubscriptionBundling": {
        "properties": {
          "allowOneTimePurchase": {
            "type": "boolean"
          },
          "appliesOn": {
            "enum": [
              "PRODUCT",
              "COLLECTION",
              "BOTH",
              "ONE_TIME",
              "SUBSCRIPTION"
            ],
            "type": "string"
          },
          "buildABoxType": {
            "enum": [
              "CLASSIC",
              "SINGLE_PRODUCT",
              "MIX_AND_MATCH",
              "INFINITE",
              "CUSTOMIZE_BUNDLE",
              "CLASSIC_BUILD_A_BOX",
              "SINGLE_PRODUCT_BUILD_A_BOX",
              "VOLUME_DISCOUNT",
              "DISCOUNTED_PRICING",
              "SHIPPING_DISCOUNT",
              "BUY_X_GET_Y",
              "SECTIONED_BUNDLE"
            ],
            "type": "string"
          },
          "bundleBottomHtml": {
            "type": "string"
          },
          "bundleRedirect": {
            "enum": [
              "CART",
              "CART_DRAWER",
              "CHECKOUT",
              "CUSTOM",
              "NONE"
            ],
            "type": "string"
          },
          "bundleTopHtml": {
            "type": "string"
          },
          "chooseProductsText": {
            "type": "string"
          },
          "collectionData": {
            "type": "string"
          },
          "customRedirectURL": {
            "type": "string"
          },
          "discount": {
            "format": "double",
            "type": "number"
          },
          "discountedVariants": {
            "type": "string"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "inventoryTrackingMode": {
            "enum": [
              "ADD_CHILD_PRODUCT_ON_ORDER",
              "ADD_CHILD_PRODUCT_ON_CHECKOUT"
            ],
            "type": "string"
          },
          "maxProductCount": {
            "format": "int32",
            "type": "integer"
          },
          "minOrderAmount": {
            "format": "double",
            "type": "number"
          },
          "minProductCount": {
            "format": "int32",
            "type": "integer"
          },
          "minUniqueProductCheck": {
            "type": "boolean"
          },
          "name": {
            "type": "string"
          },
          "proceedToCheckoutButtonText": {
            "type": "string"
          },
          "productDiscountType": {
            "enum": [
              "SELECTED_PRODUCT",
              "EACH_PRODUCT"
            ],
            "type": "string"
          },
          "productSelectionType": {
            "enum": [
              "PRODUCT",
              "COLLECTION"
            ],
            "type": "string"
          },
          "productViewStyle": {
            "enum": [
              "QUICK_ADD",
              "VIEW_DETAILS"
            ],
            "type": "string"
          },
          "sections": {
            "type": "string"
          },
          "selectionType": {
            "enum": [
              "FIXED",
              "FLEXIBLE"
            ],
            "type": "string"
          },
          "sellingPlanIds": {
            "type": "string"
          },
          "shop": {
            "type": "string"
          },
          "singleProductSettings": {
            "type": "string"
          },
          "subscriptionBundlingEnabled": {
            "type": "boolean"
          },
          "subscriptionGroup": {
            "type": "string"
          },
          "subscriptionId": {
            "format": "int64",
            "type": "integer"
          },
          "thirdPartyRule": {
            "type": "boolean"
          },
          "tieredDiscount": {
            "type": "string"
          },
          "trackInventory": {
            "type": "boolean"
          },
          "uniqueRef": {
            "type": "string"
          },
          "variants": {
            "type": "string"
          }
        },
        "required": [
          "shop"
        ],
        "type": "object"
      },
      "SubscriptionBundlingDTO": {
        "properties": {
          "allowOneTimePurchase": {
            "type": "boolean"
          },
          "appliesOn": {
            "enum": [
              "PRODUCT",
              "COLLECTION",
              "BOTH",
              "ONE_TIME",
              "SUBSCRIPTION"
            ],
            "type": "string"
          },
          "buildABoxType": {
            "enum": [
              "CLASSIC",
              "SINGLE_PRODUCT",
              "MIX_AND_MATCH",
              "INFINITE",
              "CUSTOMIZE_BUNDLE",
              "CLASSIC_BUILD_A_BOX",
              "SINGLE_PRODUCT_BUILD_A_BOX",
              "VOLUME_DISCOUNT",
              "DISCOUNTED_PRICING",
              "SHIPPING_DISCOUNT",
              "BUY_X_GET_Y",
              "SECTIONED_BUNDLE"
            ],
            "type": "string"
          },
          "bundleBottomHtml": {
            "type": "string"
          },
          "bundleRedirect": {
            "enum": [
              "CART",
              "CART_DRAWER",
              "CHECKOUT",
              "CUSTOM",
              "NONE"
            ],
            "type": "string"
          },
          "bundleTopHtml": {
            "type": "string"
          },
          "chooseProductsText": {
            "type": "string"
          },
          "collectionData": {
            "type": "string"
          },
          "customRedirectURL": {
            "type": "string"
          },
          "discount": {
            "format": "double",
            "type": "number"
          },
          "discountedVariants": {
            "type": "string"
          },
          "groupName": {
            "type": "string"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "inventoryTrackingMode": {
            "enum": [
              "ADD_CHILD_PRODUCT_ON_ORDER",
              "ADD_CHILD_PRODUCT_ON_CHECKOUT"
            ],
            "type": "string"
          },
          "maxProductCount": {
            "format": "int32",
            "type": "integer"
          },
          "minOrderAmount": {
            "format": "double",
            "type": "number"
          },
          "minProductCount": {
            "format": "int32",
            "type": "integer"
          },
          "minUniqueProductCheck": {
            "type": "boolean"
          },
          "name": {
            "type": "string"
          },
          "proceedToCheckoutButtonText": {
            "type": "string"
          },
          "productDiscountType": {
            "enum": [
              "SELECTED_PRODUCT",
              "EACH_PRODUCT"
            ],
            "type": "string"
          },
          "productSelectionType": {
            "enum": [
              "PRODUCT",
              "COLLECTION"
            ],
            "type": "string"
          },
          "productViewStyle": {
            "enum": [
              "QUICK_ADD",
              "VIEW_DETAILS"
            ],
            "type": "string"
          },
          "sections": {
            "type": "string"
          },
          "selectionType": {
            "enum": [
              "FIXED",
              "FLEXIBLE"
            ],
            "type": "string"
          },
          "sellingPlanIds": {
            "type": "string"
          },
          "shop": {
            "type": "string"
          },
          "singleProductSettings": {
            "type": "string"
          },
          "subscriptionBundleLink": {
            "type": "string"
          },
          "subscriptionBundlingEnabled": {
            "type": "boolean"
          },
          "subscriptionGroup": {
            "type": "string"
          },
          "subscriptionId": {
            "format": "int64",
            "type": "integer"
          },
          "thirdPartyRule": {
            "type": "boolean"
          },
          "tieredDiscount": {
            "type": "string"
          },
          "trackInventory": {
            "type": "boolean"
          },
          "uniqueRef": {
            "type": "string"
          },
          "variants": {
            "type": "string"
          }
        },
        "required": [
          "shop"
        ],
        "type": "object"
      },
      "SubscriptionBundlingResponse": {
        "properties": {
          "bundle": {
            "$ref": "#/components/schemas/SubscriptionBundling"
          },
          "products": {
            "items": {
              "$ref": "#/components/schemas/ProductInfo"
            },
            "type": "array"
          },
          "subscriptions": {
            "items": {
              "$ref": "#/components/schemas/SubscriptionGroupPlan"
            },
            "type": "array"
          },
          "variants": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "SubscriptionBundlingResponseV3": {
        "properties": {
          "bundle": {
            "$ref": "#/components/schemas/SubscriptionBundling"
          },
          "products": {
            "items": {
              "$ref": "#/components/schemas/ProductInfo"
            },
            "type": "array"
          },
          "subscription": {
            "$ref": "#/components/schemas/SubscriptionGroupPlan"
          },
          "subscriptionGroupPlans": {
            "items": {
              "$ref": "#/components/schemas/SubscriptionGroupPlan"
            },
            "type": "array"
          },
          "subscriptionPlanProductInfoMap": {
            "additionalProperties": {
              "items": {
                "$ref": "#/components/schemas/ProductInfo"
              },
              "type": "array"
            },
            "type": "object"
          },
          "subscriptionPlanVariantMap": {
            "additionalProperties": {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "type": "object"
          },
          "variants": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "SubscriptionContract": {
        "properties": {
          "billingAttempts": {
            "$ref": "#/components/schemas/BillingAttempts"
          },
          "billingPolicy": {
            "$ref": "#/components/schemas/BillingPolicy"
          },
          "createdAt": {
            "type": "object"
          },
          "customAttributes": {
            "items": {
              "$ref": "#/components/schemas/CustomAttribute1"
            },
            "type": "array"
          },
          "customer": {
            "$ref": "#/components/schemas/Customer"
          },
          "customerPaymentMethod": {
            "$ref": "#/components/schemas/CustomerPaymentMethod"
          },
          "deliveryMethod": {
            "$ref": "#/components/schemas/DeliveryMethod"
          },
          "deliveryPolicy": {
            "$ref": "#/components/schemas/DeliveryPolicy"
          },
          "deliveryPrice": {
            "$ref": "#/components/schemas/DeliveryPrice"
          },
          "discounts": {
            "$ref": "#/components/schemas/Discounts"
          },
          "get__typename": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "lastPaymentStatus": {
            "enum": [
              "SUCCEEDED",
              "FAILED",
              "$UNKNOWN"
            ],
            "type": "string"
          },
          "lines": {
            "$ref": "#/components/schemas/Lines"
          },
          "nextBillingDate": {
            "type": "object"
          },
          "note": {
            "type": "string"
          },
          "originOrder": {
            "$ref": "#/components/schemas/OriginOrder"
          },
          "revisionId": {
            "type": "object"
          },
          "status": {
            "enum": [
              "ACTIVE",
              "PAUSED",
              "CANCELLED",
              "EXPIRED",
              "FAILED",
              "$UNKNOWN"
            ],
            "type": "string"
          },
          "updatedAt": {
            "type": "object"
          }
        },
        "type": "object"
      },
      "SubscriptionContractDTO": {
        "description": "Request object for creating a new subscription contract",
        "properties": {
          "allowDeliveryAddressOverride": {
            "default": false,
            "description": "Allow customer to change delivery address in customer portal",
            "example": false,
            "type": "boolean"
          },
          "allowDeliveryPriceOverride": {
            "default": false,
            "description": "Allow delivery price to be overridden",
            "example": false,
            "type": "boolean"
          },
          "billingIntervalCount": {
            "description": "Number of intervals between billings",
            "example": 1,
            "format": "int32",
            "minimum": 1,
            "type": "integer"
          },
          "billingIntervalType": {
            "description": "Billing frequency interval type",
            "enum": [
              "DAY",
              "WEEK",
              "MONTH",
              "YEAR",
              "$UNKNOWN",
              "DAY",
              "WEEK",
              "MONTH",
              "YEAR"
            ],
            "example": "MONTH",
            "type": "string"
          },
          "createWithoutPaymentMethod": {
            "default": false,
            "description": "If true, creates subscription without payment method. Status will be set to PAUSED unless skipPaymentCreateUnpaidOrder is also true.",
            "example": false,
            "type": "boolean"
          },
          "currencyCode": {
            "description": "Currency code for the subscription (ISO 4217). If not provided, uses store default currency",
            "example": "USD",
            "type": "string"
          },
          "customAttributes": {
            "description": "Custom attributes to attach to the subscription contract",
            "example": [
              {
                "key": "subscription_type",
                "value": "premium"
              },
              {
                "key": "gift_message",
                "value": "Happy Birthday!"
              }
            ],
            "items": {
              "$ref": "#/components/schemas/AttributeInputDTO"
            },
            "type": "array"
          },
          "customerId": {
            "description": "Shopify customer ID (numeric ID without gid prefix)",
            "example": "987654321",
            "type": "string"
          },
          "deliveryAddress1": {
            "description": "Delivery address line 1",
            "example": "123 Main St",
            "type": "string"
          },
          "deliveryAddress2": {
            "description": "Delivery address line 2",
            "example": "Apt 4B",
            "type": "string"
          },
          "deliveryCity": {
            "description": "Delivery address city",
            "example": "New York",
            "type": "string"
          },
          "deliveryCountryCode": {
            "description": "Delivery address country code (ISO 3166-1 alpha-2)",
            "example": "US",
            "type": "string"
          },
          "deliveryFirstName": {
            "description": "Delivery address first name",
            "example": "John",
            "type": "string"
          },
          "deliveryIntervalCount": {
            "description": "Number of intervals between deliveries. If not specified, uses billing interval count",
            "example": 1,
            "format": "int32",
            "minimum": 1,
            "type": "integer"
          },
          "deliveryIntervalType": {
            "description": "Delivery frequency interval type. If not specified, uses billing interval",
            "enum": [
              "DAY",
              "WEEK",
              "MONTH",
              "YEAR",
              "$UNKNOWN",
              "DAY",
              "WEEK",
              "MONTH",
              "YEAR"
            ],
            "example": "MONTH",
            "type": "string"
          },
          "deliveryLastName": {
            "description": "Delivery address last name",
            "example": "Doe",
            "type": "string"
          },
          "deliveryPhone": {
            "description": "Delivery phone number",
            "example": "+1234567890",
            "type": "string"
          },
          "deliveryPriceAmount": {
            "description": "Fixed delivery price amount in store currency",
            "example": 5.99,
            "format": "double",
            "type": "number"
          },
          "deliveryProvinceCode": {
            "description": "Delivery address province/state code (ISO 3166-2)",
            "example": "NY",
            "type": "string"
          },
          "deliveryZip": {
            "description": "Delivery address postal/zip code",
            "example": "10001",
            "type": "string"
          },
          "lines": {
            "description": "Product line items to include in the subscription",
            "items": {
              "$ref": "#/components/schemas/SubscriptionContractLineDTO"
            },
            "type": "array"
          },
          "locationId": {
            "description": "Shopify location ID used for local pickup. Required when methodType is PICK_UP",
            "example": "gid://shopify/Location/123456789",
            "type": "string"
          },
          "maxCycles": {
            "description": "Maximum number of billing cycles. Null for unlimited",
            "example": 12,
            "format": "int32",
            "minimum": 1,
            "type": "integer"
          },
          "methodType": {
            "default": "SHIPPING",
            "description": "Delivery method. LOCAL requires deliveryPhone, PICK_UP requires locationId",
            "enum": [
              "SHIPPING",
              "LOCAL",
              "PICK_UP"
            ],
            "example": "SHIPPING",
            "type": "string"
          },
          "minCycles": {
            "description": "Minimum number of billing cycles required before cancellation is allowed",
            "example": 3,
            "format": "int32",
            "minimum": 1,
            "type": "integer"
          },
          "nextBillingDate": {
            "description": "Date when the next billing/order will occur",
            "example": "2024-02-01T00:00:00Z",
            "format": "date-time",
            "type": "string"
          },
          "paymentMethodId": {
            "description": "Customer payment method ID. If not provided, the default payment method will be used. Can be null if createWithoutPaymentMethod is true.",
            "example": "gid://shopify/CustomerPaymentMethod/abc123",
            "type": "string"
          },
          "skipPaymentCreateUnpaidOrder": {
            "default": false,
            "description": "If true, billing attempts on this contract will create unpaid orders instead of failing when no payment method is present. Requires createWithoutPaymentMethod=true. Contract will be created as ACTIVE (not PAUSED) so billing can proceed.",
            "example": false,
            "type": "boolean"
          },
          "status": {
            "description": "Initial status of the subscription contract",
            "enum": [
              "ACTIVE",
              "PAUSED",
              "CANCELLED",
              "EXPIRED",
              "FAILED",
              "$UNKNOWN",
              "ACTIVE",
              "PAUSED",
              "CANCELLED",
              "EXPIRED",
              "FAILED"
            ],
            "example": "ACTIVE",
            "type": "string"
          }
        },
        "required": [
          "billingIntervalCount",
          "billingIntervalType",
          "customerId",
          "deliveryAddress1",
          "deliveryCity",
          "deliveryCountryCode",
          "lines",
          "nextBillingDate",
          "status"
        ],
        "type": "object"
      },
      "SubscriptionContractDetails": {
        "properties": {
          "activatedOn": {
            "format": "date-time",
            "type": "string"
          },
          "allowDeliveryAddressOverride": {
            "type": "boolean"
          },
          "allowDeliveryPriceOverride": {
            "type": "boolean"
          },
          "autoCharge": {
            "type": "boolean"
          },
          "billingCountryCode": {
            "type": "string"
          },
          "billingDateAfterTrial": {
            "format": "date-time",
            "type": "string"
          },
          "billingPolicyInterval": {
            "type": "string"
          },
          "billingPolicyIntervalCount": {
            "format": "int32",
            "type": "integer"
          },
          "cancellationFeedback": {
            "type": "string"
          },
          "cancellationNote": {
            "type": "string"
          },
          "cancelledOn": {
            "format": "date-time",
            "type": "string"
          },
          "contractAmount": {
            "format": "double",
            "type": "number"
          },
          "contractAmountUSD": {
            "format": "double",
            "type": "number"
          },
          "contractDetailsJSON": {
            "type": "string"
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "currencyCode": {
            "type": "string"
          },
          "customerEmail": {
            "type": "string"
          },
          "customerFirstName": {
            "type": "string"
          },
          "customerId": {
            "format": "int64",
            "type": "integer"
          },
          "customerLastName": {
            "type": "string"
          },
          "customerName": {
            "type": "string"
          },
          "customerTag": {
            "type": "string"
          },
          "deletedVariantIds": {
            "type": "string"
          },
          "deliveryCountryCode": {
            "type": "string"
          },
          "deliveryPolicyInterval": {
            "type": "string"
          },
          "deliveryPolicyIntervalCount": {
            "format": "int32",
            "type": "integer"
          },
          "disableFixEmptyQueue": {
            "type": "boolean"
          },
          "emailBouncedOrFailed": {
            "type": "boolean"
          },
          "endsAt": {
            "format": "date-time",
            "type": "string"
          },
          "graphCustomerId": {
            "type": "string"
          },
          "graphOrderId": {
            "type": "string"
          },
          "graphSubscriptionContractId": {
            "type": "string"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "importedId": {
            "type": "string"
          },
          "lastSuccessfulOrder": {
            "type": "string"
          },
          "lifetimeValue": {
            "format": "double",
            "type": "number"
          },
          "lifetimeValueUSD": {
            "format": "double",
            "type": "number"
          },
          "maxCycles": {
            "format": "int32",
            "type": "integer"
          },
          "minCycles": {
            "format": "int32",
            "type": "integer"
          },
          "nextBillingDate": {
            "format": "date-time",
            "type": "string"
          },
          "orderAmount": {
            "format": "double",
            "type": "number"
          },
          "orderAmountContractCurrency": {
            "format": "double",
            "type": "number"
          },
          "orderAmountShopCurrency": {
            "format": "double",
            "type": "number"
          },
          "orderAmountUSD": {
            "format": "double",
            "type": "number"
          },
          "orderId": {
            "format": "int64",
            "type": "integer"
          },
          "orderName": {
            "type": "string"
          },
          "orderNote": {
            "type": "string"
          },
          "orderNoteAttributes": {
            "type": "string"
          },
          "originType": {
            "enum": [
              "STORE_FRONT",
              "IMPORTED",
              "SPLIT_ATTEMPT_BILLING",
              "SPLIT_CONTRACT"
            ],
            "type": "string"
          },
          "originalContractId": {
            "format": "int64",
            "type": "integer"
          },
          "pauseDurationCycle": {
            "format": "int32",
            "type": "integer"
          },
          "pauseFeedback": {
            "type": "string"
          },
          "pauseReason": {
            "type": "string"
          },
          "pauseTillDate": {
            "format": "date-time",
            "type": "string"
          },
          "pausedFromActive": {
            "type": "boolean"
          },
          "pausedOn": {
            "format": "date-time",
            "type": "string"
          },
          "pendingCancellationCycle": {
            "format": "int32",
            "type": "integer"
          },
          "pendingCancellationDate": {
            "format": "date-time",
            "type": "string"
          },
          "phone": {
            "type": "string"
          },
          "queueUpdatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "shop": {
            "type": "string"
          },
          "skipPaymentCreateUnpaidOrder": {
            "type": "boolean"
          },
          "startsAt": {
            "format": "date-time",
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "stopUpComingOrderEmail": {
            "type": "boolean"
          },
          "subscriptionContractId": {
            "format": "int64",
            "type": "integer"
          },
          "subscriptionCreatedEmailSent": {
            "type": "boolean"
          },
          "subscriptionCreatedEmailSentStatus": {
            "enum": [
              "SENT",
              "UNSENT",
              "FAILED",
              "EMAIL_SETTINGS_DISABLED",
              "CUSTOMER_PAYMENT_EMPTY",
              "CONTRACT_PAUSED_STATUS"
            ],
            "type": "string"
          },
          "subscriptionCreatedSmsSentStatus": {
            "enum": [
              "SENT",
              "UNSENT",
              "FAILED",
              "SMS_SETTINGS_DISABLED",
              "CUSTOMER_PAYMENT_EMPTY",
              "CONTRACT_PAUSED_STATUS",
              "PHONE_NUMBER_EMPTY"
            ],
            "type": "string"
          },
          "subscriptionType": {
            "enum": [
              "REGULAR_SUBSCRIPTION",
              "BUILD_A_BOX_CLASSIC",
              "BUILD_A_BOX_SINGLE_PRODUCT",
              "BUNDLING_CLASSIC",
              "BUNDLING_MIX_AND_MATCH",
              "SECTIONED_BUNDLE",
              "VOLUME_DISCOUNT"
            ],
            "type": "string"
          },
          "subscriptionTypeIdentifier": {
            "type": "string"
          },
          "totalSuccessfulOrders": {
            "format": "int32",
            "type": "integer"
          },
          "upcomingEmailBufferDays": {
            "format": "int32",
            "type": "integer"
          },
          "upcomingEmailTaskUrl": {
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatingQueue": {
            "type": "boolean"
          }
        },
        "required": [
          "shop"
        ],
        "type": "object"
      },
      "SubscriptionContractDetailsDTO": {
        "properties": {
          "activatedOn": {
            "format": "date-time",
            "type": "string"
          },
          "allowDeliveryAddressOverride": {
            "type": "boolean"
          },
          "allowDeliveryPriceOverride": {
            "type": "boolean"
          },
          "autoCharge": {
            "type": "boolean"
          },
          "billingCountryCode": {
            "type": "string"
          },
          "billingDateAfterTrial": {
            "format": "date-time",
            "type": "string"
          },
          "billingPolicyInterval": {
            "type": "string"
          },
          "billingPolicyIntervalCount": {
            "format": "int32",
            "type": "integer"
          },
          "cancellationFeedback": {
            "type": "string"
          },
          "cancellationNote": {
            "type": "string"
          },
          "cancelledOn": {
            "format": "date-time",
            "type": "string"
          },
          "contractAmount": {
            "format": "double",
            "type": "number"
          },
          "contractAmountUSD": {
            "format": "double",
            "type": "number"
          },
          "contractDetailsJSON": {
            "type": "string"
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "currencyCode": {
            "type": "string"
          },
          "customerEmail": {
            "type": "string"
          },
          "customerFirstName": {
            "type": "string"
          },
          "customerId": {
            "format": "int64",
            "type": "integer"
          },
          "customerLastName": {
            "type": "string"
          },
          "customerName": {
            "type": "string"
          },
          "customerTag": {
            "type": "string"
          },
          "deletedVariantIds": {
            "type": "string"
          },
          "deliveryCountryCode": {
            "type": "string"
          },
          "deliveryPolicyInterval": {
            "type": "string"
          },
          "deliveryPolicyIntervalCount": {
            "format": "int32",
            "type": "integer"
          },
          "disableFixEmptyQueue": {
            "type": "boolean"
          },
          "emailBouncedOrFailed": {
            "type": "boolean"
          },
          "endsAt": {
            "format": "date-time",
            "type": "string"
          },
          "graphCustomerId": {
            "type": "string"
          },
          "graphOrderId": {
            "type": "string"
          },
          "graphSubscriptionContractId": {
            "type": "string"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "importedId": {
            "type": "string"
          },
          "lastSuccessfulOrder": {
            "type": "string"
          },
          "lifetimeValue": {
            "format": "double",
            "type": "number"
          },
          "lifetimeValueUSD": {
            "format": "double",
            "type": "number"
          },
          "maxCycles": {
            "format": "int32",
            "type": "integer"
          },
          "minCycles": {
            "format": "int32",
            "type": "integer"
          },
          "nextBillingDate": {
            "format": "date-time",
            "type": "string"
          },
          "nextPaidBillingDate": {
            "format": "date-time",
            "type": "string"
          },
          "orderAmount": {
            "format": "double",
            "type": "number"
          },
          "orderAmountContractCurrency": {
            "format": "double",
            "type": "number"
          },
          "orderAmountShopCurrency": {
            "format": "double",
            "type": "number"
          },
          "orderAmountUSD": {
            "format": "double",
            "type": "number"
          },
          "orderId": {
            "format": "int64",
            "type": "integer"
          },
          "orderName": {
            "type": "string"
          },
          "orderNote": {
            "type": "string"
          },
          "orderNoteAttributes": {
            "type": "string"
          },
          "originType": {
            "enum": [
              "STORE_FRONT",
              "IMPORTED",
              "SPLIT_ATTEMPT_BILLING",
              "SPLIT_CONTRACT"
            ],
            "type": "string"
          },
          "originalContractId": {
            "format": "int64",
            "type": "integer"
          },
          "pauseDurationCycle": {
            "format": "int32",
            "type": "integer"
          },
          "pauseFeedback": {
            "type": "string"
          },
          "pauseReason": {
            "type": "string"
          },
          "pauseTillDate": {
            "format": "date-time",
            "type": "string"
          },
          "pausedFromActive": {
            "type": "boolean"
          },
          "pausedOn": {
            "format": "date-time",
            "type": "string"
          },
          "pendingCancellationCycle": {
            "format": "int32",
            "type": "integer"
          },
          "pendingCancellationDate": {
            "format": "date-time",
            "type": "string"
          },
          "phone": {
            "type": "string"
          },
          "queueUpdatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "shop": {
            "type": "string"
          },
          "skipPaymentCreateUnpaidOrder": {
            "type": "boolean"
          },
          "startsAt": {
            "format": "date-time",
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "stopUpComingOrderEmail": {
            "type": "boolean"
          },
          "subscriptionContractId": {
            "format": "int64",
            "type": "integer"
          },
          "subscriptionCreatedEmailSent": {
            "type": "boolean"
          },
          "subscriptionCreatedEmailSentStatus": {
            "enum": [
              "SENT",
              "UNSENT",
              "FAILED",
              "EMAIL_SETTINGS_DISABLED",
              "CUSTOMER_PAYMENT_EMPTY",
              "CONTRACT_PAUSED_STATUS"
            ],
            "type": "string"
          },
          "subscriptionCreatedSmsSentStatus": {
            "enum": [
              "SENT",
              "UNSENT",
              "FAILED",
              "SMS_SETTINGS_DISABLED",
              "CUSTOMER_PAYMENT_EMPTY",
              "CONTRACT_PAUSED_STATUS",
              "PHONE_NUMBER_EMPTY"
            ],
            "type": "string"
          },
          "subscriptionType": {
            "enum": [
              "REGULAR_SUBSCRIPTION",
              "BUILD_A_BOX_CLASSIC",
              "BUILD_A_BOX_SINGLE_PRODUCT",
              "BUNDLING_CLASSIC",
              "BUNDLING_MIX_AND_MATCH",
              "SECTIONED_BUNDLE",
              "VOLUME_DISCOUNT"
            ],
            "type": "string"
          },
          "subscriptionTypeIdentifier": {
            "type": "string"
          },
          "totalSuccessfulOrders": {
            "format": "int32",
            "type": "integer"
          },
          "upcomingEmailBufferDays": {
            "format": "int32",
            "type": "integer"
          },
          "upcomingEmailTaskUrl": {
            "type": "string"
          },
          "updatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "updatingQueue": {
            "type": "boolean"
          }
        },
        "required": [
          "shop"
        ],
        "type": "object"
      },
      "SubscriptionContractIdsWrapper": {
        "properties": {
          "subscriptionIds": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "SubscriptionContractLineDTO": {
        "description": "Product line item for subscription contract",
        "properties": {
          "currentPrice": {
            "description": "Current price per unit after discounts. If not provided, calculated from selling plan",
            "example": 25.99,
            "format": "double",
            "type": "number"
          },
          "customAttributes": {
            "description": "Custom attributes for this line item",
            "example": [
              {
                "key": "engraving",
                "value": "Happy Birthday"
              }
            ],
            "items": {
              "$ref": "#/components/schemas/AttributeInputDTO"
            },
            "type": "array"
          },
          "linePricingPolicy": {
            "description": "Pricing policy type for subscription line items",
            "enum": [
              "SELLING_PLAN_PRICING_POLICY",
              "CUSTOM_PRICING_POLICY",
              "NO_PRICING_POLICY"
            ],
            "example": "SELLING_PLAN_PRICING_POLICY",
            "type": "string"
          },
          "pricingPolicy": {
            "description": "Custom pricing policy cycles when linePricingPolicy is CUSTOM_PRICING_POLICY",
            "items": {
              "$ref": "#/components/schemas/AppstleCycle"
            },
            "type": "array"
          },
          "productId": {
            "description": "Shopify product ID (numeric ID without gid prefix)",
            "example": "7234567890123",
            "type": "string"
          },
          "quantity": {
            "description": "Quantity of the product variant",
            "example": 2,
            "format": "int32",
            "minimum": 1,
            "type": "integer"
          },
          "sellingPlanId": {
            "description": "Selling plan ID to apply to this line item. Required for subscription pricing",
            "example": "gid://shopify/SellingPlan/123456",
            "type": "string"
          },
          "unitPrice": {
            "description": "Base price per unit before any discounts",
            "example": 29.99,
            "format": "double",
            "type": "number"
          },
          "variantId": {
            "description": "Shopify product variant ID (numeric ID without gid prefix)",
            "example": "42549172011164",
            "type": "string"
          }
        },
        "required": [
          "quantity",
          "variantId"
        ],
        "type": "object"
      },
      "SubscriptionContractOneOffDTO": {
        "description": "Represents a one-time product added to a subscription contract for a specific billing attempt",
        "properties": {
          "billingAttemptId": {
            "description": "The billing attempt ID this one-time product is associated with. This determines which upcoming order will include this product.",
            "example": 54321,
            "format": "int64",
            "minimum": 1,
            "type": "integer"
          },
          "id": {
            "description": "Unique identifier of the one-time product record",
            "example": 12345,
            "format": "int64",
            "readOnly": true,
            "type": "integer"
          },
          "price": {
            "description": "The price per unit of this product in the shop's base currency. This may include any applicable discounts.",
            "example": 19.99,
            "format": "double",
            "maximum": 999999.99,
            "minimum": 0.0,
            "type": "number"
          },
          "quantity": {
            "description": "The quantity of this product to include in the order",
            "example": 2,
            "format": "int32",
            "maximum": 999,
            "minimum": 1,
            "type": "integer"
          },
          "shop": {
            "description": "The Shopify store domain that owns this subscription",
            "example": "example-store.myshopify.com",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9-]*\\.myshopify\\.com$",
            "type": "string"
          },
          "subscriptionContractId": {
            "description": "The subscription contract ID this one-time product belongs to",
            "example": 98765,
            "format": "int64",
            "minimum": 1,
            "type": "integer"
          },
          "variantHandle": {
            "description": "The handle/slug of the product variant for URL-friendly identification",
            "example": "premium-coffee-blend-500g",
            "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$",
            "type": "string"
          },
          "variantId": {
            "description": "The Shopify product variant ID for this one-time product",
            "example": 42549172011164,
            "format": "int64",
            "minimum": 1,
            "type": "integer"
          }
        },
        "required": [
          "shop"
        ],
        "type": "object"
      },
      "SubscriptionCustomCssDTO": {
        "properties": {
          "bundlingCSS": {
            "type": "string"
          },
          "bundlingIframeCSS": {
            "type": "string"
          },
          "customCss": {
            "type": "string"
          },
          "customerPoratlCSS": {
            "type": "string"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "shop": {
            "type": "string"
          }
        },
        "required": [
          "shop"
        ],
        "type": "object"
      },
      "SubscriptionGroupPlan": {
        "properties": {
          "groupName": {
            "type": "string"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "infoJson": {
            "type": "string"
          },
          "productCount": {
            "format": "int32",
            "type": "integer"
          },
          "productIds": {
            "type": "string"
          },
          "productVariantCount": {
            "format": "int32",
            "type": "integer"
          },
          "shop": {
            "type": "string"
          },
          "subscriptionId": {
            "format": "int64",
            "type": "integer"
          },
          "translations": {
            "type": "string"
          },
          "variantIds": {
            "type": "string"
          },
          "variantProductIds": {
            "type": "string"
          }
        },
        "required": [
          "shop"
        ],
        "type": "object"
      },
      "SubscriptionGroupV2DTO": {
        "properties": {
          "accessoryProductIds": {
            "type": "string"
          },
          "deleteProducts": {
            "$ref": "#/components/schemas/ProductVariantDTO"
          },
          "groupName": {
            "type": "string"
          },
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "productCount": {
            "format": "int64",
            "type": "integer"
          },
          "productId": {
            "type": "string"
          },
          "productIds": {
            "type": "string"
          },
          "productVariantCount": {
            "format": "int64",
            "type": "integer"
          },
          "subscriptionPlans": {
            "items": {
              "$ref": "#/components/schemas/FrequencyInfoDTO"
            },
            "type": "array"
          },
          "translations": {
            "type": "string"
          },
          "updateProducts": {
            "$ref": "#/components/schemas/ProductVariantDTO"
          },
          "variantIds": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "TokenDetails": {
        "properties": {
          "manageSubscriptionLink": {
            "type": "string"
          },
          "tokenExpirationTime": {
            "format": "date-time",
            "type": "string"
          }
        },
        "type": "object"
      },
      "UpdateAttributesRequest": {
        "description": "Request to update custom attributes on a subscription contract",
        "properties": {
          "customAttributesList": {
            "description": "List of custom attributes to set on the subscription contract. Each attribute is a key-value pair that will be stored with the subscription.",
            "items": {
              "$ref": "#/components/schemas/OrderNoteAttribute"
            },
            "type": "array"
          },
          "subscriptionContractId": {
            "description": "The ID of the subscription contract to update",
            "example": 123456789,
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "customAttributesList",
          "subscriptionContractId"
        ],
        "type": "object"
      },
      "UpdateShopCustomizationRequest": {
        "properties": {
          "id": {
            "format": "int64",
            "type": "integer"
          },
          "labelId": {
            "format": "int64",
            "type": "integer"
          },
          "value": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "Value": {
        "properties": {
          "get__typename": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "VariantImage": {
        "properties": {
          "get__typename": {
            "type": "string"
          },
          "url": {
            "type": "object"
          }
        },
        "type": "object"
      },
      "VariantQuantity": {
        "properties": {
          "image": {
            "type": "string"
          },
          "productId": {
            "type": "string"
          },
          "productTitle": {
            "type": "string"
          },
          "quantity": {
            "format": "int32",
            "type": "integer"
          },
          "swapId": {
            "format": "int64",
            "type": "integer"
          },
          "title": {
            "type": "string"
          },
          "variantId": {
            "format": "int64",
            "type": "integer"
          },
          "variantTitle": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "VariantQuantityInfo": {
        "properties": {
          "variantQuantityList": {
            "items": {
              "$ref": "#/components/schemas/VariantQuantity"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "WeightCondition": {
        "properties": {
          "deliveryCondition": {
            "type": "string"
          },
          "weight": {
            "format": "double",
            "type": "number"
          },
          "weightUnit": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "ZoneInfo": {
        "properties": {
          "countries": {
            "items": {
              "$ref": "#/components/schemas/CountryInfoV3"
            },
            "type": "array"
          },
          "deliveryMethods": {
            "items": {
              "$ref": "#/components/schemas/DeliveryMethodInfoV3"
            },
            "type": "array"
          },
          "restOfWorld": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "ZonedDateTimeFilter": {
        "properties": {
          "equals": {
            "format": "date-time",
            "type": "string"
          },
          "greaterThan": {
            "format": "date-time",
            "type": "string"
          },
          "greaterThanOrEqual": {
            "format": "date-time",
            "type": "string"
          },
          "in": {
            "items": {
              "format": "date-time",
              "type": "string"
            },
            "type": "array"
          },
          "lessThan": {
            "format": "date-time",
            "type": "string"
          },
          "lessThanOrEqual": {
            "format": "date-time",
            "type": "string"
          },
          "notEquals": {
            "format": "date-time",
            "type": "string"
          },
          "notIn": {
            "items": {
              "format": "date-time",
              "type": "string"
            },
            "type": "array"
          },
          "specified": {
            "type": "boolean"
          }
        },
        "type": "object"
      }
    }
  },
  "info": {
    "description": "Comprehensive API documentation for managing subscriptions, payments, and related operations. These APIs allow you to programmatically manage subscription lifecycles, handle payments, configure products, and integrate subscription functionality into your applications.",
    "title": "Admin APIs",
    "version": "0.0.1"
  },
  "openapi": "3.0.1",
  "paths": {
    "/api/external/v2/activity-logs": {
      "get": {
        "description": "Retrieves activity logs for all subscription-related events and changes in the authenticated shop. Activity logs provide a comprehensive audit trail of all subscription activities, changes, and system events.\n\n**What are Activity Logs?**\nActivity logs are detailed records of every action, event, and change that occurs within your subscription system. They capture who made the change, when it happened, what was changed, and the result of the operation. This provides full traceability and audit capabilities for compliance, debugging, and customer support.\n\n**Log Information Captured:**\n- **Entity Information**:\n  - Entity ID: The specific subscription, billing attempt, or resource affected\n  - Entity Type: Type of resource (subscription, billing attempt, plan, settings, etc.)\n  - Event Type: Specific action performed (see Event Types below)\n  - Event Source: Origin of the event (customer portal, merchant portal, API, system, etc.)\n\n- **Event Details**:\n  - Status: SUCCESS, FAILURE, or INFO\n  - Timestamp: When the event occurred\n  - Activity By: User or system that triggered the event\n  - Client IP: IP address of the requester (if applicable)\n  - Additional Info: Detailed JSON payload with before/after values and context\n\n**Entity Types:**\n- `SUBSCRIPTION_BILLING_ATTEMPT` - Billing and payment attempt events\n- `SUBSCRIPTION_CONTRACT_DETAILS` - Subscription contract modifications\n- `SUBSCRIPTION_GROUP_PLAN` - Subscription plan changes\n- `SHIPPING_PROFILE` - Delivery profile and shipping updates\n- `CANCELLATION_MANAGEMENT` - Subscription cancellation events\n- `DUNNING_MANAGEMENT` - Payment retry and dunning activities\n- `PRODUCT_SWAP` - Product replacement events\n- `FREQUENCY_SWAP` - Billing/delivery frequency changes\n- `EMAIL_TEMPLATE` - Email template modifications\n- `SHOP_INFO` - Shop settings and configuration changes\n- `SUBSCRIPTION_WIDGET_SETTINGS` - Widget configuration updates\n- `CUSTOMER_PORTAL_SETTINGS` - Portal settings modifications\n- `SUBSCRIPTION_BUNDLING` - Bundle and bundling rule changes\n\n**Event Sources:**\n- `CUSTOMER_PORTAL` - Changes made by subscribers through the customer portal\n- `MERCHANT_PORTAL` - Changes made by merchants in the admin panel\n- `MERCHANT_EXTERNAL_API` - Changes made via API by merchants or integrations\n- `SHOPIFY_EVENT` - Events triggered by Shopify webhooks\n- `SHOPIFY_FLOW` - Events triggered by Shopify Flow automations\n- `SYSTEM_EVENT` - Automated system events (scheduled tasks, sync operations)\n- `MERCHANT_PORTAL_BULK_AUTOMATION` - Bulk operations initiated from admin panel\n\n**Common Event Types:**\n- **Subscription Changes**: CONTRACT_PAUSED, CONTRACT_ACTIVATED, CONTRACT_CANCELLED, CONTRACT_CREATED\n- **Product Changes**: PRODUCT_ADD, PRODUCT_REMOVE, PRODUCT_REPLACE, PRODUCT_QUANTITY_CHANGE, PRODUCT_PRICE_CHANGE\n- **Billing Changes**: NEXT_BILLING_DATE_CHANGE, BILLING_INTERVAL_CHANGE, BILLING_ATTEMPT_TRIGGERED, BILLING_ATTEMPT_SKIPPED\n- **Delivery Changes**: DELIVERY_INTERVAL_CHANGE, SHIPPING_ADDRESS_CHANGE, DELIVERY_METHOD_UPDATED\n- **Payment Changes**: PAYMENT_METHOD_UPDATED, SWITCH_PAYMENT_METHODS\n- **Email Events**: SEND_UPCOMING_ORDER_EMAIL, SEND_TRANSACTION_FAILED_EMAIL, SEND_SUBSCRIPTION_CREATED_EMAIL\n- **Discount Events**: DISCOUNT_APPLIED, DISCOUNT_REMOVED, PRICING_POLICY_DISCOUNT_APPLIED\n- **One-Time Products**: ONE_TIME_PURCHASE_PRODUCT_ADDED, ONE_TIME_PURCHASE_PRODUCT_REMOVED\n\n**Query Parameters and Filtering:**\n\nYou can filter activity logs using query parameters. All filters support standard operations:\n- `equals` - Exact match\n- `in` - Match any value in list\n- `greaterThan`, `lessThan` - Date range filtering\n- `contains` - Partial text match\n\n**Example Filter Queries:**\n\n1. **Get all failed billing attempts:**\n   `?entityType.equals=SUBSCRIPTION_BILLING_ATTEMPT&eventType.equals=BILLING_ATTEMPT_TRIGGERED&status.equals=FAILURE`\n\n2. **Get all customer portal changes:**\n   `?eventSource.equals=CUSTOMER_PORTAL`\n\n3. **Get logs for a specific subscription:**\n   `?entityId.equals=123456&entityType.equals=SUBSCRIPTION_CONTRACT_DETAILS`\n\n4. **Get logs within date range:**\n   `?createAt.greaterThan=2024-01-01T00:00:00Z&createAt.lessThan=2024-01-31T23:59:59Z`\n\n5. **Get all cancellation events:**\n   `?eventType.equals=CONTRACT_CANCELLED`\n\n6. **Get all API-triggered changes:**\n   `?eventSource.equals=MERCHANT_EXTERNAL_API`\n\n**Pagination:**\n\nResults are paginated. Use standard Spring Data pagination parameters:\n- `page` - Page number (zero-indexed, default: 0)\n- `size` - Page size (default: 20, max: 100)\n- `sort` - Sort criteria (e.g., `createAt,desc` or `id,asc`)\n\nExample: `?page=0&size=50&sort=createAt,desc`\n\n**Use Cases:**\n- **Audit and Compliance**: Track all changes for regulatory compliance and internal auditing\n- **Customer Support**: Review subscription history to troubleshoot customer issues\n- **Debugging**: Investigate failed operations and system errors\n- **Analytics**: Analyze customer behavior and subscription lifecycle patterns\n- **Reporting**: Generate reports on subscription changes, cancellations, and modifications\n- **Integration Monitoring**: Track API usage and automated workflow executions\n- **Security**: Monitor for unusual activity patterns or unauthorized changes\n\n**Important Notes:**\n- Activity logs are immutable and cannot be modified or deleted via API\n- Logs are retained according to your subscription plan's retention policy\n- The `additionalInfo` field contains detailed JSON with event-specific context\n- For large exports, consider using pagination and filtering to reduce data transfer\n- Logs are scoped to your shop - you can only access logs for your own subscriptions\n- System events may not have an `activityBy` value as they're automated\n\n**Response Headers:**\n- `X-Total-Count` - Total number of matching records\n- `Link` - Pagination links (first, last, next, prev)\n\n**Authentication:** Requires valid api_key query parameter with appropriate permissions",
        "operationId": "getAllActivityLogs",
        "parameters": [
          {
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Activity Log Search Criteria",
            "in": "query",
            "name": "criteria",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/ActivityLogCriteria"
            }
          },
          {
            "description": "Pagination parameters (page number and size)",
            "example": {
              "page": 0,
              "size": 10,
              "sort": [
                "id,desc"
              ]
            },
            "in": "query",
            "name": "pageable",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Pageable"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": [
                      {
                        "activityBy": "customer@example.com",
                        "additionalInfo": "{\"oldDate\":\"2024-03-01\",\"newDate\":\"2024-03-15\",\"reason\":\"Customer requested delay\"}",
                        "clientIp": "192.168.1.100",
                        "createAt": "2024-02-15T10:30:45Z",
                        "entityId": 123456,
                        "entityType": "SUBSCRIPTION_CONTRACT_DETAILS",
                        "eventSource": "CUSTOMER_PORTAL",
                        "eventType": "NEXT_BILLING_DATE_CHANGE",
                        "id": 789012,
                        "shop": "example-shop.myshopify.com",
                        "status": "SUCCESS"
                      },
                      {
                        "activityBy": "customer@example.com",
                        "additionalInfo": "{\"variantId\":987654321,\"quantity\":2,\"productTitle\":\"Premium Coffee Beans\",\"price\":\"24.99\"}",
                        "clientIp": "192.168.1.100",
                        "createAt": "2024-02-15T11:15:22Z",
                        "entityId": 123456,
                        "entityType": "SUBSCRIPTION_CONTRACT_DETAILS",
                        "eventSource": "CUSTOMER_PORTAL",
                        "eventType": "PRODUCT_ADD",
                        "id": 789013,
                        "shop": "example-shop.myshopify.com",
                        "status": "SUCCESS"
                      },
                      {
                        "activityBy": null,
                        "additionalInfo": "{\"amount\":\"49.99\",\"currency\":\"USD\",\"errorCode\":\"INSUFFICIENT_FUNDS\",\"errorMessage\":\"Card declined - insufficient funds\"}",
                        "clientIp": null,
                        "createAt": "2024-02-15T08:00:00Z",
                        "entityId": 456789,
                        "entityType": "SUBSCRIPTION_BILLING_ATTEMPT",
                        "eventSource": "SYSTEM_EVENT",
                        "eventType": "BILLING_ATTEMPT_TRIGGERED",
                        "id": 789014,
                        "shop": "example-shop.myshopify.com",
                        "status": "FAILURE"
                      },
                      {
                        "activityBy": "merchant-admin@example.com",
                        "additionalInfo": "{\"pauseReason\":\"Customer on vacation\",\"pauseDuration\":30,\"resumeDate\":\"2024-03-15\"}",
                        "clientIp": "203.0.113.45",
                        "createAt": "2024-02-14T16:45:30Z",
                        "entityId": 123456,
                        "entityType": "SUBSCRIPTION_CONTRACT_DETAILS",
                        "eventSource": "MERCHANT_PORTAL",
                        "eventType": "CONTRACT_PAUSED",
                        "id": 789015,
                        "shop": "example-shop.myshopify.com",
                        "status": "SUCCESS"
                      },
                      {
                        "activityBy": "api-integration",
                        "additionalInfo": "{\"oldVariantId\":111222333,\"newVariantId\":444555666,\"oldProductTitle\":\"Regular Coffee\",\"newProductTitle\":\"Premium Coffee\",\"priceChange\":5.00}",
                        "clientIp": "198.51.100.25",
                        "createAt": "2024-02-14T14:20:15Z",
                        "entityId": 789123,
                        "entityType": "PRODUCT_SWAP",
                        "eventSource": "MERCHANT_EXTERNAL_API",
                        "eventType": "PRODUCT_REPLACE",
                        "id": 789016,
                        "shop": "example-shop.myshopify.com",
                        "status": "SUCCESS"
                      }
                    ]
                  }
                },
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/ActivityLogDTO"
                  },
                  "type": "array"
                }
              }
            },
            "description": "Activity logs successfully retrieved. Returns paginated list of activity log entries."
          },
          "400": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Invalid filter criteria: createAt date format must be ISO-8601",
                  "status": 400,
                  "title": "Invalid request parameters",
                  "type": "https://example.com/errors/bad-request"
                }
              }
            },
            "description": "Invalid request parameters or filter criteria"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid api_key parameter is required to access activity logs",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required - Missing or invalid API key"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to access activity logs",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to view activity logs"
          },
          "429": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API rate limit exceeded. Please retry after 60 seconds.",
                  "retryAfter": 60,
                  "status": 429,
                  "title": "Rate limit exceeded",
                  "type": "https://example.com/errors/rate-limit"
                }
              }
            },
            "description": "Rate limit exceeded - Too many requests"
          }
        },
        "summary": "Get/Search activity logs",
        "tags": [
          "Operations & Settings"
        ]
      }
    },
    "/api/external/v2/associate-shopify-customer-to-external-payment-gateways": {
      "get": {
        "description": "Links a customer's payment profile from an external payment gateway (Stripe, Braintree, PayPal, Authorize.Net) to their Shopify customer account. This enables Shopify subscription billing to charge payment methods stored in external gateways, which is essential for migrating existing subscriptions or integrating with legacy payment systems.\n\n**What This Endpoint Does:**\nCreates a connection between a Shopify customer and their corresponding customer profile in an external payment gateway. This allows Shopify's subscription system to send billing requests to the external gateway using the stored payment credentials, effectively enabling subscriptions to bill through payment methods managed outside of Shopify.\n\n**Supported Payment Gateways:**\n\n**1. Stripe** (`paymentGateway=stripe`):\n- Requires: `customerProfileId` (Stripe customer ID, e.g., `cus_xxxxx`)\n- Requires: `paymentProfileId` (Stripe payment method ID, e.g., `pm_xxxxx` or card ID)\n- Links Shopify customer to Stripe customer and stored card/payment method\n\n**2. Braintree** (`paymentGateway=braintree`):\n- Requires: `customerProfileId` (Braintree customer ID)\n- Requires: `paymentProfileId` (Braintree payment method token)\n- Supports credit cards and PayPal accounts stored in Braintree vault\n\n**3. PayPal** (`paymentGateway=paypal`):\n- Requires: `paymentProfileId` (PayPal billing agreement ID)\n- Optional: `customerProfileId` (not required for PayPal)\n- Links Shopify customer to PayPal billing agreement\n\n**4. Authorize.Net** (`paymentGateway=authorize_net`):\n- Requires: `customerProfileId` (Authorize.Net customer profile ID)\n- Requires: `paymentProfileId` (Authorize.Net payment profile ID)\n- Links to Customer Information Manager (CIM) profiles\n\n**Request Parameters:**\n\n**Required Parameters:**\n- `paymentGateway` (string): Gateway name - `stripe`, `braintree`, `paypal`, or `authorize_net`\n- `paymentProfileId` (string): Payment method/card ID in the external gateway\n- `customerId` OR `email` (one required): Shopify customer identifier\n\n**Optional Parameters:**\n- `customerProfileId` (string): Customer ID in external gateway (required for Stripe, Braintree, Authorize.Net; optional for PayPal)\n\n**Customer Identification:**\n\n**By Customer ID (recommended):**\n- Provide Shopify `customerId` if known\n- Fastest and most reliable method\n- Avoids ambiguity with duplicate emails\n\n**By Email:**\n- Provide customer `email` if customer ID unknown\n- System looks up Shopify customer by email\n- If exactly one match: Uses that customer\n- If multiple matches: Returns error (ambiguous)\n- If no matches: Creates new Shopify customer with that email\n\n**Use Cases:**\n\n**1. Subscription Migration:**\n- Migrating subscriptions from legacy platform to Shopify\n- Preserving existing payment methods during migration\n- Avoiding customer disruption by not requiring payment re-entry\n- Maintaining payment history and customer profiles\n\n**2. Payment Gateway Integration:**\n- Using external payment processor for compliance reasons\n- Leveraging existing payment gateway relationships\n- Maintaining payment data in external PCI-compliant vault\n- Integrating with enterprise payment infrastructure\n\n**3. Multi-Platform Sync:**\n- Syncing payment methods from other sales channels\n- Centralizing payment methods across platforms\n- Enabling subscriptions for existing customer base\n\n**4. Custom Checkout Flows:**\n- Building custom subscription checkout with external gateway\n- Collecting payment via external gateway, then linking to Shopify\n- Supporting payment methods not natively available in Shopify\n\n**Process Flow:**\n\n1. **Customer Lookup**:\n   - If `customerId` provided: Use directly\n   - If `email` provided: Search for existing Shopify customer\n   - If email not found: Create new Shopify customer\n\n2. **Validation**:\n   - Validate payment gateway name\n   - Check required parameters for selected gateway\n   - Verify customer belongs to authenticated shop\n\n3. **Gateway Association**:\n   - Call Shopify GraphQL mutation for gateway-specific association\n   - Link customer profile ID and payment profile ID\n   - Store association in Shopify's payment instrument vault\n\n4. **Response**:\n   - Return Shopify's raw GraphQL response\n   - Response includes payment instrument ID for future use\n   - Contains success/error details from Shopify API\n\n**Example Requests:**\n\n**Stripe Example:**\n```\nGET /api/external/v2/associate-shopify-customer-to-external-payment-gateways?\n  paymentGateway=stripe&\n  customerId=12345&\n  customerProfileId=cus_ABC123&\n  paymentProfileId=pm_XYZ789\n```\n\n**Braintree with Email:**\n```\nGET /api/external/v2/associate-shopify-customer-to-external-payment-gateways?\n  paymentGateway=braintree&\n  email=customer@example.com&\n  customerProfileId=bt_customer_123&\n  paymentProfileId=bt_card_token_456\n```\n\n**PayPal Example:**\n```\nGET /api/external/v2/associate-shopify-customer-to-external-payment-gateways?\n  paymentGateway=paypal&\n  customerId=12345&\n  paymentProfileId=B-12345BILLING67890\n```\n\n**Important Considerations:**\n\n**Gateway Setup:**\n- External payment gateway must be installed and configured in Shopify\n- Gateway must be activated for subscription billing\n- Appropriate credentials and API keys must be configured\n\n**Data Validation:**\n- Payment profile IDs are not validated against external gateway\n- Invalid IDs will be accepted but will fail during actual billing\n- Test associations before migrating production subscriptions\n\n**Customer Creation:**\n- If customer doesn't exist and email provided, new customer is created\n- Created customers have minimal information (just email initially)\n- Consider adding additional customer details after creation\n\n**Security:**\n- This endpoint does NOT store or handle actual payment credentials\n- Only references/tokens to external gateway profiles are used\n- Payment data remains in external gateway's PCI-compliant vault\n- Shopify never receives sensitive card data\n\n**Best Practices:**\n\n1. **Test First**: Test with sandbox/test gateway credentials before production\n2. **Verify Gateway Active**: Ensure external gateway is properly configured in Shopify\n3. **Use Customer ID**: Prefer `customerId` over `email` to avoid ambiguity\n4. **Handle Errors**: Implement robust error handling for gateway failures\n5. **Validate Externally**: Verify payment profiles exist in external gateway before associating\n6. **Document IDs**: Keep mapping of Shopify customer IDs to external gateway IDs\n\n**Migration Workflow Example:**\n\n```\nFor each legacy subscription:\n1. Get customer email and Stripe customer ID from legacy system\n2. Call this endpoint to link Shopify customer to Stripe customer\n3. Create subscription contract in Shopify using returned payment instrument\n4. Verify subscription created successfully\n5. Mark legacy subscription as migrated\n6. Test billing with external gateway\n```\n\n**Troubleshooting:**\n\n**\"More than one customer found for email\"**:\n- Multiple Shopify customers exist with same email\n- Solution: Use specific `customerId` instead of email\n\n**\"Invalid payment gateway\"**:\n- Gateway name misspelled or unsupported\n- Solution: Use exact values: `stripe`, `braintree`, `paypal`, `authorize_net`\n\n**\"customerProfileId required\"**:\n- Missing required parameter for Stripe/Braintree/Authorize.Net\n- Solution: Provide customer ID from external gateway\n\n**Response Format:**\nReturns Shopify's raw GraphQL mutation response containing payment instrument details and success/error information.\n\n**Related Endpoints:**\n- `GET /api/external/v2/subscription-contract-details/shopify/customer/{customerId}/payment-methods` - Verify association successful\n- `PUT /api/external/v2/subscription-contracts-update-payment-method` - Use associated payment for subscription\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "associateShopifyCustomerToExternalPaymentGateways",
        "parameters": [
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Possible values (stripe, braintree, paypal, authorize_net)",
            "in": "query",
            "name": "paymentGateway",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Id of the customer to associate payment method with",
            "in": "query",
            "name": "customerId",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "Email of the customer to associate payment method with",
            "in": "query",
            "name": "email",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Id of customer in external payment gateway, not required for Paypal",
            "in": "query",
            "name": "customerProfileId",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Card Id or payment profile Id in external payment gateway",
            "in": "query",
            "name": "paymentProfileId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Successful Stripe association": {
                    "description": "Successful Stripe association",
                    "value": {
                      "data": {
                        "customerPaymentMethodRemoteUserInfoCreate": {
                          "customerPaymentMethod": {
                            "id": "gid://shopify/CustomerPaymentMethod/abc123",
                            "instrument": {
                              "__typename": "CustomerCreditCard",
                              "brand": "VISA",
                              "lastDigits": "4242"
                            }
                          },
                          "userErrors": []
                        }
                      }
                    }
                  }
                }
              }
            },
            "description": "Successfully associated external payment gateway customer with Shopify customer. Returns Shopify GraphQL raw response."
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Invalid payment gateway": {
                    "description": "Invalid payment gateway",
                    "value": {
                      "detail": "Invalid payment gateway: invalid_gateway. Supported: stripe, braintree, paypal, authorize_net",
                      "status": 400,
                      "title": "Invalid payment gateway",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Missing customer identifier": {
                    "description": "Missing customer identifier",
                    "value": {
                      "detail": "CustomerId or email is required",
                      "status": 400,
                      "title": "Missing required parameter",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Missing customerProfileId for Stripe": {
                    "description": "Missing customerProfileId for Stripe",
                    "value": {
                      "detail": "customerProfileId is required for stripe customers",
                      "status": 400,
                      "title": "Missing required parameter",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Bad request - Invalid parameters, missing required fields, or invalid payment gateway"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header is required",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "No customer found with ID 12345 in Shopify",
                  "status": 404,
                  "title": "Customer not found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Customer not found (when using customerId)"
          },
          "409": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "More than one customer found for: customer@example.com. Please provide specific customerId instead.",
                  "status": 409,
                  "title": "Multiple customers found",
                  "type": "https://example.com/errors/conflict"
                }
              }
            },
            "description": "Conflict - Multiple customers found with provided email"
          },
          "500": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Error in creating customer id with email: customer@example.com",
                  "status": 500,
                  "title": "Association failed",
                  "type": "https://example.com/errors/internal-error"
                }
              }
            },
            "description": "Internal error - Failed to associate payment method or Shopify API error"
          },
          "502": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Failed to communicate with external payment gateway",
                  "status": 502,
                  "title": "Payment gateway error",
                  "type": "https://example.com/errors/bad-gateway"
                }
              }
            },
            "description": "Bad gateway - External payment gateway or Shopify API error"
          }
        },
        "summary": "Associate external payment gateway customer with Shopify customer",
        "tags": [
          "Subscription Contracts",
          "Billing & Payments"
        ]
      }
    },
    "/api/external/v2/build-a-box": {
      "post": {
        "description": "Creates a new subscription bundle (Build-A-Box) allowing customers to select and customize products for recurring deliveries. Build-A-Box enables a flexible subscription model where customers can create personalized product boxes.\n\n**What is Build-A-Box?**\nBuild-A-Box is a subscription feature that allows customers to curate their own product bundles by selecting from a predefined set of products. This creates a highly personalized subscription experience where customers have full control over what they receive in each delivery cycle.\n\n**Key Features:**\n- **Product Selection**: Customers choose which products to include in their box\n- **Quantity Control**: Set minimum and maximum product quantities\n- **Flexible Configuration**: Define rules for product combinations\n- **Pricing Models**: Support for various pricing strategies (per-item, flat rate, tiered)\n- **Recurring Delivery**: Automatic fulfillment based on subscription frequency\n- **Customization Options**: Allow product swaps between delivery cycles\n\n**Configuration Options:**\n- **Bundle Settings**:\n  - Bundle name and description\n  - Unique handle for identification\n  - Product pool (available products for selection)\n  - Minimum/maximum number of products\n  - Product quantity limits\n\n- **Pricing Configuration**:\n  - Pricing type (per-product, flat rate, or tiered)\n  - Discount rules\n  - Promotional pricing\n  - Currency settings\n\n- **Delivery Options**:\n  - Subscription frequencies (weekly, bi-weekly, monthly, etc.)\n  - Delivery intervals\n  - Cut-off times for order modifications\n  - Shipping methods\n\n- **Rules and Restrictions**:\n  - Product combination rules\n  - Category restrictions\n  - Inventory requirements\n  - Customer eligibility criteria\n\n**Build-A-Box Types:**\n1. **Open Selection**: Customers can choose any products from the available pool\n2. **Category-Based**: Products are organized into categories with selection rules\n3. **Single Product**: Customers select variations of a single product type\n4. **Tiered Boxes**: Different box sizes with varying product counts and pricing\n\n**Use Cases:**\n- **Coffee Subscription**: Customers select different coffee blends for monthly delivery\n- **Snack Boxes**: Build custom snack boxes from a variety of treats\n- **Beauty Boxes**: Choose skincare and makeup products based on preferences\n- **Meal Kits**: Select recipes and ingredients for weekly meal planning\n- **Pet Supply Boxes**: Customize toys, treats, and supplies for pets\n- **Supplement Subscriptions**: Create personalized vitamin and supplement regimens\n\n**Customer Workflow:**\n1. Customer discovers Build-A-Box offering\n2. Selects products from available options\n3. Chooses delivery frequency\n4. Reviews pricing and discounts\n5. Completes subscription signup\n6. Receives recurring deliveries\n7. Can modify selections between delivery cycles\n\n**Important Notes:**\n- Each bundle must have a unique handle for identification\n- Product availability is validated at creation time\n- Pricing rules are applied based on bundle configuration\n- Bundles must be associated with at least one subscription frequency\n- Inventory levels should be checked for all included products\n- Bundle status (active/inactive) controls customer visibility\n\n**Best Practices:**\n- Set clear minimum and maximum product limits\n- Provide detailed product descriptions and images\n- Configure appropriate pricing that encourages subscriptions\n- Offer multiple delivery frequency options\n- Set reasonable inventory thresholds\n- Enable customer portal access for subscription management\n- Test bundle configurations before making them live\n\n**Authentication:** Requires valid X-API-Key header or api_key parameter (deprecated)",
        "operationId": "createSubscriptionBundling",
        "parameters": [
          {
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubscriptionBundlingDTO"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "active": true,
                      "allowOneTimePurchase": true,
                      "availableProducts": [
                        {
                          "imageUrl": "https://cdn.shopify.com/coffee-medium.jpg",
                          "price": "14.99",
                          "productId": 111111,
                          "title": "Medium Roast Coffee - 12oz",
                          "variantId": 222222
                        },
                        {
                          "imageUrl": "https://cdn.shopify.com/coffee-dark.jpg",
                          "price": "15.99",
                          "productId": 111111,
                          "title": "Dark Roast Coffee - 12oz",
                          "variantId": 333333
                        }
                      ],
                      "buildABoxType": "SINGLE_PRODUCT",
                      "buildBoxVersion": "V2",
                      "bundleHandle": "premium-coffee-selection",
                      "bundleName": "Premium Coffee Selection",
                      "createdAt": "2024-03-15T10:30:00Z",
                      "description": "Choose your favorite coffee blends for monthly delivery",
                      "discount": 10.0,
                      "discountType": "PERCENTAGE",
                      "frequencies": [
                        {
                          "displayName": "Monthly",
                          "interval": "MONTH",
                          "intervalCount": 1
                        },
                        {
                          "displayName": "Bi-Weekly",
                          "interval": "WEEK",
                          "intervalCount": 2
                        }
                      ],
                      "id": 45678,
                      "maxProductCount": 5,
                      "minProductCount": 2,
                      "pricingType": "PER_PRODUCT",
                      "shop": "example-shop.myshopify.com",
                      "uniqueRef": "bab_abc123xyz",
                      "updatedAt": "2024-03-15T10:30:00Z"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionBundlingDTO"
                }
              }
            },
            "description": "Build-A-Box subscription bundle successfully created"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Bundle Already Has ID": {
                    "description": "Bundle Already Has ID",
                    "value": {
                      "detail": "A new Build-A-Box cannot already have an ID",
                      "entityName": "subscriptionBundling",
                      "errorKey": "idexists",
                      "status": 400,
                      "title": "Invalid bundle creation",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Limits": {
                    "description": "Invalid Limits",
                    "value": {
                      "detail": "Minimum product count cannot exceed maximum product count",
                      "status": 400,
                      "title": "Invalid product limits",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Product Configuration": {
                    "description": "Invalid Product Configuration",
                    "value": {
                      "detail": "One or more products in the bundle are not available or do not exist",
                      "status": 400,
                      "title": "Invalid product configuration",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid bundle configuration or validation failure"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header or api_key parameter is required",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required - Missing or invalid API key"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to create Build-A-Box bundles",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to create Build-A-Box bundles"
          },
          "422": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Bundle handle must be unique. A bundle with this handle already exists.",
                  "status": 422,
                  "title": "Validation failure",
                  "type": "https://example.com/errors/unprocessable-entity"
                }
              }
            },
            "description": "Unprocessable entity - Business logic validation failure"
          },
          "500": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "An unexpected error occurred while creating the Build-A-Box bundle",
                  "status": 500,
                  "title": "Internal server error",
                  "type": "https://example.com/errors/internal-server-error"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Create a new Build-A-Box subscription bundle",
        "tags": [
          "Build-a-Box & Bundles"
        ]
      },
      "put": {
        "description": "Updates an existing Build-A-Box subscription bundle with new configuration settings, product selections, pricing rules, or other bundle attributes. This endpoint allows you to modify any aspect of a previously created bundle while maintaining its unique identifier and shop association.\n\n**What Can Be Updated:**\n- **Bundle Information**: Name, description, handle, and display settings\n- **Product Configuration**: Available products, product pool, and selection rules\n- **Quantity Limits**: Minimum and maximum product counts per box\n- **Pricing Settings**: Pricing type, discount rules, and promotional offers\n- **Delivery Options**: Subscription frequencies and delivery intervals\n- **Business Rules**: Product combination rules, category restrictions\n- **Status**: Active/inactive state for customer visibility\n- **Customization Options**: Allow product swaps, one-time purchases\n\n**Update Behavior:**\n- The bundle ID must be provided in the request body\n- Shop ownership is verified - you can only update bundles belonging to your shop\n- All fields in the request body will update the corresponding bundle properties\n- Partial updates are supported - only include fields you want to change\n- The update is atomic - either all changes succeed or none are applied\n- Existing subscriptions using this bundle are not automatically affected\n\n**Impact on Active Subscriptions:**\n- Changes to product availability affect future customer selections\n- Pricing updates apply to new subscriptions but not existing ones by default\n- Quantity limit changes are enforced on next customer modification\n- Frequency changes only affect new subscriptions\n- Deactivating a bundle prevents new subscriptions but maintains existing ones\n\n**Common Update Scenarios:**\n1. **Add/Remove Products**: Update the available product pool\n2. **Adjust Pricing**: Change discount percentages or pricing models\n3. **Modify Limits**: Update minimum/maximum product selection rules\n4. **Change Frequencies**: Add or remove subscription interval options\n5. **Update Content**: Modify bundle name, description, or images\n6. **Toggle Status**: Activate or deactivate bundle availability\n7. **Refine Rules**: Adjust product combination or category restrictions\n\n**Best Practices:**\n- Verify product availability before adding to the bundle\n- Test pricing changes with sample calculations\n- Communicate bundle changes to existing subscribers\n- Use inactive status for testing changes before making them live\n- Keep bundle handles consistent for external integrations\n- Document major changes for customer support reference\n- Consider seasonal or promotional updates to keep offerings fresh\n\n**Validation Rules:**\n- Bundle ID is required and must exist\n- Shop must match the authenticated shop (cannot transfer bundles)\n- All referenced products must be valid and available\n- Minimum product count cannot exceed maximum product count\n- Pricing values must be non-negative\n- Bundle handle should remain unique across all bundles\n\n**Authentication:** Requires valid X-API-Key header or api_key parameter (deprecated)",
        "operationId": "updateSubscriptionBundling",
        "parameters": [
          {
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubscriptionBundlingDTO"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Updated Bundle": {
                    "description": "Updated Bundle",
                    "value": {
                      "active": true,
                      "allowOneTimePurchase": true,
                      "availableProducts": [
                        {
                          "price": "14.99",
                          "productId": 111111,
                          "title": "Medium Roast Coffee - 12oz",
                          "variantId": 222222
                        },
                        {
                          "price": "15.99",
                          "productId": 111111,
                          "title": "Dark Roast Coffee - 12oz",
                          "variantId": 333333
                        },
                        {
                          "price": "16.99",
                          "productId": 111111,
                          "title": "Espresso Roast Coffee - 12oz",
                          "variantId": 444444
                        }
                      ],
                      "buildABoxType": "SINGLE_PRODUCT",
                      "buildBoxVersion": "V2",
                      "bundleHandle": "premium-coffee-selection",
                      "bundleName": "Premium Coffee Selection - Updated",
                      "createdAt": "2024-03-15T10:30:00Z",
                      "description": "Choose from our expanded selection of artisan coffee blends",
                      "discount": 15.0,
                      "discountType": "PERCENTAGE",
                      "frequencies": [
                        {
                          "displayName": "Monthly",
                          "interval": "MONTH",
                          "intervalCount": 1
                        },
                        {
                          "displayName": "Bi-Weekly",
                          "interval": "WEEK",
                          "intervalCount": 2
                        }
                      ],
                      "id": 45678,
                      "maxProductCount": 6,
                      "minProductCount": 3,
                      "pricingType": "PER_PRODUCT",
                      "shop": "example-shop.myshopify.com",
                      "uniqueRef": "bab_abc123xyz",
                      "updatedAt": "2024-03-20T14:45:00Z"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionBundlingDTO"
                }
              }
            },
            "description": "Build-A-Box subscription bundle successfully updated"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Invalid Configuration": {
                    "description": "Invalid Configuration",
                    "value": {
                      "detail": "Minimum product count (5) cannot exceed maximum product count (3)",
                      "status": 400,
                      "title": "Invalid configuration",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Missing Bundle ID": {
                    "description": "Missing Bundle ID",
                    "value": {
                      "detail": "Bundle ID is required for updates",
                      "entityName": "subscriptionBundling",
                      "errorKey": "idnull",
                      "status": 400,
                      "title": "Invalid bundle update",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Unauthorized Access": {
                    "description": "Unauthorized Access",
                    "value": {
                      "detail": "Unauthorized access or resource not found. Bundle does not belong to your shop.",
                      "entityName": "subscriptionBundling",
                      "errorKey": "unauthorized",
                      "status": 400,
                      "title": "Unauthorized access",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid update request or validation failure"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header or api_key parameter is required",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required - Missing or invalid API key"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "No Build-A-Box bundle found with ID 45678",
                  "status": 404,
                  "title": "Bundle not found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Bundle not found with the specified ID"
          },
          "500": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "An unexpected error occurred while updating the Build-A-Box bundle",
                  "status": 500,
                  "title": "Internal server error",
                  "type": "https://example.com/errors/internal-server-error"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Update an existing Build-A-Box subscription bundle",
        "tags": [
          "Build-a-Box & Bundles"
        ]
      }
    },
    "/api/external/v2/build-a-box/{handle}": {
      "get": {
        "description": "Fetches comprehensive Build-A-Box bundle configuration using a user-friendly handle (URL slug) instead of numeric ID. This endpoint is specifically designed for customer-facing storefronts and integration scenarios where you want to reference bundles by their human-readable handles rather than database IDs.\n\n**Key Differences from GET /{id}:**\n- **Lookup Method**: Uses bundle handle (e.g., 'premium-coffee-box') instead of numeric ID (e.g., 12345)\n- **Response Format**: Returns SubscriptionBundlingResponseV3 with enhanced structure\n- **Customer Focus**: Optimized for storefront display and customer selection workflows\n- **Bundle + Subscription**: Returns both bundle details AND associated subscription plan information\n- **Public Access**: Designed for integration in customer-facing applications\n\n**What is a Bundle Handle?**\nA handle is a URL-friendly identifier for a bundle:\n- Format: lowercase letters, numbers, and hyphens only\n- Example: `premium-coffee-selection`, `monthly-snack-box`, `beauty-essentials`\n- Stable: Unlike IDs, handles remain consistent across environments\n- SEO-Friendly: Can be used in customer-facing URLs\n- Human-Readable: Easy to remember and communicate\n\n**Response Structure (SubscriptionBundlingResponseV3):**\n```json\n{\n  \"bundle\": {           // Complete bundle configuration\n    \"id\": 45678,\n    \"bundleName\": \"Premium Coffee Selection\",\n    \"bundleHandle\": \"premium-coffee-selection\",\n    \"description\": \"...\",\n    \"products\": [...],\n    \"pricing\": {...},\n    \"active\": true\n  },\n  \"subscription\": {     // Associated subscription plan details\n    \"planId\": 98765,\n    \"frequencies\": [...],\n    \"deliveryOptions\": {...},\n    \"sellingPlan\": {...}\n  }\n}\n```\n\n**Primary Use Cases:**\n1. **Storefront Integration**: Display bundle details on product pages\n2. **Customer Portal**: Allow customers to browse available bundles\n3. **Landing Pages**: Create dedicated pages for specific bundles using handles\n4. **Marketing Campaigns**: Link directly to bundles with memorable URLs\n5. **Cross-Platform Sync**: Use stable handles for multi-platform integrations\n6. **Mobile Apps**: Retrieve bundle data using consistent identifiers\n7. **External Integrations**: Third-party systems can reference bundles by handle\n\n**When to Use Handle vs ID:**\n- **Use Handle** when:\n  - Building customer-facing features\n  - Creating shareable URLs\n  - Syncing across environments (dev \u2192 staging \u2192 prod)\n  - External systems need stable references\n  - SEO and user experience are priorities\n\n- **Use ID** when:\n  - You already have the numeric ID from another API response\n  - Performing administrative operations\n  - Internal system integration\n  - Optimizing for query performance\n\n**Availability Validation:**\nThe endpoint validates that:\n- Bundle exists and belongs to the specified shop\n- Bundle has an associated subscription configuration\n- If validation fails, returns 404 Not Found\n- Both bundle AND subscription must be present for success response\n\n**Integration Examples:**\n**Storefront Display:**\n```javascript\n// Fetch bundle for display on product page\nconst handle = 'premium-coffee-selection';\nconst response = await fetch(\n  `/api/external/v2/build-a-box/${handle}`,\n  { headers: { 'X-API-Key': 'your-api-key' } }\n);\nconst { bundle, subscription } = await response.json();\ndisplayBundleOptions(bundle, subscription);\n```\n\n**Best Practices:**\n- **Handle Naming**: Use descriptive, SEO-friendly handles\n- **Caching**: Cache bundle data with handle as key for better performance\n- **Error Handling**: Always check for 404 - bundle may be deleted or deactivated\n- **Environment Sync**: Use handles to maintain consistency across environments\n- **URL Structure**: Incorporate handles into clean, readable URLs\n- **Documentation**: Document handle conventions for your team\n\n**Performance Considerations:**\n- Handle lookups may be slightly slower than ID lookups\n- Response includes full bundle + subscription data (larger payload)\n- Consider caching for frequently accessed bundles\n- Returns complete product catalog for the bundle\n\n**Authentication:** Requires valid X-API-Key header or api_key parameter (deprecated)",
        "operationId": "getValidSubscriptionCustomerV2_2",
        "parameters": [
          {
            "description": "Bundle Handle",
            "in": "path",
            "name": "handle",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Complete Bundle and Subscription Response": {
                    "description": "Complete Bundle and Subscription Response",
                    "value": {
                      "bundle": {
                        "active": true,
                        "allowOneTimePurchase": true,
                        "buildABoxType": "SINGLE_PRODUCT",
                        "buildBoxVersion": "V2",
                        "bundleHandle": "premium-coffee-selection",
                        "bundleName": "Premium Coffee Selection",
                        "description": "Choose your favorite coffee blends for monthly delivery",
                        "discount": 10.0,
                        "discountType": "PERCENTAGE",
                        "id": 45678,
                        "maxProductCount": 5,
                        "minProductCount": 2,
                        "products": [
                          {
                            "imageUrl": "https://cdn.shopify.com/coffee-medium.jpg",
                            "price": "14.99",
                            "productId": 111111,
                            "title": "Medium Roast Coffee - 12oz",
                            "variantId": 222222
                          }
                        ],
                        "shop": "example-shop.myshopify.com",
                        "uniqueRef": "bab_abc123xyz"
                      },
                      "createdAt": "2024-03-15T10:30:00Z",
                      "subscription": {
                        "deliveryPolicy": {
                          "anchors": [],
                          "type": "RECURRING"
                        },
                        "frequencies": [
                          {
                            "displayName": "Deliver every month",
                            "interval": "MONTH",
                            "intervalCount": 1
                          },
                          {
                            "displayName": "Deliver every 2 weeks",
                            "interval": "WEEK",
                            "intervalCount": 2
                          }
                        ],
                        "sellingPlanGroupId": "gid://shopify/SellingPlanGroup/123456",
                        "subscriptionPlanId": 98765
                      },
                      "updatedAt": "2024-03-20T14:45:00Z"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionBundlingResponseV3"
                }
              }
            },
            "description": "Bundle and subscription details successfully retrieved"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header or api_key parameter is required",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required - Missing or invalid API key"
          },
          "404": {
            "content": {
              "application/json": {
                "examples": {
                  "Bundle Not Found": {
                    "description": "No bundle exists with the specified handle",
                    "value": {
                      "detail": "No Build-A-Box bundle found with handle 'premium-coffee-selection'",
                      "status": 404,
                      "title": "Bundle not found",
                      "type": "https://example.com/errors/not-found"
                    }
                  },
                  "Subscription Not Configured": {
                    "description": "Bundle found but subscription plan is not set up",
                    "value": {
                      "detail": "Bundle exists but has no associated subscription plan configured",
                      "status": 404,
                      "title": "Subscription configuration missing",
                      "type": "https://example.com/errors/not-found"
                    }
                  }
                }
              }
            },
            "description": "Bundle not found, subscription not configured, or bundle not available"
          },
          "500": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "An unexpected error occurred while retrieving the Build-A-Box bundle",
                  "status": 500,
                  "title": "Internal server error",
                  "type": "https://example.com/errors/internal-server-error"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Retrieve Build-A-Box bundle details by handle for customer storefront",
        "tags": [
          "Build-a-Box & Bundles"
        ]
      }
    },
    "/api/external/v2/build-a-box/{id}": {
      "delete": {
        "description": "Permanently removes a Build-A-Box subscription bundle from your shop. This operation is irreversible and will prevent new customers from subscribing to this bundle. However, existing subscriptions using this bundle will remain active.\n\n**Important Deletion Rules:**\n1. **Active Subscriptions Check**: The system prevents deletion if there are active subscriptions using this bundle\n2. **Alternative Approach**: If active subscriptions exist, you must first deactivate the bundle instead of deleting it\n3. **Shop Ownership**: You can only delete bundles that belong to your authenticated shop\n4. **Irreversible**: Once deleted, the bundle configuration cannot be recovered\n5. **Clean Deletion**: Only bundles with zero associated subscriptions can be permanently removed\n\n**Deletion Workflow:**\n```\n1. Request deletion of bundle with ID\n2. System checks for shop ownership\n3. System counts active subscriptions using this bundle\n4. If subscriptions exist \u2192 Returns error with subscription count\n5. If no subscriptions \u2192 Deletes bundle permanently\n6. Returns success (204 No Content)\n```\n\n**When Deletion is Blocked:**\nThe system will prevent deletion and return a 400 error if:\n- One or more active subscriptions are using this bundle\n- The error message will include the exact count of active subscriptions\n- Example: \"Deleting Build-A-Box is not possible, 47 subscriptions found. You may deactivate the Build-A-Box.\"\n\n**Recommended Workflow for Active Bundles:**\nIf you want to stop offering a bundle that has active subscribers:\n1. **Update** the bundle to set `active: false` (this prevents new subscriptions)\n2. **Monitor** existing subscriptions until they naturally expire or are cancelled\n3. **Migrate** customers to a different bundle if needed\n4. **Delete** the bundle once all subscriptions have been resolved\n\n**Use Cases:**\n- **Testing Cleanup**: Remove test bundles created during development\n- **Failed Configurations**: Delete bundles that were incorrectly set up\n- **Seasonal Offerings**: Remove time-limited bundles after the season ends (if no subscriptions)\n- **Product Discontinuation**: Clean up bundles for discontinued product lines\n- **Duplicate Bundles**: Remove accidentally created duplicate configurations\n\n**Best Practices:**\n- **Check Before Deleting**: Always verify no active subscriptions exist\n- **Use Deactivation First**: Set bundles to inactive before attempting deletion\n- **Document Changes**: Keep records of when and why bundles were deleted\n- **Backup Configuration**: Save bundle settings before deletion for potential recreation\n- **Communicate Changes**: Inform team members about bundle removals\n- **Consider Archiving**: For historical reference, deactivate rather than delete when possible\n\n**What Happens After Deletion:**\n- Bundle configuration is permanently removed from the database\n- Bundle ID becomes available for reuse (though not recommended)\n- Bundle handle becomes available for new bundles\n- External integrations referencing this bundle will receive 404 errors\n- Analytics and historical data may reference the deleted bundle ID\n\n**Error Prevention:**\nBefore attempting deletion, you can:\n1. Query active subscriptions to check for bundle usage\n2. Set the bundle to inactive status first\n3. Wait for all subscriptions to complete or migrate customers\n4. Then proceed with deletion\n\n**Authentication:** Requires valid X-API-Key header or api_key parameter (deprecated)",
        "operationId": "deleteSubscriptionBundling",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "content": {
              "application/json": {}
            },
            "description": "Build-A-Box bundle successfully deleted. No content returned."
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Active Subscriptions Exist": {
                    "description": "Bundle has 47 active subscriptions and cannot be deleted",
                    "value": {
                      "detail": "Deleting Build-A-Box is not possible, 47 subscriptions found. You may deactivate the Build-A-Box.",
                      "entityName": "subscriptionBundling",
                      "errorKey": "activeSubscriptionsExist",
                      "status": 400,
                      "title": "Cannot delete bundle",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Unauthorized Access": {
                    "description": "Unauthorized Access",
                    "value": {
                      "detail": "Unauthorized access or resource not found. Bundle does not belong to your shop.",
                      "entityName": "subscriptionBundling",
                      "errorKey": "unauthorized",
                      "status": 400,
                      "title": "Unauthorized access",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Deletion blocked due to active subscriptions or validation failure"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header or api_key parameter is required",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required - Missing or invalid API key"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "No Build-A-Box bundle found with ID 45678 for your shop",
                  "status": 404,
                  "title": "Bundle not found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Bundle not found or does not belong to your shop"
          },
          "500": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "An unexpected error occurred while deleting the Build-A-Box bundle",
                  "status": 500,
                  "title": "Internal server error",
                  "type": "https://example.com/errors/internal-server-error"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Delete a Build-A-Box subscription bundle",
        "tags": [
          "Build-a-Box & Bundles"
        ]
      },
      "get": {
        "description": "Fetches the complete configuration and details of a specific Build-A-Box subscription bundle using its unique identifier. This endpoint returns all bundle settings including products, pricing, rules, and delivery options.\n\n**What You'll Receive:**\n- **Complete Bundle Configuration**: All settings and properties\n- **Product Information**: Full list of available products with details\n- **Pricing Structure**: Discount rules, pricing type, and promotional settings\n- **Delivery Options**: Subscription frequencies and delivery intervals\n- **Business Rules**: Product limits, combination rules, and restrictions\n- **Status Information**: Active/inactive state and timestamps\n- **Customization Settings**: Allow one-time purchases, product swaps, etc.\n\n**Use Cases:**\n1. **Bundle Management**: Retrieve current bundle settings for review or editing\n2. **Integration Sync**: Synchronize bundle data with external systems\n3. **Customer Portal**: Display bundle options and configurations\n4. **Audit & Reporting**: Track bundle configurations over time\n5. **Validation**: Verify bundle setup before making changes\n6. **Cloning**: Retrieve settings to duplicate a successful bundle\n7. **Troubleshooting**: Debug subscription issues by reviewing bundle config\n\n**Response Details:**\nThe response includes comprehensive information about the bundle:\n- **Bundle Metadata**: ID, shop, name, handle, unique reference\n- **Product Pool**: All products available for customer selection\n- **Selection Rules**: Min/max product counts, quantity limits\n- **Pricing Configuration**: Discount percentages, pricing models\n- **Subscription Options**: Available delivery frequencies\n- **Display Settings**: Product view styles, custom HTML, button text\n- **Advanced Features**: Third-party rules, inventory tracking, selection types\n- **Timestamps**: Creation and last update dates\n\n**Authorization:**\n- You can only retrieve bundles that belong to your authenticated shop\n- The system verifies shop ownership before returning bundle data\n- Returns 404 if bundle doesn't exist or doesn't belong to your shop\n\n**Integration Tips:**\n- Cache bundle data to reduce API calls for frequently accessed bundles\n- Use this endpoint to verify bundle existence before creating subscriptions\n- Combine with update endpoint for edit workflows (get \u2192 modify \u2192 update)\n- Check the `active` field to determine if the bundle is available to customers\n- Review `availableProducts` array to ensure product inventory availability\n\n**Performance Considerations:**\n- Response size varies based on number of products in the bundle\n- Bundles with extensive custom HTML or large product pools return more data\n- Consider requesting only necessary fields if partial data is sufficient\n- Use batch operations if retrieving multiple bundles\n\n**Authentication:** Requires valid X-API-Key header or api_key parameter (deprecated)",
        "operationId": "getSubscriptionBundling",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Complete Bundle Details": {
                    "description": "Complete Bundle Details",
                    "value": {
                      "active": true,
                      "allowOneTimePurchase": true,
                      "availableProducts": [
                        {
                          "available": true,
                          "imageUrl": "https://cdn.shopify.com/coffee-medium.jpg",
                          "price": "14.99",
                          "productId": 111111,
                          "title": "Medium Roast Coffee - 12oz",
                          "variantId": 222222
                        },
                        {
                          "available": true,
                          "imageUrl": "https://cdn.shopify.com/coffee-dark.jpg",
                          "price": "15.99",
                          "productId": 111111,
                          "title": "Dark Roast Coffee - 12oz",
                          "variantId": 333333
                        }
                      ],
                      "buildABoxType": "SINGLE_PRODUCT",
                      "buildBoxVersion": "V2",
                      "bundleHandle": "premium-coffee-selection",
                      "bundleName": "Premium Coffee Selection",
                      "chooseProductsText": "Build Your Perfect Coffee Box",
                      "createdAt": "2024-03-15T10:30:00Z",
                      "description": "Choose your favorite coffee blends for monthly delivery",
                      "discount": 10.0,
                      "discountType": "PERCENTAGE",
                      "frequencies": [
                        {
                          "displayName": "Monthly",
                          "interval": "MONTH",
                          "intervalCount": 1
                        },
                        {
                          "displayName": "Bi-Weekly",
                          "interval": "WEEK",
                          "intervalCount": 2
                        }
                      ],
                      "id": 45678,
                      "maxProductCount": 5,
                      "minOrderAmount": 25.0,
                      "minProductCount": 2,
                      "pricingType": "PER_PRODUCT",
                      "proceedToCheckoutButtonText": "Complete Your Subscription",
                      "productViewStyle": "GRID",
                      "shop": "example-shop.myshopify.com",
                      "thirdPartyRule": false,
                      "trackInventory": true,
                      "uniqueRef": "bab_abc123xyz",
                      "updatedAt": "2024-03-20T14:45:00Z"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionBundlingDTO"
                }
              }
            },
            "description": "Build-A-Box bundle successfully retrieved"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header or api_key parameter is required",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required - Missing or invalid API key"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "No Build-A-Box bundle found with ID 45678 for your shop",
                  "status": 404,
                  "title": "Bundle not found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Bundle not found or does not belong to your shop"
          },
          "500": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "An unexpected error occurred while retrieving the Build-A-Box bundle",
                  "status": 500,
                  "title": "Internal server error",
                  "type": "https://example.com/errors/internal-server-error"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Retrieve a Build-A-Box bundle by ID",
        "tags": [
          "Build-a-Box & Bundles"
        ]
      }
    },
    "/api/external/v2/bulk-automations/billing-interval": {
      "put": {
        "description": "Updates the billing interval configuration for subscription contracts in bulk.\n\n**Endpoint:**\n`PUT /api/external/v2/bulk-automations/billing-interval`\n\n**Authentication:**\n- API Key (query parameter: api_key)\n**Query Parameters:**\n- `api_key` (required) \u2013 Your API key\n- `intervalCount` (required) \u2013 Billing interval frequency (e.g. 1, 2, 3)\n- `interval` (required) \u2013 Billing interval type (DAY, WEEK, MONTH, YEAR)\n- `suppressEmailNotification` (optional) \u2013 Suppress email notification to customer (true/false)\n- `allSubscriptions` (optional) \u2013 Apply to all subscriptions for the shop (true/false)\n\n**Request Body:**\n```json\n{\n  \"subscriptionIds\": \"41982558492,41838280988\"\n}\n```\n\n**What This Endpoint Does:**\n- Updates the billing interval (frequency + interval type) for provided subscription contracts\n- Creates a bulk automation task\n- Processes updates asynchronously in the background using AWS Step Functions\n\n**How It Works:**\n1. Merchant provides billing interval details via query parameters\n2. Subscription IDs are provided as a comma-separated string in the request body (ignored if allSubscriptions=true)\n3. System validates shop ownership and ensures no bulk job is currently running\n4. Bulk automation job is created\n5. Billing interval is updated for each subscription asynchronously\n\n**Important Notes:**\n- Only one bulk automation per shop can run at a time\n- `interval` must match SellingPlanInterval enum values exactly (DAY, WEEK, MONTH, YEAR)\n- Processing is asynchronous\n- Previously generated orders are not modified\n- If `allSubscriptions=true`, provided subscriptionIds will be ignored\n- If `allSubscriptions=false`, subscriptionIds cannot be empty",
        "operationId": "bulkUpdateBillingInterval",
        "parameters": [
          {
            "description": "Your API Key",
            "in": "query",
            "name": "api_key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "intervalCount",
            "required": true,
            "schema": {
              "format": "int32",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "interval",
            "required": true,
            "schema": {
              "enum": [
                "DAY",
                "WEEK",
                "MONTH",
                "YEAR",
                "$UNKNOWN"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "suppressEmailNotification",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "allSubscriptions",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubscriptionContractIdsWrapper"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "content": {
              "application/json": {
                "example": {}
              }
            },
            "description": "Bulk billing interval update successfully queued and initiated."
          },
          "400": {
            "description": "Bad request - bulk operation already in progress or invalid parameters"
          },
          "401": {
            "description": "Authentication required"
          },
          "403": {
            "description": "Insufficient permissions"
          },
          "500": {
            "description": "Internal server error during bulk operation initialization"
          }
        },
        "summary": "Bulk update subscription billing interval",
        "tags": [
          "Operations & Settings"
        ]
      }
    },
    "/api/external/v2/bulk-automations/delivery-method": {
      "put": {
        "description": "Updates the delivery method configuration for subscription contracts in bulk.\n\n**Endpoint:**\n`PUT /api/external/v2/bulk-automations/delivery-method`\n\n**Authentication:**\n- API Key (query parameter: api_key)\n**Query Parameters:**\n- `api_key` (required) \u2013 Your API key\n- `deliveryMethodTitle` (required) \u2013 Delivery method title\n- `deliveryMethodCode` (required) \u2013 Delivery method code\n- `deliveryMethodPresentmentTitle` (required) \u2013 Customer-facing delivery method title\n- `deliveryMethodId` (required) \u2013 Shopify Delivery Method Definition GraphQL ID\n\n**Request Body:**\n```json\n{\n  \"subscriptionIds\": \"29879894300\"\n}\n```\n\n**What This Endpoint Does:**\n- Updates the delivery method details for the provided subscription contracts\n- Creates a bulk automation task\n- Processes updates asynchronously in the background\n\n**How It Works:**\n1. Merchant provides delivery method details via query parameters\n2. Subscription IDs are provided in request body\n3. System validates shop ownership and active status\n4. Bulk automation job is created\n5. Delivery method is updated for each subscription\n\n**Important Notes:**\n- Only one bulk automation per shop can run at a time\n- deliveryMethodId is optional. Omit it for a custom title/code edit that preserves each subscription's delivery price and enables its manual price override.\n- For a selected method, supply the full Shopify GraphQL ID returned by the shop delivery-options catalogue: DeliveryMethodDefinition or a Market option such as gid://shopify/DeliveryFlatRateOptionDefinition/123.\n- On market-driven shops, the server resolves the selected option's title once per job, then validates and applies a current eligible quote separately for each subscription. Missing or ambiguous quotes leave that subscription unchanged and record a job error.\n- Processing is asynchronous\n- Previous generated orders are not modified",
        "operationId": "updateDeliveryMethod_1",
        "parameters": [
          {
            "description": "Your API Key",
            "in": "query",
            "name": "api_key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "deliveryMethodTitle",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "deliveryMethodCode",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "deliveryMethodPresentmentTitle",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "deliveryMethodId",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "suppressEmailNotification",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "allSubscriptions",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubscriptionContractIdsWrapper"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "content": {
              "application/json": {
                "example": {}
              }
            },
            "description": "Bulk delivery method update successfully queued and initiated."
          },
          "400": {
            "description": "Bad request - bulk operation already in progress or invalid parameters"
          },
          "401": {
            "description": "Authentication required"
          },
          "403": {
            "description": "Insufficient permissions"
          },
          "500": {
            "description": "Internal server error during bulk operation initialization"
          }
        },
        "summary": "Bulk update subscription delivery method",
        "tags": [
          "Operations & Settings"
        ]
      }
    },
    "/api/external/v2/bulk-automations/delivery-price": {
      "put": {
        "description": "Updates the delivery price for subscription contracts in bulk.\n\n**Endpoint:**\n`PUT /api/external/v2/bulk-automations/delivery-price`\n\n**Authentication:**\n- API Key (query parameter: api_key)\n**Query Parameters:**\n- `api_key` (required) \u2013 Your API key\n- `deliveryPrice` (required) \u2013 New delivery price to be applied\n- `allSubscriptions` (optional) \u2013 Apply to all subscriptions for the shop (true/false)\n\n**Request Body:**\n```json\n{\n  \"subscriptionIds\": \"28191031580\"\n}\n```\n\n**What This Endpoint Does:**\n- Updates the delivery price for provided subscription contracts\n- Creates a bulk automation task\n- Processes updates asynchronously in the background using AWS Step Functions\n\n**How It Works:**\n1. Merchant provides new delivery price via query parameter\n2. Subscription IDs are provided as a comma-separated string in the request body (ignored if allSubscriptions=true)\n3. System validates shop ownership and ensures no bulk job is currently running\n4. Bulk automation job is created\n5. Delivery price is updated for each subscription asynchronously\n\n**Important Notes:**\n- Only one bulk automation per shop can run at a time\n- Processing is asynchronous\n- Previously generated orders are not modified\n- If `allSubscriptions=true`, provided subscriptionIds will be ignored\n- If `allSubscriptions=false`, subscriptionIds cannot be empty",
        "operationId": "updateDeliveryPrice_1",
        "parameters": [
          {
            "description": "Your API Key",
            "in": "query",
            "name": "api_key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "deliveryPrice",
            "required": true,
            "schema": {
              "format": "double",
              "type": "number"
            }
          },
          {
            "in": "query",
            "name": "suppressEmailNotification",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "allSubscriptions",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubscriptionContractIdsWrapper"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "content": {
              "application/json": {
                "example": {}
              }
            },
            "description": "Bulk delivery price update successfully queued and initiated."
          },
          "400": {
            "description": "Bad request - bulk operation already in progress or invalid parameters"
          },
          "401": {
            "description": "Authentication required"
          },
          "403": {
            "description": "Insufficient permissions"
          },
          "500": {
            "description": "Internal server error during bulk operation initialization"
          }
        },
        "summary": "Bulk update subscription delivery price",
        "tags": [
          "Operations & Settings"
        ]
      }
    },
    "/api/external/v2/bulk-automations/hide-subscriptions": {
      "post": {
        "description": "Hides subscription contracts in bulk. Hiding is destructive and permanent: each contract is cancelled in Shopify (unless it's already cancelled) and removed from Appstle. It no longer appears in the merchant portal or the customer portal, and it's never billed again.\n\n**What Hiding Does to Each Contract:**\n1. Cancels the contract in Shopify, unless it's already cancelled\n2. Saves the contract's previous status in the `appstle_hide_subscription_original_status` custom attribute on the Shopify contract\n3. Deletes the contract from Appstle, with its line items and its future queued and skipped billing attempts\n4. Updates the customer's tags and metafields\n\nThe cancelled contract stays in Shopify. Appstle ignores later Shopify updates to contracts that carry the hide attribute, so hidden contracts aren't imported again.\n\n**Not Reversible:**\nThere's no API or admin action to unhide a contract. Contact Appstle support if a hidden contract must be restored. To stop billing but keep the contract in Appstle, cancel it instead.\n\n**Operation Modes:**\n1. **Specific Subscriptions**: Pass the contract IDs in `subscriptionIds`\n2. **All Subscriptions**: Set allSubscriptions=true to hide every subscription contract in the store, whatever its status. `subscriptionIds` is ignored. Use with extreme caution.\n\n**Request Body Structure:**\n`subscriptionIds` is one string of comma-separated numeric contract IDs. Shopify GraphQL IDs (gid://shopify/SubscriptionContract/xxxxx) and JSON arrays are rejected.\n```json\n{\n  \"subscriptionIds\": \"123456,123457,123458\"\n}\n```\n\n**How It Works:**\n1. The request fails if a bulk hide is already running for your shop\n2. Every ID is checked. If any ID isn't a subscription contract in your shop, the whole request fails and nothing is hidden\n3. The request fails if bulk operations are locked for your shop\n4. The job is queued and the endpoint returns 204 No Content\n5. Contracts are hidden in the background. If one contract fails, the error is recorded and the job continues with the rest\n\nThere's no public endpoint for tracking the job's progress.\n\n**Error Scenarios (400):**\n- Another bulk hide is running: `Bulk request for current shop is already in progress`\n- An ID isn't a subscription contract in your shop: `Contract does not exist`\n- `subscriptionIds` is empty and allSubscriptions isn't true: `If All subs flag is false or empty, contractIds cannot be empty`\n- Bulk operations are locked for your shop: `Bulk operations is locked. Please contact support to unlock this feature for your store.`\n\n**Authentication:** Requires valid api_key parameter (X-API-Key header support coming soon)",
        "operationId": "hideSubscriptionsV2",
        "parameters": [
          {
            "description": "Your API Key",
            "in": "query",
            "name": "api_key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "allSubscriptions",
            "in": "query",
            "name": "allSubscriptions",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubscriptionContractIdsWrapper"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {}
                  }
                }
              }
            },
            "description": "Bulk hide operation successfully queued and initiated. Subscriptions will be hidden asynchronously."
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Bulk Operations Locked": {
                    "description": "Bulk Operations Locked",
                    "value": {
                      "detail": "Bulk operations is locked. Please contact support to unlock this feature for your store.",
                      "status": 400,
                      "title": "Bulk operations locked",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Contract Not Found": {
                    "description": "Contract Not Found",
                    "value": {
                      "detail": "Contract does not exist",
                      "status": 400,
                      "title": "Contract does not exist",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Operation Already Running": {
                    "description": "Operation Already Running",
                    "value": {
                      "detail": "UserGeneratedError: Bulk request for current shop is already in progress",
                      "entityName": "bulkAutomation",
                      "status": 400,
                      "title": "Bulk operation in progress",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Bad request - bulk operation already in progress or invalid parameters"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid api_key parameter is required",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required - Missing or invalid API key"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to hide subscriptions",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to perform bulk hide operations"
          },
          "500": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "An unexpected error occurred while initiating the bulk hide operation",
                  "status": 500,
                  "title": "Internal server error",
                  "type": "https://example.com/errors/internal-server-error"
                }
              }
            },
            "description": "Internal server error during bulk operation initialization"
          }
        },
        "summary": "Hide subscriptions in bulk",
        "tags": [
          "Operations & Settings"
        ]
      }
    },
    "/api/external/v2/bulk-automations/replace-product": {
      "post": {
        "description": "Replaces old product variants with new product variants across multiple subscription contracts in bulk. This powerful operation allows merchants to update products in active subscriptions when products are discontinued, reformulated, or repackaged.\n\n**What is Product Replacement?**\nProduct replacement updates the products in active subscriptions by swapping out old variant IDs with new variant IDs. This is commonly needed when:\n- Products are discontinued and replaced with new versions\n- Product packaging changes (size, quantity)\n- Product reformulations or recipe updates\n- SKU consolidation or reorganization\n- Seasonal product variations\n- Price structure changes\n\n**Key Features:**\n- **Bulk Operation**: Update thousands of subscriptions simultaneously\n- **Multi-Variant Support**: Replace multiple old variants with new ones in single request\n- **Flexible Mapping**: One-to-one, many-to-one, or one-to-many variant replacements\n- **Selective or Universal**: Target specific subscriptions or all subscriptions\n- **Asynchronous Processing**: Large batches processed in background\n- **Price Preservation Options**: Maintain existing subscription pricing or update to new prices\n- **Activity Logging**: All replacements are logged for audit trail\n\n**Operation Modes:**\n1. **Specific Subscriptions**: Provide subscription contract IDs to update only those subscriptions\n2. **All Subscriptions**: Set allSubscriptions=true to replace products in ALL active subscriptions containing the old variants\n\n**How It Works:**\n1. Identify old variant IDs that need to be replaced\n2. Identify new variant IDs that will replace them\n3. Optionally specify which subscriptions to update (or use allSubscriptions=true)\n4. Submit the bulk replacement request\n5. System validates all variant IDs exist and are accessible\n6. Bulk automation task is created and queued\n7. Each subscription is updated with new variants\n8. Customers receive updated subscription details\n9. Next orders will include the new products\n\n**Variant ID Mapping:**\nThe replacement supports flexible mapping between old and new variants:\n\n**One-to-One Replacement:**\n```json\n{\n  \"oldVariantIds\": [111111],\n  \"newVariantIds\": [222222]\n}\n```\nOld variant 111111 is replaced with new variant 222222\n\n**Multiple Variants Replacement:**\n```json\n{\n  \"oldVariantIds\": [111111, 333333, 555555],\n  \"newVariantIds\": [222222, 444444, 666666]\n}\n```\nEach old variant is replaced with its corresponding new variant (by position)\n\n**Request Structure:**\n```json\n{\n  \"subscriptionIds\": \"123456,123457\"\n}\n```\n\n**Query Parameters:**\n- `api_key` (required): Your API authentication key\n- `allSubscriptions` (optional): Set to true to update all subscriptions, false/omit to update only specified IDs\n- `newVariantIds` (required): Comma-separated list of new variant IDs (e.g., 222222,444444,666666)\n- `oldVariantIds` (required): Comma-separated list of old variant IDs to replace (e.g., 111111,333333,555555)\n\n**Use Cases:**\n\n**1. Product Discontinuation:**\nWhen a product is being discontinued:\n- Identify replacement product\n- Map old variant IDs to new variant IDs\n- Update all subscriptions containing the old product\n- Notify customers of the change\n\n**2. Packaging Updates:**\nWhen product packaging changes (e.g., 10oz to 12oz):\n- Create new variant for new package size\n- Replace old variant across subscriptions\n- Adjust pricing if needed\n\n**3. Product Reformulation:**\nWhen product recipes or formulas change:\n- Create new product variant for reformulated version\n- Bulk replace old formula with new formula\n- Maintain customer subscription frequency and pricing\n\n**4. SKU Consolidation:**\nWhen consolidating multiple variants into a single SKU:\n- Map multiple old variant IDs to single new variant ID\n- Update all affected subscriptions\n- Simplify inventory management\n\n**5. Seasonal Product Rotation:**\nFor seasonal subscription boxes:\n- Replace summer variants with fall variants\n- Update all active seasonal subscriptions\n- Maintain subscription continuity\n\n**Important Considerations:**\n- **Pricing Impact**: New variants may have different prices - verify pricing strategy\n- **Inventory Levels**: Ensure adequate inventory for new variants\n- **Customer Communication**: Consider notifying customers before replacement\n- **Variant Compatibility**: New variants should be appropriate replacements\n- **One Operation at a Time**: Only one bulk operation can run per shop simultaneously\n- **Irreversible**: Product replacements cannot be automatically undone (must be manually reversed)\n- **Subscription Contract IDs**: Pass numeric contract IDs as one comma-separated string, not Shopify GraphQL IDs\n\n**Processing Time:**\n- Small batches (<100 subscriptions): Seconds to minutes\n- Medium batches (100-1000): Minutes\n- Large batches (>1000): Minutes to hours\n- Processing time depends on number of subscriptions and line items\n\n**Best Practices:**\n1. **Test First**: Test with a small subset of subscriptions before bulk operation\n2. **Verify Variants**: Confirm all variant IDs are correct and products are active\n3. **Check Inventory**: Ensure sufficient stock of new variants\n4. **Customer Communication**: Notify affected customers about product changes\n5. **Price Review**: Review and confirm pricing for new variants\n6. **Backup Data**: Export subscription data before making bulk changes\n7. **Monitor Progress**: Track bulk operation status to completion\n8. **Audit Trail**: Document reason for replacement for future reference\n\n**Error Scenarios:**\n- Another bulk operation running: 400 error\n- Invalid variant IDs: Operation may fail or skip invalid variants\n- Mismatched array lengths: Ensure oldVariantIds and newVariantIds have same count\n- Product not found: Variants must exist in your Shopify store\n- Unauthorized access: Can only modify subscriptions belonging to your shop\n\n**Customer Impact:**\n- Next subscription order will contain new products\n- Previous orders are not affected\n- Subscription price may change if new variant has different price\n- Customer portal reflects the new product immediately\n- Subscription frequency and schedule remain unchanged\n\n**Authentication:** Requires valid api_key parameter (X-API-Key header support coming soon)",
        "operationId": "replaceProductV2",
        "parameters": [
          {
            "description": "Your API Key",
            "in": "query",
            "name": "api_key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "allSubscriptions",
            "in": "query",
            "name": "allSubscriptions",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "description": "New Variant Ids",
            "in": "query",
            "name": "newVariantIds",
            "required": true,
            "schema": {
              "items": {
                "format": "int64",
                "type": "integer"
              },
              "type": "array"
            }
          },
          {
            "description": "Old Variant Ids",
            "in": "query",
            "name": "oldVariantIds",
            "required": true,
            "schema": {
              "items": {
                "format": "int64",
                "type": "integer"
              },
              "type": "array"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubscriptionContractIdsWrapper"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {}
                  }
                }
              }
            },
            "description": "Bulk product replacement operation successfully queued and initiated. Subscriptions will be updated asynchronously."
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Mismatched Variant Arrays": {
                    "description": "Mismatched Variant Arrays",
                    "value": {
                      "detail": "oldVariantIds and newVariantIds must have the same number of elements",
                      "status": 400,
                      "title": "Invalid variant mapping",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Missing Variant IDs": {
                    "description": "Missing Variant IDs",
                    "value": {
                      "detail": "Both oldVariantIds and newVariantIds parameters are required",
                      "status": 400,
                      "title": "Missing required parameters",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Operation Already Running": {
                    "description": "Operation Already Running",
                    "value": {
                      "detail": "UserGeneratedError: Bulk request for current shop is already in progress",
                      "entityName": "bulkAutomation",
                      "status": 400,
                      "title": "Bulk operation in progress",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Bad request - bulk operation already in progress, invalid parameters, or missing required fields"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid api_key parameter is required",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required - Missing or invalid API key"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to modify subscription products",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to perform bulk product replacement"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "One or more specified variant IDs do not exist in your store",
                  "status": 404,
                  "title": "Variant not found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "One or more variant IDs not found"
          },
          "422": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "New variant is not compatible with subscription configuration",
                  "status": 422,
                  "title": "Invalid variant replacement",
                  "type": "https://example.com/errors/unprocessable-entity"
                }
              }
            },
            "description": "Unprocessable entity - Invalid variant IDs or business logic validation failure"
          },
          "500": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "An unexpected error occurred while initiating the bulk replacement operation",
                  "status": 500,
                  "title": "Internal server error",
                  "type": "https://example.com/errors/internal-server-error"
                }
              }
            },
            "description": "Internal server error during bulk operation initialization"
          }
        },
        "summary": "Replace products in subscriptions in bulk",
        "tags": [
          "Operations & Settings"
        ]
      }
    },
    "/api/external/v2/cancellation-managements/{id}": {
      "get": {
        "description": "Retrieves the cancellation management and retention settings for the authenticated shop. These settings control the subscription cancellation flow, retention strategies, and customer feedback collection when subscribers attempt to cancel their subscriptions.\n\n**What is Cancellation Management?**\nCancellation management is a retention system that helps merchants reduce subscription churn by understanding why customers cancel and offering alternatives before they leave. It includes cancellation flows, feedback collection, retention offers (discounts, pauses, frequency changes), and automated win-back strategies.\n\n**Configuration Components:**\n\n**1. Cancellation Flow Settings:**\n- Enable/disable self-service cancellation in customer portal\n- Require customer to contact support for cancellation\n- Multi-step cancellation confirmation process\n- Cancellation cooldown period (prevent accidental cancellations)\n- Minimum subscription duration before cancellation allowed\n- Immediate vs. end-of-billing-cycle cancellation\n\n**2. Cancellation Reasons & Feedback:**\n- Predefined cancellation reasons list\n- Custom cancellation reason options\n- Required vs. optional feedback\n- Free-form text feedback field\n- Rating/satisfaction scale\n- Exit survey questions\n- Feedback sent to merchant email/dashboard\n\n**Common Cancellation Reasons:**\n- Too expensive / Can't afford\n- Don't use product enough / Have too much inventory\n- Product quality issues\n- Switching to competitor\n- Delivery issues / Shipping problems\n- Forgot to cancel earlier\n- Temporary pause needed (moving, travel, etc.)\n- Product doesn't meet expectations\n- Customer service issues\n- Other (with text field)\n\n**3. Retention Offers (Save Flow):**\n- Display retention offers before final cancellation\n- Offer discount (percentage or fixed amount)\n- Offer free product/gift with next order\n- Suggest subscription pause instead of cancel\n- Suggest frequency change (deliver less often)\n- Offer to skip next order\n- Offer to swap products\n- Personalized offers based on cancellation reason\n\n**Example Retention Logic:**\n```\nReason: \"Too expensive\"\n  \u2192 Offer: 20% discount for next 3 months\n  \u2192 Offer: Switch to smaller/cheaper variant\n\nReason: \"Have too much inventory\"\n  \u2192 Offer: Pause for 1-3 months\n  \u2192 Offer: Change from monthly to every 2 months\n  \u2192 Offer: Skip next 2 deliveries\n\nReason: \"Product quality issues\"\n  \u2192 Offer: Free replacement on next order\n  \u2192 Offer: Try different product variant\n  \u2192 Route to customer support\n```\n\n**4. UI/UX Configuration:**\n- Cancellation button placement and styling\n- Warning messages and modal dialogs\n- Progress indicator for multi-step flow\n- Retention offer presentation (modal, inline, etc.)\n- Confirmation messages\n- Post-cancellation survey\n\n**5. Automation & Notifications:**\n- Send cancellation confirmation email\n- Notify merchant of cancellations\n- Trigger win-back email campaigns\n- Schedule feedback review\n- Alert for high cancellation rate\n- Integration with CRM/analytics tools\n\n**6. Metrics & Analytics:**\n- Track cancellation rate\n- Categorize cancellation reasons\n- Measure retention offer acceptance rate\n- Calculate customer lifetime value at cancellation\n- Identify churn patterns and trends\n- A/B test different retention strategies\n\n**7. Advanced Features:**\n- Conditional retention offers based on:\n  - Customer lifetime value\n  - Subscription duration\n  - Product type\n  - Cancellation history\n  - Customer segment\n- Win-back campaigns for cancelled subscribers\n- Automatic re-engagement emails (30, 60, 90 days post-cancel)\n- Special offers to reactivate cancelled subscriptions\n\n**Cancellation Flow Examples:**\n\n**Basic Flow (No Retention):**\n1. Customer clicks \"Cancel Subscription\"\n2. Confirmation dialog: \"Are you sure?\"\n3. Optional: Select cancellation reason\n4. Subscription cancelled immediately or at period end\n5. Confirmation email sent\n\n**Advanced Retention Flow:**\n1. Customer clicks \"Cancel Subscription\"\n2. \"Before you go...\" - Select cancellation reason\n3. Display personalized retention offer based on reason\n4. Customer chooses: Accept offer OR Continue to cancel\n5. If continue: Additional offers or final confirmation\n6. If still cancelling: Exit survey\n7. Cancellation processed\n8. Thank you message + feedback confirmation\n9. Follow-up email campaign\n\n**Use Cases:**\n- Configure cancellation flow in customer portal\n- Customize retention offers and messaging\n- Analyze cancellation patterns and trends\n- Build custom cancellation interfaces\n- Integrate with customer support tools\n- Generate churn reports and analytics\n- A/B test different retention strategies\n- Automate win-back campaigns\n\n**Important Notes:**\n- Always comply with consumer protection laws regarding cancellation\n- Make cancellation process clear and accessible (FTC guidelines)\n- Don't make cancellation unnecessarily difficult\n- Respect customer's decision to cancel\n- Use retention offers ethically (not dark patterns)\n- Store cancellation feedback for product improvement\n- GDPR/privacy compliance for feedback data\n\n**Best Practices:**\n- Keep cancellation process simple (2-3 steps max)\n- Offer genuine value in retention offers\n- Personalize offers based on cancellation reason\n- Make pause/skip options prominent\n- Use cancellation feedback to improve product/service\n- Set up automated win-back campaigns\n- Monitor cancellation rate and take action on trends\n- Train customer support on retention strategies\n- Test different retention messaging and offers\n- Honor cancellations promptly and professionally\n\n**Legal & Compliance:**\n- FTC regulations require easy cancellation (Click-to-Cancel rule)\n- California automatic renewal law compliance\n- European consumer protection directives\n- Clear disclosure of cancellation terms\n- Process cancellations within legal timeframes\n- Provide confirmation of cancellation\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "getCancellationManagementV2",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "languageCode",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "allowCustomReason": true,
                      "allowSelfServiceCancellation": true,
                      "analytics": {
                        "alertOnHighChurnRate": true,
                        "churnRateThreshold": 15.0,
                        "trackCancellationRate": true,
                        "trackReasonFrequency": true,
                        "trackRetentionOfferAcceptance": true
                      },
                      "cancellationReasons": [
                        "Too expensive",
                        "Have too much product",
                        "Product quality issues",
                        "Switching to competitor",
                        "Delivery problems",
                        "Don't need anymore",
                        "Temporary situation (moving, travel, etc.)",
                        "Other"
                      ],
                      "cancellationTiming": "END_OF_BILLING_CYCLE",
                      "collectFeedback": true,
                      "confirmationFlow": {
                        "cooldownPeriod": 24,
                        "multiStep": true,
                        "requireConfirmation": true,
                        "showAlternatives": true
                      },
                      "createdAt": "2024-01-15T10:30:00Z",
                      "enabled": true,
                      "feedbackRequired": false,
                      "id": 12345,
                      "minimumSubscriptionDays": 30,
                      "notifications": {
                        "enableCampaigns": true,
                        "merchantEmail": "subscriptions@example.com",
                        "sendCustomerConfirmation": true,
                        "sendMerchantNotification": true,
                        "winBackSchedule": [
                          30,
                          60,
                          90
                        ]
                      },
                      "requireCancellationReason": true,
                      "requireSupportContact": false,
                      "retentionOffersEnabled": true,
                      "retentionStrategies": {
                        "Have too much product": [
                          {
                            "description": "Pause for up to 3 months",
                            "maxDuration": 90,
                            "type": "PAUSE"
                          },
                          {
                            "description": "Skip your next 2 deliveries",
                            "skipCount": 2,
                            "type": "SKIP"
                          },
                          {
                            "description": "Switch to every 2 months",
                            "type": "FREQUENCY_CHANGE"
                          }
                        ],
                        "Product quality issues": [
                          {
                            "description": "Let us make it right - contact support",
                            "type": "SUPPORT_CONTACT"
                          },
                          {
                            "description": "Try a different product",
                            "type": "PRODUCT_SWAP"
                          }
                        ],
                        "Too expensive": [
                          {
                            "description": "20% off for 3 months",
                            "duration": 3,
                            "type": "DISCOUNT",
                            "value": "20"
                          },
                          {
                            "description": "Deliver less often to save money",
                            "type": "FREQUENCY_CHANGE"
                          }
                        ]
                      },
                      "shop": "example-shop.myshopify.com",
                      "showExitSurvey": true,
                      "uiSettings": {
                        "buttonColor": "#DC3545",
                        "buttonText": "Cancel Subscription",
                        "confirmationMessage": "Your subscription has been cancelled. You will receive a confirmation email shortly.",
                        "thankYouMessage": "Thank you for being a subscriber. We hope to see you again!",
                        "warningMessage": "We'll be sorry to see you go! Before you cancel, let us try to help."
                      },
                      "updatedAt": "2024-02-20T14:45:00Z"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/CancellationManagementDTO"
                }
              }
            },
            "description": "Cancellation management configuration successfully retrieved"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header is required",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to view cancellation management settings",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to view cancellation management settings"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Cancellation management has not been configured for this shop",
                  "status": 404,
                  "title": "Configuration not found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Cancellation management configuration not found"
          }
        },
        "summary": "Get cancellation management configuration",
        "tags": [
          "Operations & Settings",
          "Customer Retention"
        ]
      }
    },
    "/api/external/v2/contract-raw-response": {
      "get": {
        "description": "Fetches the complete, unprocessed JSON response directly from Shopify's GraphQL API for the specified subscription contract. This endpoint returns the full subscription data structure as provided by Shopify, including all nested objects and relationships.\n\n**Use Cases:**\n- Debugging subscription issues\n- Accessing all available subscription data\n- Understanding the complete data structure\n- Building custom integrations\n\n**Response Structure:**\nThe response includes complete details about:\n- Customer information (email, name, ID)\n- Line items (products, quantities, pricing)\n- Billing and delivery policies\n- Payment method details\n- Discounts and pricing policies\n- Order history and billing attempts\n- Custom attributes and notes\n\n**Note:** This is a direct Shopify response with GraphQL type information (__typename fields)\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "getContractRawResponse",
        "parameters": [
          {
            "deprecated": true,
            "description": "API Key (Deprecated - Use X-API-Key header instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key for authentication",
            "example": "apst_your-api-key-here",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "The unique identifier of the subscription contract. Use the numeric ID without the 'gid://shopify/SubscriptionContract/' prefix. For example, use '26833420451' instead of 'gid://shopify/SubscriptionContract/26833420451'.",
            "example": 26833420451,
            "in": "query",
            "name": "contractId",
            "required": true,
            "schema": {
              "format": "int64",
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Complete Subscription Contract Response": {
                    "description": "Complete Subscription Contract Response",
                    "value": {
                      "subscriptionContract": {
                        "__typename": "SubscriptionContract",
                        "billingPolicy": {
                          "__typename": "SubscriptionBillingPolicy",
                          "anchors": [],
                          "interval": "MONTH",
                          "intervalCount": 1,
                          "maxCycles": null,
                          "minCycles": null
                        },
                        "createdAt": "2025-06-19T12:19:21Z",
                        "customAttributes": [],
                        "customer": {
                          "__typename": "Customer",
                          "displayName": "John Doe",
                          "email": "customer@example.com",
                          "firstName": "John",
                          "id": "gid://shopify/Customer/8718823227555",
                          "lastName": "Doe"
                        },
                        "customerPaymentMethod": {
                          "__typename": "CustomerPaymentMethod",
                          "id": "gid://shopify/CustomerPaymentMethod/e14bcaa08f882975bfe6c708642eb223",
                          "instrument": {
                            "__typename": "CustomerCreditCard",
                            "brand": "bogus",
                            "expiryMonth": 12,
                            "expiryYear": 2025,
                            "lastDigits": "1",
                            "maskedNumber": "\u2022\u2022\u2022\u2022 \u2022\u2022\u2022\u2022 \u2022\u2022\u2022\u2022 1"
                          }
                        },
                        "deliveryPolicy": {
                          "__typename": "SubscriptionDeliveryPolicy",
                          "anchors": [],
                          "interval": "MONTH",
                          "intervalCount": 1
                        },
                        "deliveryPrice": {
                          "__typename": "MoneyV2",
                          "amount": "0.0",
                          "currencyCode": "USD"
                        },
                        "discounts": {
                          "__typename": "SubscriptionManualDiscountConnection",
                          "edges": []
                        },
                        "id": "gid://shopify/SubscriptionContract/26833420451",
                        "lastPaymentStatus": null,
                        "lines": {
                          "__typename": "SubscriptionLineConnection",
                          "edges": [
                            {
                              "__typename": "SubscriptionLineEdge",
                              "node": {
                                "__typename": "SubscriptionLine",
                                "currentPrice": {
                                  "__typename": "MoneyV2",
                                  "amount": "9.0",
                                  "currencyCode": "USD"
                                },
                                "customAttributes": [],
                                "id": "gid://shopify/SubscriptionLine/35d6970f-66bd-4ce0-a7a5-f1498096fec8",
                                "pricingPolicy": {
                                  "__typename": "SubscriptionPricingPolicy",
                                  "basePrice": {
                                    "__typename": "MoneyV2",
                                    "amount": "10.0",
                                    "currencyCode": "USD"
                                  },
                                  "cycleDiscounts": [
                                    {
                                      "__typename": "SubscriptionCyclePriceAdjustment",
                                      "adjustmentType": "PERCENTAGE",
                                      "adjustmentValue": {
                                        "__typename": "SellingPlanPricingPolicyPercentageValue",
                                        "percentage": 10.0
                                      },
                                      "afterCycle": 0,
                                      "computedPrice": {
                                        "__typename": "MoneyV2",
                                        "amount": "9.0",
                                        "currencyCode": "USD"
                                      }
                                    }
                                  ]
                                },
                                "productId": "gid://shopify/Product/8794161545379",
                                "quantity": 1,
                                "sellingPlanId": "gid://shopify/SellingPlan/2598666403",
                                "sellingPlanName": "Monthly Subscription",
                                "title": "Gift Card",
                                "variantId": "gid://shopify/ProductVariant/45954331672739",
                                "variantTitle": "$10"
                              }
                            }
                          ]
                        },
                        "nextBillingDate": "2025-07-19T12:00:00Z",
                        "note": null,
                        "originOrder": {
                          "__typename": "Order",
                          "id": "gid://shopify/Order/6152668807331",
                          "name": "#1002"
                        },
                        "status": "ACTIVE",
                        "updatedAt": "2025-06-19T12:19:25Z"
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Data"
                }
              }
            },
            "description": "Successfully retrieved raw contract data"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Invalid Contract ID Format": {
                    "description": "Invalid Contract ID Format",
                    "value": {
                      "detail": "contractId must be a numeric value",
                      "instance": "/api/external/v2/contract-raw-response",
                      "status": 400,
                      "title": "Invalid contractId format",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Missing Contract ID": {
                    "description": "Missing Contract ID",
                    "value": {
                      "detail": "contractId parameter is required",
                      "instance": "/api/external/v2/contract-raw-response",
                      "status": 400,
                      "title": "Missing required parameter",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid request parameters"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header is required",
                  "instance": "/api/external/v2/contract-raw-response",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "You do not have permission to access this subscription contract",
                  "instance": "/api/external/v2/contract-raw-response",
                  "status": 403,
                  "title": "Access denied",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to access the subscription contract"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "No subscription contract found with ID: 123456789",
                  "instance": "/api/external/v2/contract-raw-response",
                  "status": 404,
                  "title": "Contract does not exist",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Subscription contract not found"
          }
        },
        "summary": "Retrieve raw Shopify GraphQL response for a subscription contract",
        "tags": [
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/customer-portal-settings/{id}": {
      "get": {
        "description": "Retrieves the customer portal configuration and settings for the authenticated shop. The customer portal is the self-service interface where subscribers can manage their subscriptions, update payment methods, modify delivery addresses, and more.\n\n**What is the Customer Portal?**\nThe customer portal is a dedicated web interface that allows your subscribers to manage their subscription accounts independently. This reduces support burden and improves customer experience by enabling self-service subscription management.\n\n**Settings Returned:**\n- **Display Configuration**:\n  - Portal theme and branding settings\n  - Custom colors and logo\n  - Layout preferences\n  - Custom CSS selectors\n\n- **Feature Toggles**:\n  - Enable/disable subscription pausing\n  - Enable/disable order skipping\n  - Enable/disable product swapping\n  - Enable/disable frequency changes\n  - Enable/disable quantity modifications\n  - Enable/disable address editing\n  - Enable/disable payment method updates\n  - Enable/disable subscription cancellation\n\n- **Subscription Management Options**:\n  - Maximum pause duration allowed\n  - Minimum subscription duration requirements\n  - Skip limits per billing cycle\n  - Product swap availability\n  - One-time product add-ons\n\n- **Communication Settings**:\n  - Email notification preferences\n  - Custom portal messaging\n  - Support contact information\n  - Help text and instructions\n\n- **Access Control**:\n  - Portal authentication method\n  - Password requirements\n  - Magic link settings\n  - Session duration\n\n- **Advanced Options**:\n  - Custom domain configuration\n  - Redirect URLs\n  - Webhook endpoints\n  - Analytics tracking settings\n\n**Use Cases:**\n- Display customer portal with correct branding and theme\n- Determine which features are available to subscribers\n- Build custom portal interfaces using your settings\n- Sync portal configuration across systems\n- Validate subscription management capabilities\n- Configure third-party integrations\n\n**Important Notes:**\n- Settings are shop-specific and unique per merchant\n- Some features may be restricted based on subscription plan\n- Changes to settings are reflected immediately in the portal\n- Custom CSS must be valid and secure\n- Portal URL is typically: shop-domain.com/apps/subscriptions\n\n**Common Configuration Scenarios:**\n\n**1. Standard Self-Service Portal:**\n- Allow pausing (up to 3 months)\n- Allow skipping (max 2 consecutive orders)\n- Allow frequency changes\n- Allow quantity updates\n- Allow address editing\n- Enable payment method updates\n- Enable cancellation with feedback\n\n**2. Locked-Down Portal (Minimal Self-Service):**\n- Disable pausing\n- Disable skipping\n- Disable cancellation (require support contact)\n- Allow address editing only\n- Allow payment method updates only\n\n**3. Full-Service Portal (Maximum Flexibility):**\n- Enable all subscription management features\n- Allow unlimited pauses and skips\n- Enable product swapping\n- Enable one-time add-ons\n- Allow subscription splitting/merging\n- Custom branding and domain\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "getCustomerPortalSettingsV2",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "allowAddressEdit": true,
                      "allowCancellation": true,
                      "allowFrequencyChange": true,
                      "allowPause": true,
                      "allowPaymentMethodUpdate": true,
                      "allowProductSwap": true,
                      "allowQuantityChange": true,
                      "allowSkip": true,
                      "authentication": {
                        "method": "MAGIC_LINK",
                        "requireEmailVerification": true,
                        "sessionDuration": 3600
                      },
                      "createdAt": "2024-01-15T10:30:00Z",
                      "customDomain": "subscriptions.example.com",
                      "enableOneTimeProducts": true,
                      "id": 12345,
                      "maxConsecutiveSkips": 2,
                      "maxPauseDuration": 90,
                      "minimumSubscriptionCycles": 3,
                      "notifications": {
                        "sendCancellationConfirmation": true,
                        "sendFrequencyChangeConfirmation": true,
                        "sendPauseConfirmation": true,
                        "sendSkipConfirmation": true
                      },
                      "portalEnabled": true,
                      "requireCancellationReason": true,
                      "shop": "example-shop.myshopify.com",
                      "supportContact": {
                        "chatEnabled": true,
                        "email": "support@example.com",
                        "phone": "+1-800-123-4567"
                      },
                      "theme": {
                        "accentColor": "#F5A623",
                        "customCss": ".subscription-card { border-radius: 8px; }",
                        "fontFamily": "'Helvetica Neue', Arial, sans-serif",
                        "logoUrl": "https://cdn.shopify.com/s/files/1/0000/0000/files/logo.png",
                        "primaryColor": "#4A90E2",
                        "secondaryColor": "#50E3C2"
                      },
                      "updatedAt": "2024-02-20T14:45:00Z"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/CustomerPortalSettingsDTO"
                }
              }
            },
            "description": "Customer portal settings successfully retrieved"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header is required",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to view portal settings",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to view customer portal settings"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Customer portal settings have not been configured for this shop",
                  "status": 404,
                  "title": "Settings not found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Customer portal settings not found - Settings may not be initialized yet"
          }
        },
        "summary": "Get customer portal settings",
        "tags": [
          "Customization",
          "Customer Portal"
        ]
      }
    },
    "/api/external/v2/customer-portal-token": {
      "get": {
        "description": "Generates a secure, time-limited authentication token that grants access to the customer portal. Supports lookup by either Shopify customer ID or customer email address, making it flexible for various integration patterns.\n\n**What This Endpoint Returns:**\nAn encrypted JWT-like token that authenticates a customer for the subscription management portal, along with token metadata. Unlike the manage-subscription-link endpoint which returns a complete URL, this returns only the token itself.\n\n**Response Components:**\n\n**token (string):**\n- Encrypted authentication token\n- JWT-style format with cryptographic signature\n- Contains customer ID and shop information\n- Valid for 2 hours from generation\n- Cannot be forged or tampered with\n\n**customerId (long):**\n- Shopify customer ID (numeric)\n- Useful for verification\n- Same ID used to generate token\n\n**Customer Lookup Methods:**\n\n**Option 1: By Customer ID (Recommended)**\n```\nGET /api/external/v2/customer-portal-token?customerId=12345\n```\n- Direct lookup by numeric Shopify customer ID\n- Can use GraphQL GID format (automatically parsed)\n- Fastest and most reliable\n- No ambiguity\n\n**Option 2: By Email Address**\n```\nGET /api/external/v2/customer-portal-token?email=customer@example.com\n```\n- Searches subscription database for matching email\n- Finds associated customer ID automatically\n- Useful when customer ID unknown\n- Fails if email not found or invalid\n\n**Parameter Validation:**\n- Exactly ONE of `customerId` or `email` must be provided\n- Providing neither: Returns 400 error\n- Providing both: customerId takes precedence\n- Email must exist in subscription database\n\n**Token Security:**\n\n**Encryption:**\n- Uses HMAC-SHA256 cryptographic signing\n- Secret key stored securely on server\n- Token includes tamper detection\n- Modification invalidates token\n\n**Expiration:**\n- Tokens expire exactly 2 hours after generation\n- Timestamp embedded in token payload\n- Verified on each use\n- Cannot be extended\n\n**Scope:**\n- Token tied to specific customer\n- Token tied to specific shop\n- Cannot be used for other customers\n- Cannot be used across shops\n\n**Use Cases:**\n\n**1. Custom Portal Implementations:**\n- Build custom authentication flows\n- Integrate portal into existing apps\n- Create native mobile app authentication\n- Headless commerce integrations\n\n**2. API-First Architectures:**\n- Generate tokens programmatically\n- Pass tokens to frontend applications\n- Build microservice authentication\n- Separate auth from presentation\n\n**3. Single Sign-On (SSO):**\n- Authenticate users from existing system\n- Bypass password entry\n- Seamless portal access\n- Cross-platform authentication\n\n**4. Email/SMS Campaigns:**\n- Generate tokens for magic links\n- Embed in notification emails\n- Include in SMS messages\n- Create passwordless login links\n\n**5. Customer Support Tools:**\n- Generate portal access for support agents\n- View customer's portal perspective\n- Troubleshoot portal issues\n- Assist customers remotely\n\n**Response Format:**\n```json\n{\n  \"customerId\": 12345,\n  \"token\": \"eyJhbGciOiJIUzI1NiJ9.eyJjdXN0b21lcklkIjoxMjM0NSwic2hvcCI6Im15c3RvcmUubXlzaG9waWZ5LmNvbSIsInRpbWVzdGFtcCI6MTcwOTU2MjAwMH0.abc123xyz789\"\n}\n```\n\n**Using the Token:**\n\n**Append to Portal URL:**\n```javascript\nconst { token } = await getCustomerPortalToken(customerId);\nconst portalUrl = `https://mystore.com/tools/recurring/customer_portal?token=${token}`;\nwindow.location.href = portalUrl;\n```\n\n**Store in Session:**\n```javascript\n// Store for authenticated API calls\nsessionStorage.setItem('portalToken', response.token);\nsessionStorage.setItem('customerId', response.customerId);\n\n// Use in subsequent requests\nfetch('/api/subscription-data', {\n  headers: { 'Authorization': `Bearer ${sessionStorage.getItem('portalToken')}` }\n});\n```\n\n**Mobile App Authentication:**\n```javascript\n// Generate token server-side\nconst tokenData = await generateToken(email);\n\n// Send to mobile app\nreturn {\n  authToken: tokenData.token,\n  customerId: tokenData.customerId,\n  expiresIn: 7200 // 2 hours in seconds\n};\n```\n\n**Important Considerations:**\n\n**Token vs. Full URL:**\n- This endpoint: Returns token only\n- `/manage-subscription-link` endpoint: Returns complete URL\n- Use this for custom implementations\n- Use manage-subscription-link for simple email links\n\n**Email Lookup Limitations:**\n- Email must exist in subscription database\n- Searches only customers with subscriptions\n- Won't find customers without subscriptions\n- Case-sensitive in some databases\n\n**Customer ID Formats:**\n- Accepts numeric ID: `12345`\n- Accepts GraphQL GID: `gid://shopify/Customer/12345`\n- Automatically extracts numeric portion\n- Always stores numeric format\n\n**Best Practices:**\n\n1. **Generate On-Demand**: Create tokens when needed, not in advance\n2. **Don't Store Long-Term**: Tokens expire in 2 hours\n3. **Use HTTPS**: Always transmit tokens over secure connections\n4. **Validate Expiry**: Check token age on frontend\n5. **Prefer Customer ID**: Use customerId lookup when available\n6. **Handle Errors**: Gracefully handle missing customers\n\n**Security Notes:**\n- Treat tokens like passwords\n- Don't log tokens in plain text\n- Don't expose in URLs if possible (use POST bodies)\n- Rotate tokens frequently\n- Monitor for suspicious token generation patterns\n\n**Comparison with Other Endpoints:**\n\n**vs. /manage-subscription-link:**\n- This: Token only\n- That: Complete URL\n- Use this for APIs, that for emails\n\n**vs. /subscription-contracts-email-magic-link:**\n- This: Returns token\n- That: Sends email\n- Use this for programmatic access, that for customer notifications\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "getCustomerPortalToken",
        "parameters": [
          {
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Customer ID",
            "in": "query",
            "name": "customerId",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Customer email",
            "in": "query",
            "name": "email",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Token Response": {
                    "description": "Token Response",
                    "value": {
                      "customerId": 12345,
                      "token": "eyJhbGciOiJIUzI1NiJ9.eyJjdXN0b21lcklkIjoxMjM0NSwic2hvcCI6Im15c3RvcmUubXlzaG9waWZ5LmNvbSIsInRpbWVzdGFtcCI6MTcwOTU2MjAwMH0.abc123xyz789"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/CustomerTokenInfo"
                }
              }
            },
            "description": "Successfully generated customer portal token"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Customer Not Found": {
                    "description": "Customer Not Found",
                    "value": {
                      "detail": "Customer Id or Email does not exist",
                      "status": 400,
                      "title": "Customer not found",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Missing Parameters": {
                    "description": "Missing Parameters",
                    "value": {
                      "detail": "Customer Id or Email does not exist",
                      "status": 400,
                      "title": "Missing required parameter",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Bad request - Missing parameters or invalid customer"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header is required",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Customer does not belong to your shop",
                  "status": 403,
                  "title": "Access denied",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Forbidden - Customer does not belong to authenticated shop"
          }
        },
        "summary": "Generate customer portal authentication token",
        "tags": [
          "Subscription Contracts",
          "Customer Portal"
        ]
      }
    },
    "/api/external/v2/customer-retention-activities": {
      "get": {
        "description": "Retrieves a paginated, filterable list of customer retention activities for the authenticated shop. A retention activity is recorded whenever a customer goes through the cancellation or pause flow and either accepts a retention offer (discount, pause, frequency change, product swap, etc.) or proceeds to cancel/pause, along with the reason they selected.\n\n**What is a Retention Activity?**\nEvery time a subscriber interacts with the cancellation/pause save-flow, an activity record is created capturing the contract, the action taken (e.g. offer shown, offer accepted, cancelled, paused), the event source (CANCELLATION or PAUSE), the selected reason, any discount applied, and the resulting status.\n\n**First offer vs fallback offer:**\nWhen the selected cancellation reason has a fallback offer, an accepted offer's `additionalInfo` JSON carries `offerTier`: `PRIMARY` if the customer accepted the first offer, `FALLBACK` if they declined it and accepted the fallback. It is absent for reasons without a fallback offer, for declines, and for activities recorded before this field was introduced.\n\n**Filtering:**\n- `contractId` - restrict results to a single subscription contract\n- `eventSource` - `CANCELLATION` or `PAUSE`\n- `status` - status of the retention activity (e.g. PENDING, COMPLETED)\n- `retentionAction` - the action recorded (e.g. offer type accepted or DECLINED)\n- `retentionReason` - the cancellation/pause reason the customer selected\n- `fromDay` / `toDay` - ISO-8601 date-time bounds on `activityOn`\n\n**Pagination:**\nStandard Spring pagination parameters are supported: `page` (0-indexed), `size`, and `sort` (e.g. `sort=id,desc`). Pagination metadata (total count, total pages, link headers) is returned in the response headers.\n\n**Use Cases:**\n- Build custom churn/retention dashboards and reports\n- Sync retention activity into an external CRM or data warehouse\n- Audit which retention offers are converting for a given contract or reason\n- Feed win-back campaign automation with recent cancellation reasons\n\n**Authentication:** Requires a valid API key, passed via the `X-API-Key` header (preferred) or the `api_key` query parameter (deprecated).",
        "operationId": "getAllCustomerRetentionActivitiesExternal",
        "parameters": [
          {
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "contractId",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "eventSource",
            "required": false,
            "schema": {
              "enum": [
                "PAUSE",
                "CANCELLATION"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "retentionAction",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "retentionReason",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "fromDay",
            "required": false,
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "toDay",
            "required": false,
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "description": "Pagination parameters (page number and size)",
            "example": {
              "page": 0,
              "size": 10,
              "sort": [
                "id,desc"
              ]
            },
            "in": "query",
            "name": "pageable",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Pageable"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": [
                      {
                        "activityOn": "2026-08-01T14:22:10Z",
                        "additionalInfo": "{\"offerId\":\"disc_20pct\"}",
                        "cancellationReason": "Too expensive",
                        "contractId": 991823,
                        "customerEmail": "jane.doe@example.com",
                        "customerName": "Jane Doe",
                        "discountApplied": "20% off for 3 months",
                        "eventSource": "CANCELLATION",
                        "id": 4821,
                        "retentionAction": "DISCOUNT_ACCEPTED",
                        "shop": "example-shop.myshopify.com",
                        "status": "COMPLETED"
                      }
                    ]
                  }
                },
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/CustomerRetentionActivityResponse"
                  },
                  "type": "array"
                }
              }
            },
            "description": "Customer retention activities successfully retrieved"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header is required",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to view customer retention activities",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to view customer retention activities"
          }
        },
        "summary": "Get customer retention activities",
        "tags": [
          "Customer Retention"
        ]
      }
    },
    "/api/external/v2/data/contract-delivery-options": {
      "get": {
        "description": "Retrieves all valid delivery methods available for a specific subscription contract. Returns shipping profiles and delivery options based on the contract's delivery address and product characteristics.\n\n**Market-driven shipping:** Each response entry has `profileName`, `methodDefinitions` and, on opted-in shops, `liveRates`. For market-driven shops `methodDefinitions` is empty and `liveRates` contains current eligible quotes with `name`, `code`, `amount`, `currencyCode` and `deliveryType` (SHIPPING, LOCAL or PICK_UP). An empty `liveRates` list means no eligible quotes. Live quote codes are not Market option IDs and must not be passed as delivery-method-id. For external method updates, supply a configured option ID from Shopify (the same ID used by the merchant portal's shipping catalogue); the server re-quotes it for the contract.\n\n**Delivery Information Returned:**\n- Available shipping profiles\n- Delivery methods for each profile\n- Shipping rates and costs\n- Delivery speed (standard, express, etc.)\n- Method names and descriptions\n- Eligibility based on address and products\n\n**Filtering Behavior:**\nBy default, returns only delivery methods valid for the contract:\n- Matches delivery address country/region\n- Compatible with subscription products\n- Available for contract weight/dimensions\n\n**Include All Methods:**\nUse header `X-Include-All-Methods: true` to return all delivery methods regardless of eligibility. Useful for admin UIs where you want to show all legacy profile methods. Market-driven shops always return eligible live quotes; this header does not widen them.\n\n**Use Cases:**\n- Display delivery method selector in customer portal\n- Allow customers to change shipping method\n- Calculate shipping costs for subscription\n- Validate delivery method during subscription updates\n- Show upgrade options (standard to express)\n\n**Common Scenarios:**\n\n**Customer Portal - Change Delivery Speed:**\n1. Call this endpoint with contractId\n2. Display available methods to customer\n3. Customer selects preferred method\n4. Update subscription with new delivery method ID\n\n**Subscription Creation - Delivery Selection:**\n1. Get delivery options for draft contract\n2. Present options during checkout/signup\n3. Create subscription with selected method\n\n**Important Notes:**\n- Delivery options depend on current contract address\n- Changing address may change available methods\n- Costs may vary based on products in subscription\n- Some methods may have minimum order requirements\n- International shipping may have additional restrictions\n\n**Authentication:** Requires X-API-Key header",
        "operationId": "getContractDeliveryOptions",
        "parameters": [
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Contract Id",
            "in": "query",
            "name": "contractId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-Include-All-Methods",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Legacy profile methods": {
                    "description": "Legacy profile methods",
                    "value": [
                      {
                        "methodDefinitions": [
                          {
                            "eligible": true,
                            "id": "gid://shopify/DeliveryMethodDefinition/123",
                            "name": "Standard",
                            "rateProvider": {
                              "__typename": "DeliveryRateDefinition",
                              "price": {
                                "amount": "5.99",
                                "currencyCode": "USD"
                              }
                            }
                          }
                        ],
                        "profileName": "Standard Shipping"
                      }
                    ]
                  },
                  "Market-driven live quotes": {
                    "description": "Market-driven live quotes",
                    "value": [
                      {
                        "liveRates": [
                          {
                            "amount": 5.99,
                            "code": "STANDARD",
                            "currencyCode": "USD",
                            "deliveryType": "SHIPPING",
                            "name": "Standard"
                          }
                        ],
                        "methodDefinitions": [],
                        "profileName": "Available shipping options"
                      }
                    ]
                  }
                }
              }
            },
            "description": "Delivery options retrieved successfully"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "error": "Invalid API key"
                }
              }
            },
            "description": "Invalid API key"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "error": "Unauthorized access to contract"
                }
              }
            },
            "description": "Access denied - Contract belongs to different shop"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "error": "Subscription contract not found"
                }
              }
            },
            "description": "Contract not found"
          }
        },
        "summary": "Get delivery options for subscription contract",
        "tags": [
          "Subscription Data",
          "Subscription Management"
        ]
      }
    },
    "/api/external/v2/delivery-profiles/create-shipping-profile": {
      "post": {
        "description": "Creates a new shipping or delivery profile for subscription orders. This endpoint allows you to configure custom shipping rates, delivery methods, and shipping zones for your subscription products. Delivery profiles control how subscription products are shipped to customers.\n\n**Key Features:**\n- Define custom shipping rates per zone\n- Configure local delivery options\n- Set up local pickup methods\n- Manage shipping zones and countries\n- Assign profiles to specific products or variants\n\n**Delivery Method Types:**\n- **SHIPPING**: Standard shipping with carrier rates or custom rates\n- **LOCAL_DELIVERY**: Local delivery service within specific areas\n- **PICKUP**: Customer pickup from store locations\n\n**Important Notes:**\n- Each delivery profile must have a unique name\n- At least one delivery method is required\n- Shipping rates can be set per zone and per weight/price range\n- Profiles can be assigned to subscription products to control their shipping behavior\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "createShippingProfileV2",
        "parameters": [
          {
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateShippingProfileRequestVM"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "default": false,
                      "id": "12345",
                      "locationGroupsCount": 1,
                      "name": "Standard Subscription Shipping",
                      "productsCount": 15,
                      "profileLocationGroups": [
                        {
                          "countries": [
                            {
                              "code": "US",
                              "name": "United States",
                              "provinces": []
                            },
                            {
                              "code": "CA",
                              "name": "Canada",
                              "provinces": []
                            }
                          ],
                          "locationGroupId": "gid://shopify/DeliveryLocationGroup/11111",
                          "zones": [
                            {
                              "methodDefinitions": [
                                {
                                  "name": "Standard Shipping",
                                  "rateDefinition": {
                                    "price": {
                                      "amount": "5.99",
                                      "currencyCode": "USD"
                                    }
                                  }
                                }
                              ]
                            }
                          ]
                        }
                      ],
                      "shop": "example-shop.myshopify.com",
                      "shopifyDeliveryProfileId": "gid://shopify/DeliveryProfile/67890"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/DeliveryProfileDTO"
                }
              }
            },
            "description": "Delivery profile created successfully"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Duplicate Profile Name": {
                    "description": "Duplicate Profile Name",
                    "value": {
                      "detail": "A delivery profile with this name already exists",
                      "status": 400,
                      "title": "Duplicate profile name",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Delivery Method": {
                    "description": "Invalid Delivery Method",
                    "value": {
                      "detail": "At least one delivery method must be specified",
                      "status": 400,
                      "title": "Invalid delivery method configuration",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Missing Profile Name": {
                    "description": "Missing Profile Name",
                    "value": {
                      "detail": "Delivery profile name is required",
                      "status": 400,
                      "title": "Validation Error",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid request parameters or validation error"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header is required",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to create delivery profiles",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to create delivery profiles"
          },
          "422": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Unable to create delivery profile in Shopify",
                  "status": 422,
                  "title": "Shopify API error",
                  "type": "https://example.com/errors/unprocessable-entity"
                }
              }
            },
            "description": "Unable to process delivery profile due to Shopify API constraints"
          }
        },
        "summary": "Create a new shipping/delivery profile",
        "tags": [
          "Operations & Settings",
          "Delivery & Shipping"
        ]
      }
    },
    "/api/external/v2/delivery-profiles/v2/create-shipping-profile": {
      "post": {
        "description": "Creates a new shipping or delivery profile for subscription orders using the V2 request format. This version provides enhanced configuration options for delivery methods, zones, and pricing.\n\n**Enhancements in V2:**\n- Improved zone configuration\n- Better support for multiple delivery methods\n- Enhanced rate definition capabilities\n- Support for conditional delivery rates\n\n**Key Features:**\n- Define custom shipping rates per zone\n- Configure local delivery options\n- Set up local pickup methods\n- Manage shipping zones and countries\n- Assign profiles to specific products or variants\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "createShippingProfileV2External",
        "parameters": [
          {
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateShippingProfileRequestV2"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeliveryProfileDTO"
                }
              }
            },
            "description": "Delivery profile created successfully"
          },
          "400": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/DeliveryProfileDTO"
                }
              }
            },
            "description": "Invalid request parameters or validation error"
          },
          "401": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/DeliveryProfileDTO"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/DeliveryProfileDTO"
                }
              }
            },
            "description": "Insufficient permissions to create delivery profiles"
          },
          "422": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/DeliveryProfileDTO"
                }
              }
            },
            "description": "Unable to process delivery profile due to Shopify API constraints"
          }
        },
        "summary": "Create a new shipping/delivery profile (V2)",
        "tags": [
          "Operations & Settings",
          "Delivery & Shipping"
        ]
      }
    },
    "/api/external/v2/delivery-profiles/v3/create-shipping-profile": {
      "post": {
        "description": "Creates a new shipping or delivery profile for subscription orders using the V3 request format. This is the latest version with the most comprehensive delivery profile configuration capabilities.\n\n**Enhancements in V3:**\n- Full support for all Shopify delivery profile features\n- Advanced rate calculation options\n- Support for weight-based and price-based rates\n- Enhanced zone and country management\n- Better handling of delivery conditions and rules\n\n**Key Features:**\n- Define complex shipping rate structures\n- Configure multiple delivery methods per zone\n- Set up conditional rates based on weight, price, or item count\n- Manage detailed shipping zones with province-level granularity\n- Full control over delivery profile settings\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "createShippingProfileV3External",
        "parameters": [
          {
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateShippingProfileRequestV3"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateShippingProfileRequestV3"
                }
              }
            },
            "description": "Delivery profile created successfully"
          },
          "400": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/CreateShippingProfileRequestV3"
                }
              }
            },
            "description": "Invalid request parameters or validation error"
          },
          "401": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/CreateShippingProfileRequestV3"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/CreateShippingProfileRequestV3"
                }
              }
            },
            "description": "Insufficient permissions to create delivery profiles"
          },
          "422": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/CreateShippingProfileRequestV3"
                }
              }
            },
            "description": "Unable to process delivery profile due to Shopify API constraints"
          }
        },
        "summary": "Create a new shipping/delivery profile (V3)",
        "tags": [
          "Operations & Settings",
          "Delivery & Shipping"
        ]
      }
    },
    "/api/external/v2/manage-subscription-link": {
      "get": {
        "description": "Generates a secure, time-limited magic link that allows customers to access their subscription management portal. This endpoint supports lookup by either customer ID or email address, making it flexible for different integration scenarios.\n\n**Key Features:**\n- **Dual Lookup**: Find customer by ID or email\n- **Auto Customer Discovery**: Automatically finds customer from email\n- **Secure Tokens**: Encrypted tokens with 2-hour expiration\n- **Custom Domains**: Supports shop's public domain\n- **Zero-Auth Access**: Customers don't need passwords\n\n**Customer Lookup Logic:**\n\n**Option 1: By Customer ID (Preferred)**\n```\nGET /api/external/v2/manage-subscription-link?customerId=12345\n```\n- Direct lookup by Shopify customer ID\n- Fastest and most reliable method\n- No ambiguity\n\n**Option 2: By Email**\n```\nGET /api/external/v2/manage-subscription-link?emailId=customer@example.com\n```\n- Searches for customer by email in subscription database\n- Finds customer ID automatically\n- If not found: Returns error\n\n**Validation Rules:**\n- Either `customerId` OR `emailId` must be provided\n- Cannot provide both (customerId takes precedence)\n- Email must match a customer with subscriptions\n- Customer must belong to authenticated shop\n\n**Token Generation:**\n\n**Token Contents:**\n- Encrypted customer ID\n- Shop domain\n- Generation timestamp\n- Expiration time (2 hours)\n\n**Security Features:**\n- Cryptographically secure encryption\n- Cannot be forged or modified\n- Automatic expiration after 2 hours\n- Single-use recommended (though not enforced)\n- Tied to specific shop and customer\n\n**Generated URL Structure:**\n```\nhttps://[shop-domain]/[manage-subscriptions-path]?token=[encrypted-token]\n```\n\n**Example URLs:**\n```\nhttps://mystore.com/tools/recurring/customer_portal?token=eyJhbGc...\nhttps://shop.myshopify.com/tools/recurring/customer_portal?token=eyJhbGc...\n```\n\n**Use Cases:**\n\n**1. Email Campaigns:**\n- Add \"Manage Subscription\" button to transactional emails\n- Include in billing reminder emails\n- Send in order confirmation emails\n- Add to marketing campaigns\n\n**2. Customer Support:**\n- Provide customers quick portal access\n- Avoid \"forgot password\" issues\n- Enable instant self-service\n- Reduce support ticket volume\n\n**3. Post-Purchase Flows:**\n- Thank you page portal links\n- First order welcome emails\n- Onboarding email sequences\n- Re-engagement campaigns\n\n**4. Account Management:**\n- SMS notifications with portal links\n- Push notification deep links\n- Customer dashboard integrations\n- Third-party app integrations\n\n**Response Format:**\n```json\n{\n  \"manageSubscriptionLink\": \"https://mystore.com/tools/recurring/customer_portal?token=eyJhbGciOiJIUzI1NiJ9...\",\n  \"tokenExpirationTime\": \"2024-03-15T14:30:00Z\"\n}\n```\n\n**Response Fields:**\n- `manageSubscriptionLink`: Complete URL ready to use\n- `tokenExpirationTime`: ISO 8601 timestamp when token expires\n\n**Integration Examples:**\n\n**Email Template:**\n```javascript\nconst response = await fetch(\n  `/api/external/v2/manage-subscription-link?emailId=${customerEmail}`,\n  { headers: { 'X-API-Key': 'your-key' } }\n).then(r => r.json());\n\nconst emailHtml = `\n  <p>Hi ${customerName},</p>\n  <p>Manage your subscription:</p>\n  <a href=\"${response.manageSubscriptionLink}\">Manage Subscription</a>\n  <p><small>Link expires ${formatDate(response.tokenExpirationTime)}</small></p>\n`;\n```\n\n**SMS Notification:**\n```javascript\nconst { manageSubscriptionLink } = await getPortalLink(customerId);\nconst shortUrl = await shortenUrl(manageSubscriptionLink);\n\nawait sendSMS(customerPhone, \n  `Your subscription ships tomorrow! Manage it here: ${shortUrl}`\n);\n```\n\n**Important Considerations:**\n\n**Token Expiration:**\n- Tokens expire after exactly 2 hours\n- Generate new token if expired\n- Don't store tokens long-term\n- Best practice: Generate on-demand\n\n**Domain Selection:**\n- Uses shop's `publicDomain` if configured\n- Falls back to Shopify domain (.myshopify.com)\n- Respects custom domain settings\n- Maintains brand consistency\n\n**Customer Lookup Errors:**\n- Email not found: Returns 400 error\n- Invalid customer ID: Returns error\n- No parameters provided: Returns 400\n- Both parameters provided: Uses customerId\n\n**Security Notes:**\n- Tokens cannot be used across different shops\n- Cannot be used for different customers\n- Tampering invalidates token\n- Consider rate limiting token generation\n\n**Best Practices:**\n\n1. **Generate On-Demand**: Create tokens when needed, not in advance\n2. **Use HTTPS**: Always serve links over HTTPS\n3. **Show Expiry**: Inform customers when link expires\n4. **URL Shortening**: Use URL shorteners for SMS/print materials\n5. **Track Usage**: Monitor which emails drive portal visits\n6. **Prefer Customer ID**: Use customerId when available for faster lookup\n\n**Comparison with /manage-subscription-link/{customerId}:**\n- This endpoint: Flexible lookup (ID or email)\n- Path parameter version: Customer ID only\n- Both generate identical tokens\n- Use this for email-based flows\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "getManageSubscriptionLinkv3",
        "parameters": [
          {
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "customerId",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "emailId",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "manageSubscriptionLink": "https://mystore.com/tools/recurring/customer_portal?token=eyJhbGciOiJIUzI1NiJ9.eyJjdXN0b21lcklkIjoxMjM0NSwic2hvcCI6Im15c3RvcmUubXlzaG9waWZ5LmNvbSIsInRpbWVzdGFtcCI6MTcwOTU2MjAwMH0.abc123xyz",
                      "tokenExpirationTime": "2024-03-15T14:30:00Z"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/TokenDetails"
                }
              }
            },
            "description": "Successfully generated manage subscription link"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Customer Not Found": {
                    "description": "Customer Not Found",
                    "value": {
                      "detail": "Customer not found for the provided email: customer@example.com",
                      "status": 400,
                      "title": "Customer not found",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Missing Parameters": {
                    "description": "Missing Parameters",
                    "value": {
                      "detail": "Either customerId or emailId must be provided.",
                      "status": 400,
                      "title": "Missing required parameter",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Bad request - Missing parameters or customer not found"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header is required",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Customer does not belong to your shop",
                  "status": 403,
                  "title": "Access denied",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Forbidden - Customer does not belong to authenticated shop"
          },
          "500": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Failed to generate customer portal token",
                  "status": 500,
                  "title": "Token generation failed",
                  "type": "https://example.com/errors/internal-error"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Generate customer portal access link by customer ID or email",
        "tags": [
          "Customers",
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/manage-subscription-link/{customerId}": {
      "get": {
        "description": "Generates a secure, time-limited link that allows customers to access their subscription management portal. This link provides customers with self-service capabilities to manage their subscriptions without requiring login credentials.\n\n**Key Features:**\n- Generates unique encrypted token for customer authentication\n- Token expires after 2 hours for security\n- Direct access to subscription management without password\n- Uses store's custom domain when available\n- Supports white-label customer portals\n\n**Token Security:**\n- Token contains encrypted customer ID, shop, and timestamp\n- Cannot be reused after expiration\n- Unique token generated for each request\n- Cryptographically secure encryption\n\n**Customer Portal Access:**\nOnce customers click the link, they can:\n- View all active subscriptions\n- Update payment methods\n- Change delivery addresses\n- Modify product quantities\n- Pause or cancel subscriptions\n- Update delivery schedules\n- Apply discount codes\n- View order history\n\n**Use Cases:**\n- Email campaigns with 'Manage Subscription' CTAs\n- Customer service providing quick access\n- Post-purchase email flows\n- Account management integrations\n- Reducing support ticket volume\n\n**URL Structure:**\nThe generated URL follows this pattern:\n`https://[store-domain]/[manage-subscription-path]?token=[encrypted-token]`\n\n**Important Notes:**\n- Links are single-use and expire after 2 hours\n- New link must be generated after expiration\n- Customer ID must be valid and active\n- Store must have customer portal configured\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "getManageSubscriptionLink",
        "parameters": [
          {
            "deprecated": true,
            "description": "API Key (Deprecated - Use X-API-Key header instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key for authentication",
            "example": "apst_your-api-key-here",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Customer ID to generate portal link for. Provide the numeric ID without the gid:// prefix",
            "example": 987654321,
            "in": "path",
            "name": "customerId",
            "required": true,
            "schema": {
              "format": "int64",
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "customerId": 987654321,
                      "expiresInMinutes": 120,
                      "manageSubscriptionLink": "https://store.example.com/pages/manage-subscriptions?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzaG9wIjoic3RvcmUuZXhhbXBsZS5jb20iLCJjdXN0b21lcklkIjo5ODc2NTQzMjEsImNyZWF0ZWRBdCI6MTcxMDUxMjQwMDAwMH0.dGhpcyBpcyBhIHNhbXBsZSB0b2tlbiBmb3IgZG9jdW1lbnRhdGlvbg",
                      "portalUrl": "https://store.example.com/pages/manage-subscriptions",
                      "tokenExpirationTime": "2024-03-15T16:30:00.000Z"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/TokenDetails"
                }
              }
            },
            "description": "Manage subscription link successfully generated"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Invalid Customer ID": {
                    "description": "Invalid Customer ID",
                    "value": {
                      "detail": "Customer ID must be a positive number",
                      "status": 400,
                      "title": "Invalid customer ID",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Portal Not Configured": {
                    "description": "Portal Not Configured",
                    "value": {
                      "detail": "Store has not configured a manage subscriptions URL",
                      "status": 400,
                      "title": "Customer portal not configured",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid request parameters"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid API key is required to access this endpoint",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required - missing or invalid API key"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to generate customer portal links",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "No customer found with ID 987654321",
                  "status": 404,
                  "title": "Customer not found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Customer not found"
          },
          "500": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "An error occurred while generating the secure token",
                  "status": 500,
                  "title": "Token generation failed",
                  "type": "https://example.com/errors/internal-error"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Generate customer portal link",
        "tags": [
          "Customers",
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/product-swaps": {
      "get": {
        "description": "Retrieves all configured product swap automations for the authenticated shop. Product swaps allow automatic replacement of products in subscription orders based on billing cycles or recurring schedules.\n\n**What are Product Swaps?**\nProduct swaps enable merchants to automatically replace products in subscription orders at specific billing cycles. This is useful for seasonal products, progression paths (e.g., beginner \u2192 intermediate \u2192 advanced), or variety subscriptions.\n\n**Key Features:**\n- View all configured swap automations\n- See source and destination product mappings\n- Check which billing cycles trigger swaps\n- Identify recurring vs one-time swaps\n- Review discount carry-forward settings\n\n**Swap Configuration Types:**\n- **One-Time Swap**: Occurs at a specific billing cycle\n- **Recurring Swap**: Occurs at every order\n- **Conditional Swap**: Based on billing cycle number\n\n**Use Cases:**\n- Seasonal product rotations (summer \u2192 fall \u2192 winter products)\n- Subscription progression (trial \u2192 full product)\n- Variety boxes with automatic product rotation\n- Product lifecycle management in subscriptions\n- A/B testing different products in subscriptions\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "getAllProductSwaps",
        "parameters": [
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "ruleName",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "sourceVariants",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "destinationVariants",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": [
                      {
                        "active": true,
                        "carryDiscountForward": true,
                        "checkForEveryRecurringOrder": false,
                        "createdAt": "2024-01-15T10:30:00Z",
                        "destinationVariants": "[{\"id\":67890,\"displayName\":\"Fall Blend Coffee\",\"imageSrc\":\"https://cdn.shopify.com/image2.jpg\",\"quantity\":2}]",
                        "discountCarryForward": "PERCENTAGE",
                        "forBillingCycle": 4,
                        "id": 10782,
                        "name": "Seasonal Coffee Rotation",
                        "shop": "example-shop.myshopify.com",
                        "sourceVariants": "[{\"id\":12345,\"displayName\":\"Summer Blend Coffee\",\"imageSrc\":\"https://cdn.shopify.com/image1.jpg\",\"quantity\":2}]",
                        "stopSwapEmails": false,
                        "updatedFirstOrder": false
                      },
                      {
                        "active": true,
                        "carryDiscountForward": false,
                        "checkForEveryRecurringOrder": true,
                        "destinationVariants": "[{\"id\":33333,\"displayName\":\"Advanced Kit\",\"imageSrc\":\"https://cdn.shopify.com/kit2.jpg\",\"quantity\":1}]",
                        "discountCarryForward": "NONE",
                        "forBillingCycle": null,
                        "id": 10783,
                        "name": "Monthly Variety Swap",
                        "shop": "example-shop.myshopify.com",
                        "sourceVariants": "[{\"id\":22222,\"displayName\":\"Beginner Kit\",\"imageSrc\":\"https://cdn.shopify.com/kit1.jpg\",\"quantity\":1}]",
                        "stopSwapEmails": true,
                        "updatedFirstOrder": false
                      }
                    ]
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ProductSwapDTO"
                }
              }
            },
            "description": "Successfully retrieved product swaps"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header is required",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to view product swaps",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to view product swaps"
          }
        },
        "summary": "Get all product swaps for a shop",
        "tags": [
          "Product Catalog"
        ]
      },
      "post": {
        "deprecated": true,
        "description": "Creates a new product swap automation rule for the authenticated shop. Product swaps automatically replace products in subscription orders based on billing cycles or recurring schedules.\n\n**Required Fields:**\n- **shop**: Your Shopify shop domain\n- **sourceVariants**: JSON string of variants to swap FROM (format: [{\"id\":12345,\"quantity\":2}])\n- **destinationVariants**: JSON string of variants to swap TO (format: [{\"id\":67890,\"quantity\":2}])\n- **name**: Descriptive name for this swap rule\n\n**Optional Fields:**\n- **forBillingCycle**: Specific cycle number when swap occurs (e.g., 4 = swap at 4th order). Leave null for recurring swaps.\n- **checkForEveryRecurringOrder**: If true, applies swap to every order (overrides forBillingCycle)\n- **updatedFirstOrder**: If true, can affect the first subscription order\n- **changeNextOrderDateBy**: Days to adjust next order date after swap (positive or negative integer)\n- **discountCarryForward**: How to handle discounts - NONE, PERCENTAGE, FIXED_AMOUNT, or PRICE\n- **carryDiscountForward**: Legacy boolean field (deprecated, use discountCarryForward instead)\n- **stopSwapEmails**: If true, suppresses customer notification emails about the swap\n- **ruleSequence**: Priority order when multiple swaps apply (lower number = higher priority)\n\n**Variant JSON Format:**\nThe API enriches your variant data with product details from Shopify. You only need to provide:\n```json\n[{\"id\": 12345, \"quantity\": 2}]\n```\nThe response will include enriched data: displayName, imageSrc, productTitle, etc.\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "createProductSwap",
        "parameters": [
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "examples": {
                "Request Example": {
                  "description": "Request Example",
                  "value": {
                    "carryDiscountForward": false,
                    "checkForEveryRecurringOrder": false,
                    "destinationVariants": "[{\"id\":67890,\"quantity\":2}]",
                    "discountCarryForward": "NONE",
                    "forBillingCycle": 2,
                    "name": "swap test",
                    "shop": "example-shop",
                    "sourceVariants": "[{\"id\":12345,\"quantity\":2}]",
                    "stopSwapEmails": false,
                    "updatedFirstOrder": false
                  }
                }
              },
              "schema": {
                "$ref": "#/components/schemas/ProductSwapDTO"
              }
            }
          },
          "description": "ProductSwapDTO payload",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "carryDiscountForward": false,
                      "changeNextOrderDateBy": null,
                      "checkForEveryRecurringOrder": false,
                      "destinationVariants": "[{\"id\":67890,\"displayName\":\"test-product\",\"imageSrc\":\"https://test.com/image.png\",\"quantity\":2}]",
                      "discountCarryForward": "NONE",
                      "forBillingCycle": 2,
                      "id": 10782,
                      "name": "swap test",
                      "ruleSequence": 0,
                      "shop": "example-shop",
                      "sourceVariants": "[{\"id\":12345,\"displayName\":\"test-product\",\"imageSrc\":\"https://test.com/image.png\",\"quantity\":2}]",
                      "stopSwapEmails": false,
                      "updatedFirstOrder": false
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ProductSwapDTO"
                }
              }
            },
            "description": "Product swap created successfully"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "ID Exists": {
                    "description": "ID Exists",
                    "value": {
                      "detail": "A new productSwap cannot already have an ID",
                      "status": 400,
                      "title": "A new productSwap cannot already have an ID",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid request or product swap already has an ID"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header is required",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to create product swaps",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to create product swap"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Resource not found",
                  "status": 404,
                  "title": "Resource not found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Resource not found"
          },
          "422": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Cannot create product swap due to business rule violation",
                  "status": 422,
                  "title": "Business rule violation",
                  "type": "https://example.com/errors/unprocessable-entity"
                }
              }
            },
            "description": "Unprocessable entity - business rule violation"
          }
        },
        "summary": "Create a new product swap automation",
        "tags": [
          "Product Catalog"
        ]
      },
      "put": {
        "deprecated": true,
        "description": "Updates an existing product swap automation rule for the authenticated shop. Use this endpoint to modify swap configurations, change source/destination products, adjust timing, or update discount handling.\n\n**Required Fields:**\n- **id**: The product swap ID to update\n- **shop**: Your Shopify shop domain (must match authenticated shop)\n\n**Updatable Fields:**\n- **sourceVariants**: JSON string of variants to swap FROM\n- **destinationVariants**: JSON string of variants to swap TO\n- **name**: Descriptive name for this swap rule\n- **forBillingCycle**: Specific cycle number when swap occurs (null for recurring)\n- **checkForEveryRecurringOrder**: If true, applies swap to every order\n- **updatedFirstOrder**: If true, can affect the first subscription order\n- **changeNextOrderDateBy**: Days to adjust next order date after swap\n- **discountCarryForward**: How to handle discounts (NONE, PERCENTAGE, FIXED_AMOUNT, PRICE)\n- **carryDiscountForward**: Legacy boolean field (use discountCarryForward instead)\n- **stopSwapEmails**: If true, suppresses customer notification emails\n- **ruleSequence**: Priority order (lower number = higher priority)\n\n**Impact of Updates:**\n- Changes apply to future orders immediately\n- Past orders and already-swapped products are not affected\n- If changing forBillingCycle, recalculates which subscriptions are affected\n- Variant data is automatically enriched from Shopify on update\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "updateProductSwap",
        "parameters": [
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "examples": {
                "Request Example": {
                  "description": "Request Example",
                  "value": {
                    "carryDiscountForward": false,
                    "checkForEveryRecurringOrder": false,
                    "destinationVariants": "[{\"id\":67890,\"quantity\":2}]",
                    "discountCarryForward": "NONE",
                    "forBillingCycle": 2,
                    "id": 10782,
                    "name": "swap test",
                    "shop": "example-shop",
                    "sourceVariants": "[{\"id\":12345,\"quantity\":2}]",
                    "stopSwapEmails": false,
                    "updatedFirstOrder": false
                  }
                }
              },
              "schema": {
                "$ref": "#/components/schemas/ProductSwapDTO"
              }
            }
          },
          "description": "ProductSwapDTO payload",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "carryDiscountForward": false,
                      "changeNextOrderDateBy": null,
                      "checkForEveryRecurringOrder": false,
                      "destinationVariants": "[{\"id\":67890,\"displayName\":\"test-product\",\"imageSrc\":\"https://test.com/image.png\",\"quantity\":2}]",
                      "discountCarryForward": "NONE",
                      "forBillingCycle": 2,
                      "id": 10782,
                      "name": "swap test",
                      "ruleSequence": 0,
                      "shop": "example-shop",
                      "sourceVariants": "[{\"id\":12345,\"displayName\":\"test-product\",\"imageSrc\":\"https://test.com/image.png\",\"quantity\":2}]",
                      "stopSwapEmails": false,
                      "updatedFirstOrder": false
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ProductSwapDTO"
                }
              }
            },
            "description": "Product swap updated successfully"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "ID Not Found": {
                    "description": "ID Not Found",
                    "value": {
                      "detail": "Invalid id",
                      "status": 400,
                      "title": "Invalid id",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid request or product swap not found"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header is required",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to update product swaps",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to update product swap"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Resource not found",
                  "status": 404,
                  "title": "Resource not found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Resource not found"
          },
          "422": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Cannot update product swap due to business rule violation",
                  "status": 422,
                  "title": "Business rule violation",
                  "type": "https://example.com/errors/unprocessable-entity"
                }
              }
            },
            "description": "Unprocessable entity - business rule violation"
          }
        },
        "summary": "Update an existing product swap automation",
        "tags": [
          "Product Catalog"
        ]
      }
    },
    "/api/external/v2/product-swaps-by-variant-groups/{contractId}": {
      "post": {
        "description": "Retrieves product swap variant groups for the next 10 billing cycles of a specific subscription contract. This endpoint calculates and returns which products will be swapped to in future billing cycles based on configured swap automations.\n\n**Response Structure:**\nReturns a 2D array (`List<List<VariantQuantity>>`):\n- **Outer array**: Represents the next 10 billing cycles\n- **Inner arrays**: Contains the variant(s) that will be swapped to for that specific cycle\n- **Index 0**: Variants for the next (upcoming) billing cycle\n- **Index 1**: Variants for the cycle after that\n- And so on for the next 10 cycles\n\n**Variant Details:**\nEach variant object includes:\n- **variantId**: Shopify variant ID\n- **quantity**: Number of units to swap\n- **title**: Variant title (e.g., \"Medium Roast - 12oz\")\n- **image**: Product/variant image URL\n- **productTitle**: Full product name\n- **productId**: Shopify product GID\n- **variantTitle**: Full display name combining product and variant titles\n- **swapId**: ID of the swap automation rule that triggered this swap\n\n**How It Works:**\n1. Takes the current products in the subscription\n2. Applies configured swap automations for the next 10 cycles\n3. Calculates which products will be swapped based on:\n   - Billing cycle number\n   - Swap rule configurations (forBillingCycle, checkForEveryRecurringOrder)\n   - Rule sequence/priority\n4. Returns the projected product lineup for each cycle\n\n**Use Cases:**\n- Preview upcoming product swaps in customer portals\n- Show customers their subscription product timeline\n- Build interactive swap calendars\n- Display \"what you'll receive\" for future orders\n- Debug and verify swap automation configurations\n\n**Important Notes:**\n- Returns 10 cycles even if no swaps are configured (returns current products)\n- Multiple variants in an inner array means multiple products will be in that order\n- Empty inner arrays indicate no products for that cycle (rare edge case)\n- The swapId can be used to trace which automation rule triggered the swap\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "getProductSwapsByVariantIdV2",
        "parameters": [
          {
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "contractId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "examples": {
                "Request Example": {
                  "description": "Request Example",
                  "value": {
                    "variantQuantityList": [
                      {
                        "quantity": 2,
                        "swapId": 1001,
                        "variantId": 12345
                      },
                      {
                        "quantity": 2,
                        "swapId": 1002,
                        "variantId": 67890
                      }
                    ]
                  }
                }
              },
              "schema": {
                "$ref": "#/components/schemas/VariantQuantityInfo"
              }
            }
          },
          "description": "VariantQuantityInfo payload",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Array of arrays - outer array represents billing cycles, inner arrays contain variants for that cycle",
                    "value": [
                      [
                        {
                          "image": "https://cdn.shopify.com/files/1/0000/0000/products/medium-roast.jpg",
                          "productId": "gid://shopify/Product/98765",
                          "productTitle": "House Blend Coffee",
                          "quantity": 2,
                          "swapId": 1001,
                          "title": "Medium Roast - 12oz",
                          "variantId": 12345,
                          "variantTitle": "House Blend Coffee - Medium Roast - 12oz"
                        },
                        {
                          "image": "https://cdn.shopify.com/files/1/0000/0000/products/light-roast.jpg",
                          "productId": "gid://shopify/Product/98766",
                          "productTitle": "Morning Blend Coffee",
                          "quantity": 1,
                          "swapId": 1001,
                          "title": "Light Roast - 8oz",
                          "variantId": 12346,
                          "variantTitle": "Morning Blend Coffee - Light Roast - 8oz"
                        }
                      ],
                      [
                        {
                          "image": "https://cdn.shopify.com/files/1/0000/0000/products/dark-roast.jpg",
                          "productId": "gid://shopify/Product/88765",
                          "productTitle": "Bold Blend Coffee",
                          "quantity": 2,
                          "swapId": 1002,
                          "title": "Dark Roast - 12oz",
                          "variantId": 67890,
                          "variantTitle": "Bold Blend Coffee - Dark Roast - 12oz"
                        }
                      ]
                    ]
                  }
                }
              }
            },
            "description": "Product swap variant groups returned successfully - Returns swappable variants for the next 10 billing cycles. Each element in the outer array represents the variants that will be swapped to for a specific billing cycle."
          },
          "400": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contract does not belong to this shop",
                  "status": 400,
                  "title": "Invalid contract",
                  "type": "https://example.com/errors/bad-request"
                }
              }
            },
            "description": "Invalid contract ID or contract doesn't belong to authenticated shop"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header is required",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to view product swaps",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to view product swaps"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "No product swap variant groups available for this contract",
                  "status": 404,
                  "title": "No swap groups found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Contract not found or no swap groups available"
          }
        },
        "summary": "Get product swap variant groups for a contract",
        "tags": [
          "Product Catalog"
        ]
      }
    },
    "/api/external/v2/product-swaps/{id}": {
      "delete": {
        "deprecated": true,
        "description": "Permanently deletes a product swap automation configuration. Once deleted, the swap will no longer be applied to any subscription orders. Existing subscriptions that have already had products swapped are not affected.\n\n**Deletion Behavior:**\n- Permanently removes the swap automation\n- Does not reverse past swaps that have already occurred\n- Future orders will not have this swap applied\n- Cannot be undone - swap configuration must be recreated if needed\n\n**Impact on Subscriptions:**\n- **Active Subscriptions**: Will continue with current products (no automatic reversion)\n- **Future Orders**: Swap will not be applied\n- **Past Orders**: Already swapped products remain unchanged\n- **Queued Swaps**: Pending swaps for this automation are cancelled\n\n**When to Delete:**\n- Discontinuing a seasonal product rotation\n- Removing outdated swap rules\n- Cleaning up test or experimental swaps\n- Product lines being discontinued\n- Correcting misconfigured swaps\n\n**Important Notes:**\n- This operation is permanent and cannot be undone\n- Consider deactivating instead of deleting if you might reuse the configuration\n- Activity logs for past swaps are retained\n- Customers are not automatically notified of swap deletion\n\n**Best Practices:**\n- Review affected subscriptions before deletion\n- Consider communicating changes to affected customers\n- Export swap configuration if you might need it later\n- Use deactivation for temporary pauses instead of deletion\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "deleteProductSwap",
        "parameters": [
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Product swap successfully deleted - No content returned"
          },
          "400": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Product swap does not belong to this shop or ID is invalid",
                  "status": 400,
                  "title": "Invalid id",
                  "type": "https://example.com/errors/bad-request"
                }
              }
            },
            "description": "Invalid product swap ID or swap doesn't belong to authenticated shop"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header is required",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to delete product swaps",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to delete product swaps"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Product swap with ID 10782 not found",
                  "status": 404,
                  "title": "Resource not found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Product swap not found"
          }
        },
        "summary": "Delete a product swap automation",
        "tags": [
          "Product Catalog"
        ]
      },
      "get": {
        "description": "Retrieves detailed information about a specific product swap automation configuration. This endpoint returns complete details about the source products, destination products, swap triggers, and all associated settings.\n\n**Response Details:**\n- Complete swap configuration\n- Source product variants with images and quantities\n- Destination product variants with images and quantities\n- Billing cycle triggers and conditions\n- Discount carry-forward settings\n- Email notification preferences\n- Swap status and history\n\n**Source and Destination Variants:**\nBoth source and destination variants are returned as JSON strings containing:\n- Variant ID\n- Display name/title\n- Product image URL\n- Quantity to swap\n- Product metadata\n\n**Swap Timing:**\n- **forBillingCycle**: If set, swap occurs at this specific cycle number\n- **checkForEveryRecurringOrder**: If true, swap happens on every order\n- **updatedFirstOrder**: If true, can affect the initial subscription order\n\n**Discount Handling:**\n- **NONE**: No discount carried forward\n- **PERCENTAGE**: Percentage discount is maintained\n- **FIXED_AMOUNT**: Fixed amount discount is maintained\n- **PRICE**: Specific price point is maintained\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "getProductSwap",
        "parameters": [
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "active": true,
                      "carryDiscountForward": true,
                      "checkForEveryRecurringOrder": false,
                      "contractsAffected": 145,
                      "createdAt": "2024-01-15T10:30:00Z",
                      "description": "Automatically swap to seasonal blend at cycle 4",
                      "destinationVariants": "[{\"id\":67890,\"displayName\":\"Fall Blend Coffee - 12oz\",\"imageSrc\":\"https://cdn.shopify.com/files/1/0000/0000/products/fall-blend.jpg\",\"quantity\":2,\"price\":\"29.99\"}]",
                      "discountCarryForward": "PERCENTAGE",
                      "forBillingCycle": 4,
                      "id": 10782,
                      "name": "Seasonal Coffee Rotation",
                      "shop": "example-shop.myshopify.com",
                      "sourceVariants": "[{\"id\":12345,\"displayName\":\"Summer Blend Coffee - 12oz\",\"imageSrc\":\"https://cdn.shopify.com/files/1/0000/0000/products/summer-blend.jpg\",\"quantity\":2,\"price\":\"29.99\"}]",
                      "stopSwapEmails": false,
                      "updatedAt": "2024-01-15T10:30:00Z",
                      "updatedFirstOrder": false
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ProductSwapDTO"
                }
              }
            },
            "description": "Product swap successfully retrieved"
          },
          "400": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Product swap does not belong to this shop",
                  "status": 400,
                  "title": "Invalid id",
                  "type": "https://example.com/errors/bad-request"
                }
              }
            },
            "description": "Invalid product swap ID"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header is required",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to view product swaps",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to view product swap"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Product swap with ID 10782 not found",
                  "status": 404,
                  "title": "Resource not found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Product swap not found"
          }
        },
        "summary": "Get a specific product swap by ID",
        "tags": [
          "Product Catalog"
        ]
      }
    },
    "/api/external/v2/quick-checkout/links": {
      "get": {
        "operationId": "getLinksV2",
        "parameters": [
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 20,
              "format": "int32",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "nextToken",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "paginated",
            "required": false,
            "schema": {
              "default": true,
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "*/*": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "OK"
          }
        },
        "summary": "List quick checkout links",
        "tags": [
          "Subscription Management"
        ]
      }
    },
    "/api/external/v2/subscription-billing-attempts": {
      "put": {
        "description": "Updates an existing subscription billing attempt. This endpoint allows modification of billing attempt details such as billing date, order note, and other attributes.\n\n**Important Notes:**\n- Only QUEUED billing attempts can be updated\n- Cannot update attempts that are already processed or failed\n- Billing attempt must belong to the authenticated shop\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "updateSubscriptionBillingAttemptV2",
        "parameters": [
          {
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubscriptionBillingAttemptDTO"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionBillingAttemptDTO"
                }
              }
            },
            "description": "Billing attempt successfully updated"
          },
          "400": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionBillingAttemptDTO"
                }
              }
            },
            "description": "Invalid request or billing attempt cannot be updated"
          },
          "401": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionBillingAttemptDTO"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionBillingAttemptDTO"
                }
              }
            },
            "description": "Insufficient permissions"
          }
        },
        "summary": "Update subscription billing attempt",
        "tags": [
          "Billing & Payments"
        ]
      }
    },
    "/api/external/v2/subscription-billing-attempts-update-order-note/{id}": {
      "put": {
        "description": "Updates the order note (customer note) for a billing attempt. This note will be included when the order is created in Shopify.\n\n**Use Cases:**\n- Add delivery instructions\n- Include gift messages\n- Add special handling notes\n- Store customer preferences for this order\n\n**Important Notes:**\n- Only works on QUEUED billing attempts\n- Note is included in the Shopify order when created\n- Can be updated multiple times before order is processed\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "updateOrderNoteV2_1",
        "parameters": [
          {
            "description": "Billing Attempt ID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Updated Order Note",
            "in": "query",
            "name": "orderNote",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            },
            "description": "Order note successfully updated"
          },
          "400": {
            "content": {
              "*/*": {
                "schema": {
                  "type": "boolean"
                }
              }
            },
            "description": "Invalid billing attempt ID"
          },
          "401": {
            "content": {
              "*/*": {
                "schema": {
                  "type": "boolean"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "*/*": {
                "schema": {
                  "type": "boolean"
                }
              }
            },
            "description": "Insufficient permissions"
          }
        },
        "summary": "Update order note for a billing attempt",
        "tags": [
          "Billing & Payments"
        ]
      }
    },
    "/api/external/v2/subscription-billing-attempts/attempt-billing/{id}": {
      "put": {
        "description": "Queues a billing attempt for immediate processing, bypassing the scheduled billing date.\n\n**Asynchronous processing:**\n- A successful response means the billing attempt was accepted and processing has started; it does not contain the payment result\n- The charge is sent to Shopify shortly after the call and the result is reported asynchronously\n- Use `billingAttemptId` from the response to track the result; it can differ from the requested ID depending on shop settings\n\n**Tracking the result:**\n- Webhooks: `subscription.billing-success` or `subscription.billing-failure`\n- Polling: `GET /api/external/v2/subscription-billing-attempts/past-orders?contractId={contractId}` and check the attempt `status`:\n  - `IMMEDIATE_TRIGGERED` / `PROGRESS`: still processing\n  - `SECURITY_CHALLENGE`: the card issuer requires 3D Secure; no webhook is sent for this state\n  - `SUCCESS` / `FAILURE`: final result\n\n**Important Notes:**\n- Requires shop permission 'enableImmediatePlaceOrder'\n- Creates an actual order in Shopify and charges the customer's payment method\n- Cannot be undone once processed\n\n**Authentication:** Requires valid X-API-Key header and shop permission",
        "operationId": "attemptBillingV2",
        "parameters": [
          {
            "description": "Billing Attempt ID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "billingAttemptId": 123456,
                  "billingDate": "2026-09-26T10:15:30Z",
                  "contractId": 987654321,
                  "message": "Billing attempt has been queued for immediate processing. The payment result is not included in this response. Track it via the subscription.billing-success / subscription.billing-failure webhooks, or poll GET /api/external/v2/subscription-billing-attempts/past-orders?contractId={contractId} using the returned billingAttemptId.",
                  "requestedBillingAttemptId": 123456,
                  "status": "IMMEDIATE_TRIGGERED"
                },
                "schema": {
                  "$ref": "#/components/schemas/AttemptBillingResponseDTO"
                }
              }
            },
            "description": "Billing attempt accepted and queued for immediate processing"
          },
          "400": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/AttemptBillingResponseDTO"
                }
              }
            },
            "description": "Cannot process billing - invalid status, contract not active, out of stock, or an order is already in progress"
          },
          "401": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/AttemptBillingResponseDTO"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Shop does not have enableImmediatePlaceOrder permission",
                  "status": 403,
                  "title": "Permission denied",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Shop does not have permission to place immediate orders"
          }
        },
        "summary": "Trigger immediate billing for an order",
        "tags": [
          "Billing & Payments"
        ]
      }
    },
    "/api/external/v2/subscription-billing-attempts/past-orders": {
      "get": {
        "description": "Retrieves paginated list of past (processed) billing attempts for the whole shop, a subscription contract, or a customer. Includes successful orders, failed attempts, and skipped orders. Upcoming (QUEUED) orders are not included.\n\n**Initial (checkout) orders are not included.** The order the customer placed at checkout that created the subscription is not a billing attempt, so a shop or contract with no renewals yet returns an empty list. Get initial orders from `GET /api/external/v2/subscription-contract-details` (fields `orderId`, `orderName`, `orderAmount`, `createdAt`), filtering by `fromCreatedDate` / `toCreatedDate` for incremental syncs.\n\n**Filter Options:**\n- No filter: Get past orders across all subscription contracts of the shop (use this for bulk sync / data pipelines instead of calling once per contract)\n- By contract ID: Get order history for specific subscription\n- By customer ID: Get all orders across all customer subscriptions\n- If both `contractId` and `customerId` are passed, `contractId` takes precedence\n\n**Pagination:**\n- Query parameters: `page` (zero-based, default 0), `size` (default 20, recommended max 250)\n- Results are sorted by attempt time (or billing date when not yet attempted), newest first\n- Response headers: `X-Total-Count` (total number of records) and `Link` (next/prev/first/last page URLs)\n- Keep requesting the next page until the response is an empty array or `page` reaches the last page\n\n**Example (all past orders of the shop):**\n`GET /api/external/v2/subscription-billing-attempts/past-orders?page=0&size=250`\n\n**Notes:**\n- New orders created while paging shift results between pages; de-duplicate on `id`, or use the past orders report endpoint with a fixed `toDay` for a stable window\n- Line items (`variantList`) are served from cached Shopify order data. For orders not yet cached the list may be empty on the first request and is populated on subsequent requests\n\n**Order Information:**\n- Billing attempt status (SUCCESS, FAILED, SKIPPED)\n- Shopify order ID for successful attempts\n- Billing date and processing date\n- Order total and line items\n- Error messages for failed attempts\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "getPastOrdersV2",
        "parameters": [
          {
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Subscription contract ID. Omit (along with customerId) to get past orders of all contracts in the shop",
            "in": "query",
            "name": "contractId",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "Shopify customer ID. Omit (along with contractId) to get past orders of all contracts in the shop",
            "in": "query",
            "name": "customerId",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "Pagination parameters (page number and size)",
            "example": {
              "page": 0,
              "size": 5,
              "sort": [
                "id,desc"
              ]
            },
            "in": "query",
            "name": "pageable",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Pageable"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/SubscriptionBillingAttemptDTO"
                  },
                  "type": "array"
                }
              }
            },
            "description": "Successfully retrieved past orders"
          },
          "400": {
            "content": {
              "*/*": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/SubscriptionBillingAttemptDTO"
                  },
                  "type": "array"
                }
              }
            },
            "description": "Invalid parameters"
          },
          "401": {
            "content": {
              "*/*": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/SubscriptionBillingAttemptDTO"
                  },
                  "type": "array"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "*/*": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/SubscriptionBillingAttemptDTO"
                  },
                  "type": "array"
                }
              }
            },
            "description": "Insufficient permissions"
          }
        },
        "summary": "Get past orders",
        "tags": [
          "Billing & Payments"
        ]
      }
    },
    "/api/external/v2/subscription-billing-attempts/past-orders/report": {
      "get": {
        "description": "Retrieves a detailed report of past billing attempts across all subscription contracts of the shop, with advanced filtering options. This endpoint provides comprehensive data for analytics, troubleshooting, reporting and data warehouse syncs.\n\n**Initial (checkout) orders are not included.** Only renewal billing attempts are reported. Get the order that created each subscription from `GET /api/external/v2/subscription-contract-details` (fields `orderId`, `orderName`, `orderAmount`, `createdAt`, filterable by `fromCreatedDate` / `toCreatedDate`).\n\n**Filter Options:**\n- By status (required): SUCCESS, FAILURE, SKIPPED, SKIPPED_DUNNING_MGMT, SKIPPED_INVENTORY_MGMT, SECURITY_CHALLENGE, QUEUED (QUEUED returns upcoming orders)\n- By date range: `fromDay` / `toDay` in ISO-8601 format (e.g. `2026-01-01T00:00:00Z`), matched against the attempt time (or billing date when not yet attempted)\n- By attempt count: Filter by number of retry attempts\n- By contract status: Filter by subscription contract status\n- By contract ID (optional): Get report for specific subscription. Omit it to get the report for the whole shop\n\n**Pagination:**\n- Query parameters: `page` (zero-based, default 0), `size` (default 20, recommended max 250), `sort` (default newest first)\n- Response headers: `X-Total-Count` (total number of records) and `Link` (next/prev/first/last page URLs)\n\n**Bulk / incremental sync:**\n- Initial backfill: page through `status=SUCCESS` without a date range\n- Incremental sync: page through `status=SUCCESS&fromDay=<last sync time>&toDay=<now>`. A fixed `toDay` keeps pages stable while new orders are being created\n\n**Example:**\n`GET /api/external/v2/subscription-billing-attempts/past-orders/report?status=SUCCESS&fromDay=2026-01-01T00:00:00Z&toDay=2026-02-01T00:00:00Z&page=0&size=250`\n\n**Response Includes:**\n- Detailed billing attempt information\n- Shopify exception details for failed attempts (optional)\n- Retry attempt count\n- Processing timestamps\n- Order totals and line items\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "getPastOrdersReport",
        "parameters": [
          {
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Filter by subscription contract ID. Omit to get the report for all contracts in the shop",
            "in": "query",
            "name": "contractId",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "Filter by billing attempt status, e.g. SUCCESS, FAILURE, SKIPPED",
            "in": "query",
            "name": "status",
            "required": true,
            "schema": {
              "enum": [
                "SUCCESS",
                "FAILURE",
                "REQUESTING",
                "PROGRESS",
                "QUEUED",
                "SKIPPED",
                "SOCIAL_CONNECTION_NULL",
                "CONTRACT_CANCELLED",
                "CONTRACT_ENDED",
                "CONTRACT_PAUSED",
                "AUTO_CHARGE_DISABLED",
                "SHOPIFY_EXCEPTION",
                "SKIPPED_DUNNING_MGMT",
                "SKIPPED_INVENTORY_MGMT",
                "IMMEDIATE_TRIGGERED",
                "SECURITY_CHALLENGE",
                "CONTRACT_PAUSED_MAX_CYCLES",
                "REFUNDED",
                "SKIPPED_DEMO_SHOP",
                "SKIPPED_SHOP_INFO_NOT_FOUND",
                "SKIPPED_BILLING_DATE_STALE",
                "SKIPPED_DUNNING_NOT_CONFIGURED",
                "PENDING_CONSOLIDATION"
              ],
              "type": "string"
            }
          },
          {
            "description": "Include Shopify Exception in case of Failure",
            "in": "query",
            "name": "includeShopifyException",
            "required": false,
            "schema": {
              "default": false,
              "type": "boolean"
            }
          },
          {
            "description": "Filter date range from (ISO-8601, e.g. 2026-01-01T00:00:00Z)",
            "in": "query",
            "name": "fromDay",
            "required": false,
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "description": "Filter date range to (ISO-8601, e.g. 2026-02-01T00:00:00Z)",
            "in": "query",
            "name": "toDay",
            "required": false,
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "description": "Filter by retry attempts",
            "in": "query",
            "name": "attemptCount",
            "required": false,
            "schema": {
              "format": "int32",
              "type": "integer"
            }
          },
          {
            "description": "Filter by Contract Status",
            "in": "query",
            "name": "contractStatus",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Pagination parameters (page number and size)",
            "example": {
              "page": 0,
              "size": 5,
              "sort": [
                "id,desc"
              ]
            },
            "in": "query",
            "name": "pageable",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Pageable"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "*/*": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/SubscriptionBillingAttemptDetails"
                  },
                  "type": "array"
                }
              }
            },
            "description": "Successfully retrieved report"
          },
          "400": {
            "content": {
              "*/*": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/SubscriptionBillingAttemptDetails"
                  },
                  "type": "array"
                }
              }
            },
            "description": "Invalid filter parameters"
          },
          "401": {
            "content": {
              "*/*": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/SubscriptionBillingAttemptDetails"
                  },
                  "type": "array"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "*/*": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/SubscriptionBillingAttemptDetails"
                  },
                  "type": "array"
                }
              }
            },
            "description": "Insufficient permissions"
          }
        },
        "summary": "Get past orders report with detailed filtering",
        "tags": [
          "Billing & Payments"
        ]
      }
    },
    "/api/external/v2/subscription-billing-attempts/reschedule-order/{id}": {
      "put": {
        "description": "Changes the scheduled billing date for a billing attempt. This allows customers to adjust when their next order will be processed.\n\n**Rescheduling Options:**\n- Move to earlier date (if allowed by shop settings)\n- Move to later date\n- Optionally reschedule all future orders by the same offset\n\n**Important Behaviors:**\n- Only QUEUED billing attempts can be rescheduled\n- New date must be in the future\n- Can affect future billing schedule if rescheduleFutureOrder is true\n- Activity logs are created for audit trail\n\n**Use Cases:**\n- Customer wants to delay next delivery\n- Customer wants to receive order earlier\n- Adjust delivery schedule to align with customer needs\n- Coordinate deliveries with customer vacation/travel\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "rescheduleOrderV2",
        "parameters": [
          {
            "description": "Billing Attempt ID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "rescheduleFutureOrder",
            "required": false,
            "schema": {
              "default": false,
              "type": "boolean"
            }
          },
          {
            "description": "New Billing Date",
            "in": "query",
            "name": "billingDate",
            "required": true,
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionBillingAttemptDTO"
                }
              }
            },
            "description": "Order successfully rescheduled"
          },
          "400": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "New billing date must be in the future",
                  "status": 400,
                  "title": "Invalid reschedule date",
                  "type": "https://example.com/errors/bad-request"
                }
              }
            },
            "description": "Invalid date or cannot reschedule"
          },
          "401": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionBillingAttemptDTO"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionBillingAttemptDTO"
                }
              }
            },
            "description": "Insufficient permissions"
          }
        },
        "summary": "Reschedule a billing attempt to a new date",
        "tags": [
          "Billing & Payments"
        ]
      }
    },
    "/api/external/v2/subscription-billing-attempts/skip-order/{id}": {
      "put": {
        "description": "Skips a specific billing attempt by ID. The order will not be processed on its scheduled date. This is useful when customers want to skip a particular delivery without canceling their subscription.\n\n**Important Behaviors:**\n- Only QUEUED billing attempts can be skipped\n- Skipped orders remain in the system with SKIPPED status\n- Future orders are not affected\n- Can be unskipped before the scheduled date if needed\n- Activity logs are created for audit trail\n\n**Use Cases:**\n- Customer is on vacation\n- Customer has excess inventory\n- Temporary delivery pause for one cycle\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "skipOrderV2",
        "parameters": [
          {
            "description": "Billing Attempt ID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Subscription Contract ID",
            "in": "query",
            "name": "subscriptionContractId",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "Is this contract Prepaid?",
            "in": "query",
            "name": "isPrepaid",
            "required": false,
            "schema": {
              "default": false,
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionBillingAttemptDTO"
                }
              }
            },
            "description": "Order successfully skipped"
          },
          "400": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Billing attempt is not in QUEUED status",
                  "status": 400,
                  "title": "Cannot skip order",
                  "type": "https://example.com/errors/bad-request"
                }
              }
            },
            "description": "Cannot skip order - already processed or invalid status"
          },
          "401": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionBillingAttemptDTO"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionBillingAttemptDTO"
                }
              }
            },
            "description": "Insufficient permissions"
          }
        },
        "summary": "Skip a specific order",
        "tags": [
          "Billing & Payments"
        ]
      }
    },
    "/api/external/v2/subscription-billing-attempts/skip-upcoming-order": {
      "put": {
        "description": "Skips the next scheduled billing attempt for a subscription contract without requiring the billing attempt ID. Automatically finds and skips the earliest QUEUED billing attempt.\n\n**Convenience Feature:**\n- No need to know the specific billing attempt ID\n- Automatically finds the next order\n- Ideal for \"skip next order\" functionality in customer portals\n\n**Use Cases:**\n- Simple \"skip next delivery\" button in customer portal\n- Quick skip without looking up billing attempt details\n- One-click skip functionality\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "skipFirstUpcomingOrderV2",
        "parameters": [
          {
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Subscription Contract ID",
            "in": "query",
            "name": "subscriptionContractId",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionBillingAttemptDTO"
                }
              }
            },
            "description": "Next order successfully skipped"
          },
          "400": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "No queued billing attempts found for this subscription",
                  "status": 400,
                  "title": "No upcoming orders",
                  "type": "https://example.com/errors/bad-request"
                }
              }
            },
            "description": "No queued billing attempts found"
          },
          "401": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionBillingAttemptDTO"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionBillingAttemptDTO"
                }
              }
            },
            "description": "Insufficient permissions"
          }
        },
        "summary": "Skip the next upcoming order for a subscription",
        "tags": [
          "Billing & Payments"
        ]
      }
    },
    "/api/external/v2/subscription-billing-attempts/top-orders": {
      "get": {
        "description": "Retrieves upcoming (queued) billing attempts for a subscription contract or customer. Returns the next scheduled orders that have not yet been processed.\n\n**Query Options:**\n- Filter by contract ID to see upcoming orders for a specific subscription\n- Filter by customer ID to see all upcoming orders for a customer\n- Results are ordered by billing date (earliest first)\n\n**Use Cases:**\n- Display \"Your Next Order\" in customer portal\n- Show upcoming delivery schedule\n- Calculate upcoming charges\n- Preview next order contents\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "getTopOrdersV2",
        "parameters": [
          {
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Contract ID",
            "in": "query",
            "name": "contractId",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "Customer ID",
            "in": "query",
            "name": "customerId",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/SubscriptionBillingAttemptDTO"
                  },
                  "type": "array"
                }
              }
            },
            "description": "Successfully retrieved upcoming orders"
          },
          "400": {
            "content": {
              "*/*": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/SubscriptionBillingAttemptDTO"
                  },
                  "type": "array"
                }
              }
            },
            "description": "Invalid contract or customer ID"
          },
          "401": {
            "content": {
              "*/*": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/SubscriptionBillingAttemptDTO"
                  },
                  "type": "array"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "*/*": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/SubscriptionBillingAttemptDTO"
                  },
                  "type": "array"
                }
              }
            },
            "description": "Insufficient permissions"
          }
        },
        "summary": "Get upcoming orders (top orders)",
        "tags": [
          "Billing & Payments"
        ]
      }
    },
    "/api/external/v2/subscription-billing-attempts/unskip-order/{id}": {
      "put": {
        "description": "Reverses a skip action on a billing attempt. The order will be restored to QUEUED status and will be processed on its scheduled date.\n\n**Important Notes:**\n- Only works on billing attempts with SKIPPED status\n- Must be done before the scheduled billing date\n- Cannot unskip after the billing date has passed\n- Activity logs are created for audit trail\n\n**Use Cases:**\n- Customer changes their mind about skipping\n- Correct accidental skip actions\n- Restore delivery after resolving temporary issue\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "unSkipOrderV2",
        "parameters": [
          {
            "description": "Billing Attempt ID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Subscription Contract ID",
            "in": "query",
            "name": "subscriptionContractId",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionBillingAttemptDTO"
                }
              }
            },
            "description": "Order successfully unskipped"
          },
          "400": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionBillingAttemptDTO"
                }
              }
            },
            "description": "Cannot unskip - not in SKIPPED status or date passed"
          },
          "401": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionBillingAttemptDTO"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionBillingAttemptDTO"
                }
              }
            },
            "description": "Insufficient permissions"
          }
        },
        "summary": "Unskip a previously skipped order",
        "tags": [
          "Billing & Payments"
        ]
      }
    },
    "/api/external/v2/subscription-bundle-settings/{id}": {
      "get": {
        "description": "Retrieves the configuration settings for subscription bundles (also known as Build-a-Box or customizable subscription boxes). This endpoint returns all settings that control how customers can create and manage their custom subscription bundles.\n\n**What are Subscription Bundles (Build-a-Box)?**\nSubscription bundles allow customers to create personalized subscription boxes by selecting multiple products from a curated collection. Instead of subscribing to a fixed product, customers build their own custom bundle that gets delivered on a recurring basis. This is perfect for coffee subscriptions, snack boxes, beauty boxes, supplement packs, and any product category where variety and personalization drive customer satisfaction.\n\n**Bundle Configuration Settings:**\n\n**1. Product Selection Rules:**\n- Minimum number of products required in bundle\n- Maximum number of products allowed in bundle\n- Product categories available for selection\n- Variant selection constraints\n- Quantity limits per product\n- Total bundle value constraints (min/max price)\n\n**2. Bundle Behavior:**\n- Allow customers to modify bundle between orders\n- Lock bundle after first order\n- Enable automatic product rotation\n- Allow quantity adjustments\n- Substitution rules when products unavailable\n\n**3. Pricing & Discounts:**\n- Bundle pricing model (fixed price vs. sum of products)\n- Volume discounts based on bundle size\n- Tiered pricing structures\n- Promotional pricing for bundles\n- Discount application rules\n\n**4. UI/UX Settings:**\n- Bundle builder interface layout\n- Product display format (grid/list)\n- Images and descriptions shown\n- Filter and search options\n- Preview and summary display\n- Mobile responsiveness settings\n\n**5. Fulfillment Options:**\n- Bundling method (ship together vs. separate)\n- Packaging preferences\n- Custom box selection\n- Gift message options\n- Delivery instructions\n\n**6. Customer Experience:**\n- Welcome flow for new bundle subscribers\n- Modification window before each order\n- Reminder notifications to update bundle\n- Recommendation engine settings\n- Save favorite bundle configurations\n\n**Common Bundle Types:**\n\n**Coffee Subscription Bundle:**\n- Select 3-5 coffee varieties per month\n- Choose roast levels, origins, or flavors\n- Option to rotate selections monthly\n- Fixed price regardless of selection\n\n**Snack Box Bundle:**\n- Choose 10 items from 50+ snacks\n- Category limits (e.g., max 3 sweet, 7 savory)\n- Dietary restriction filters (vegan, gluten-free)\n- Tiered pricing based on bundle size\n\n**Beauty Box Bundle:**\n- Select products from skincare, makeup, haircare categories\n- Minimum 5 products, maximum 8 products\n- Total value must be between $40-$100\n- Can swap 2 products each month\n\n**Vitamin/Supplement Bundle:**\n- Build personalized supplement pack\n- Health goal-based recommendations\n- Compatibility checking (ingredient interactions)\n- Fixed monthly price for up to 5 supplements\n\n**Use Cases:**\n- Configure bundle builder in customer portal\n- Validate customer bundle selections against rules\n- Display bundle configuration options during signup\n- Integrate with checkout to show bundle pricing\n- Build custom bundle management interfaces\n- Sync bundle settings with mobile apps\n- Generate bundle recommendation algorithms\n\n**Important Notes:**\n- Settings apply to all subscription bundles in the shop\n- Changes affect new bundles immediately\n- Existing bundles maintain their original configuration unless migrated\n- Product availability is checked in real-time during bundle creation\n- Bundle modifications may have cutoff times before order processing\n\n**Best Practices:**\n- Set reasonable min/max limits to balance choice and complexity\n- Provide clear guidance on bundle building process\n- Use category limits to ensure variety\n- Enable modification windows to boost engagement\n- Offer curated bundle templates as starting points\n- Implement substitution logic for out-of-stock items\n- Test bundle builder UX across devices\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "getSubscriptionBundleSettingsV2",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "allowModifications": true,
                      "categoryLimits": {
                        "coffee-dark-roast": {
                          "max": 3,
                          "min": 0
                        },
                        "coffee-decaf": {
                          "max": 2,
                          "min": 0
                        },
                        "coffee-flavored": {
                          "max": 2,
                          "min": 0
                        },
                        "coffee-light-roast": {
                          "max": 3,
                          "min": 0
                        },
                        "coffee-medium-roast": {
                          "max": 3,
                          "min": 0
                        }
                      },
                      "createdAt": "2024-01-15T10:30:00Z",
                      "discounts": {
                        "enableVolumeDiscounts": true,
                        "volumeDiscountTiers": [
                          {
                            "discountPercent": 10,
                            "minProducts": 5
                          },
                          {
                            "discountPercent": 15,
                            "minProducts": 7
                          }
                        ]
                      },
                      "displaySettings": {
                        "enableFiltering": true,
                        "enableSearch": true,
                        "layoutType": "GRID",
                        "productsPerRow": 3,
                        "showBundlePreview": true,
                        "showPricing": false,
                        "showProductDescriptions": true,
                        "showProductImages": true
                      },
                      "enableProductRotation": true,
                      "enabled": true,
                      "fixedBundlePrice": 59.99,
                      "id": 12345,
                      "lockAfterFirstOrder": false,
                      "maxBundleValue": 100.0,
                      "maxProducts": 8,
                      "maxSwapsPerCycle": 2,
                      "minBundleValue": 40.0,
                      "minProducts": 3,
                      "modificationCutoffDays": 5,
                      "notifications": {
                        "reminderDaysBeforeOrder": 7,
                        "sendBundleCreatedEmail": true,
                        "sendBundleModifiedConfirmation": true,
                        "sendModificationReminderEmail": true
                      },
                      "pricingModel": "FIXED_PRICE",
                      "recommendations": {
                        "enableRecommendations": true,
                        "recommendationStrategy": "POPULAR_AND_PERSONALIZED",
                        "showBestSellers": true,
                        "showCuratedBundles": true
                      },
                      "requireCategoryDiversity": true,
                      "shop": "example-shop.myshopify.com",
                      "substitution": {
                        "allowCustomerToApproveSubstitutions": false,
                        "allowSubstitutions": true,
                        "notifyCustomerOfSubstitutions": true,
                        "substitutionMethod": "SIMILAR_PRODUCT"
                      },
                      "updatedAt": "2024-02-20T14:45:00Z"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionBundleSettingsDTO"
                }
              }
            },
            "description": "Bundle settings successfully retrieved"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header is required",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to view bundle settings",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to view bundle settings"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Subscription bundle settings have not been configured for this shop",
                  "status": 404,
                  "title": "Settings not found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Bundle settings not found - Bundle feature may not be enabled"
          }
        },
        "summary": "Get subscription bundle settings (Build-a-Box configuration)",
        "tags": [
          "Build-a-Box & Bundles"
        ]
      }
    },
    "/api/external/v2/subscription-bundling/update": {
      "put": {
        "description": "Updates the configuration for one or more subscription bundles (Build-a-Box). This endpoint allows bulk updates to bundle product selections, quantities, and configurations.\n\n**Subscription Bundling/Build-a-Box:**\nSubscription bundling allows customers to create custom product bundles that are delivered on a recurring basis. Customers can select multiple products to be included in each delivery, creating a personalized subscription box.\n\n**Update Capabilities:**\n- Modify product selections within a bundle\n- Update product quantities\n- Change bundle configuration settings\n- Bulk update multiple bundles at once\n\n**Use Cases:**\n- Customer updates their bundle product selections\n- Swap products in an existing bundle\n- Adjust quantities for products in the bundle\n- Programmatically manage bundle configurations\n\n**Important Notes:**\n- Updates are identified by bundle handle (unique identifier)\n- Only active bundles can be updated\n- Product availability is validated before update\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "getUpdateSubscriptionBundling",
        "parameters": [
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "items": {
                  "$ref": "#/components/schemas/BuildABoxUpdate"
                },
                "type": "array"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "active": true,
                      "bundleHandle": "custom-coffee-bundle-123",
                      "bundleName": "My Custom Coffee Bundle",
                      "frequency": "MONTH",
                      "frequencyCount": 1,
                      "id": 12345,
                      "products": [
                        {
                          "productTitle": "Medium Roast Coffee",
                          "quantity": 2,
                          "variantId": 11111
                        },
                        {
                          "productTitle": "Dark Roast Coffee",
                          "quantity": 1,
                          "variantId": 22222
                        }
                      ],
                      "shop": "example-shop.myshopify.com",
                      "token": "abc123xyz"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionBundlingDTO"
                }
              }
            },
            "description": "Subscription bundling successfully updated"
          },
          "400": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "One or more products in the bundle are not available",
                  "status": 400,
                  "title": "Invalid bundle configuration",
                  "type": "https://example.com/errors/bad-request"
                }
              }
            },
            "description": "Invalid bundle handle or product configuration"
          },
          "401": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionBundlingDTO"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionBundlingDTO"
                }
              }
            },
            "description": "Insufficient permissions"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "No bundle found with the specified handle",
                  "status": 404,
                  "title": "Bundle not found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Bundle not found"
          }
        },
        "summary": "Update subscription bundling configuration",
        "tags": [
          "Build-a-Box & Bundles"
        ]
      }
    },
    "/api/external/v2/subscription-bundlings/discount/{token}": {
      "put": {
        "description": "Generates a discount code for a subscription bundle. This endpoint creates a Shopify discount code that can be applied to bundle subscriptions, typically used during the checkout process.\n\n**Discount Code Generation:**\n- Creates a unique discount code in Shopify\n- Associates the discount with the bundle\n- Configures discount rules and limitations\n- Sets expiration dates if specified\n- Applies usage limits if configured\n\n**Discount Configuration Options:**\n- Discount type (percentage, fixed amount, or free shipping)\n- Discount value/amount\n- Minimum purchase requirements\n- Maximum usage count\n- Expiration date\n- Customer eligibility rules\n\n**Use Cases:**\n- Promotional campaigns for bundles\n- Welcome discounts for new subscribers\n- Loyalty rewards for existing customers\n- Special offers and limited-time promotions\n- Partner/affiliate discount codes\n\n**Important Notes:**\n- Discount codes are created in Shopify and follow Shopify's discount rules\n- Codes can be single-use or multi-use depending on configuration\n- Expired or depleted codes cannot be reused\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "generateDiscountV2",
        "parameters": [
          {
            "description": "Token",
            "in": "path",
            "name": "token",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DiscountCodeRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "active": true,
                      "currentUsageCount": 0,
                      "discountCode": "BUNDLE10",
                      "discountId": "gid://shopify/DiscountCodeNode/123456",
                      "discountType": "PERCENTAGE",
                      "discountValue": 10.0,
                      "expiresAt": "2024-12-31T23:59:59Z",
                      "usageLimit": 100
                    }
                  }
                }
              }
            },
            "description": "Discount code successfully generated"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Invalid Discount Config": {
                    "description": "Invalid Discount Config",
                    "value": {
                      "detail": "Discount value must be greater than 0",
                      "status": 400,
                      "title": "Invalid discount configuration",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Token": {
                    "description": "Invalid Token",
                    "value": {
                      "detail": "No bundle found for the specified token",
                      "status": 400,
                      "title": "Invalid bundle token",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid discount configuration or bundle token"
          },
          "401": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/DiscountCodeResponse"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/DiscountCodeResponse"
                }
              }
            },
            "description": "Insufficient permissions"
          },
          "422": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Unable to create discount code in Shopify API",
                  "status": 422,
                  "title": "Shopify discount creation failed",
                  "type": "https://example.com/errors/unprocessable-entity"
                }
              }
            },
            "description": "Unable to create discount in Shopify"
          }
        },
        "summary": "Generate discount code for bundle",
        "tags": [
          "Build-a-Box & Bundles"
        ]
      }
    },
    "/api/external/v2/subscription-bundlings/external/get-bundle/{handle}": {
      "get": {
        "description": "Retrieves complete details for a subscription bundle using its unique handle. This endpoint returns the bundle configuration, included products, pricing, and available subscription options.\n\n**Bundle Information Returned:**\n- Bundle name and description\n- Product selections with quantities\n- Pricing and discounts\n- Available subscription frequencies\n- Bundle status and availability\n- Product images and details\n\n**Use Cases:**\n- Display bundle details on product pages\n- Show bundle contents in customer portal\n- Fetch bundle configuration for cart/checkout\n- Integration with external systems\n- Build custom bundle selection interfaces\n\n**Bundle Handle:**\nThe handle is a unique, URL-friendly identifier for the bundle. It's typically generated when the bundle is created and remains constant throughout the bundle's lifecycle.\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "getValidSubscriptionCustomerV2_1",
        "parameters": [
          {
            "description": "Customer Handle",
            "in": "path",
            "name": "handle",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "bundle": {
                        "currencyCode": "USD",
                        "description": "Choose your favorite coffee blends",
                        "handle": "premium-coffee-bundle",
                        "id": 12345,
                        "maxProducts": 5,
                        "minProducts": 2,
                        "name": "Premium Coffee Bundle",
                        "totalPrice": "49.99"
                      },
                      "products": [
                        {
                          "available": true,
                          "image": "https://cdn.shopify.com/image.jpg",
                          "price": "14.99",
                          "productId": 99999,
                          "title": "Medium Roast Coffee",
                          "variantId": 11111
                        }
                      ],
                      "subscriptions": [
                        {
                          "discount": 10.0,
                          "discountType": "PERCENTAGE",
                          "frequency": "MONTH",
                          "frequencyCount": 1,
                          "frequencyName": "Monthly Delivery"
                        },
                        {
                          "discount": 15.0,
                          "discountType": "PERCENTAGE",
                          "frequency": "WEEK",
                          "frequencyCount": 2,
                          "frequencyName": "Bi-Weekly Delivery"
                        }
                      ]
                    }
                  }
                }
              }
            },
            "description": "Bundle details successfully retrieved"
          },
          "401": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionBundlingResponse"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionBundlingResponse"
                }
              }
            },
            "description": "Insufficient permissions"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "No bundle exists with handle: premium-coffee-bundle",
                  "status": 404,
                  "title": "Bundle not found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Bundle not found or no subscriptions available"
          }
        },
        "summary": "Get bundle details by handle",
        "tags": [
          "Build-a-Box & Bundles"
        ]
      }
    },
    "/api/external/v2/subscription-contract-add-line-item": {
      "put": {
        "description": "Adds a new product line item with a custom price override to an existing subscription contract. This endpoint bypasses standard pricing and selling plans to set an exact price.\n\n**Key Features:**\n- Direct price control - set any price regardless of product pricing\n- Optional automatic discount application based on shop settings\n- No selling plan assignment - pure custom pricing\n- Supports both recurring and one-time products\n- Email notifications sent to customers\n- Activity logging for audit trails\n\n**Custom Pricing Behavior:**\n- Price is set exactly as provided (no calculations)\n- Overrides any product-level pricing\n- Not affected by currency or country\n- No automatic discounts from selling plans\n- Price remains fixed unless manually updated\n\n**Shop-Level Discount Application:**\nDespite the method name, this endpoint MAY apply discounts:\n- Checks shop setting: 'applySubscriptionDiscount'\n- If enabled, applies shop's default subscription discount\n- Discount type: PERCENTAGE or FIXED (per shop config)\n- Creates manual discount: 'PRODUCT_DISCOUNT_[lineId]'\n- Discount is additional to the custom price\n\n**Common Use Cases:**\n- **Negotiated Pricing**: Custom rates for specific customers\n- **Price Matching**: Match competitor pricing\n- **Promotional Pricing**: Special one-off prices\n- **Bundle Pricing**: Custom prices for package deals\n- **Legacy Pricing**: Honor old pricing agreements\n- **Test Orders**: Zero or nominal pricing for testing\n\n**Differences from Standard Add:**\n- No selling plan association\n- No pricing policy rules\n- No automatic tier discounts\n- Price doesn't adjust with frequency changes\n- Manual price management required\n\n**One-Time Products:**\nWhen `isOneTimeProduct=true`:\n- Product appears only in next order\n- Removed automatically after the next order bills successfully\n- Custom price applies to that single order\n- Shop discount still applies if configured\n\n**Price Validation:**\n- Must be a positive number\n- No maximum limit enforced\n- Can be less than product cost (loss leader)\n- Currency matches shop's base currency\n- Decimal precision per currency rules\n\n**Important Considerations:**\n- No automatic price updates with product changes\n- Frequency changes don't affect pricing\n- May bypass minimum order values\n- Consider margin implications\n- Document reason for custom pricing\n\n**Post-Addition Effects:**\n- Customer receives product addition email\n- Activity log records custom price\n- Shipping may need recalculation\n- Order total updates immediately\n- No impact on other line items\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "addLineItemV2_1",
        "parameters": [
          {
            "description": "Subscription contract ID to add product to",
            "example": 123456789,
            "in": "query",
            "name": "contractId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "deprecated": true,
            "description": "API Key (Deprecated - Use X-API-Key header instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key for authentication",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Quantity of product to add",
            "example": 1,
            "in": "query",
            "name": "quantity",
            "required": true,
            "schema": {
              "format": "int32",
              "type": "integer"
            }
          },
          {
            "description": "Shopify variant ID of the product to add",
            "example": 42549172011164,
            "in": "query",
            "name": "variantId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Custom price for the product (in store currency). This exact price will be charged regardless of the product's normal price, selling plans, or frequency. If the shop has 'applySubscriptionDiscount' enabled, an additional discount may be applied on top of this price.",
            "example": 19.99,
            "in": "query",
            "name": "price",
            "required": true,
            "schema": {
              "format": "double",
              "maximum": 999999.99,
              "minimum": 0.01,
              "type": "number"
            }
          },
          {
            "description": "When true, product will only be included in the next order; when false, in all future orders",
            "example": false,
            "in": "query",
            "name": "isOneTimeProduct",
            "required": false,
            "schema": {
              "default": false,
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "customer": {
                        "email": "customer@example.com",
                        "id": "gid://shopify/Customer/987654321"
                      },
                      "id": "gid://shopify/SubscriptionContract/123456789",
                      "lines": {
                        "edges": [
                          {
                            "node": {
                              "currentPrice": {
                                "amount": "29.99",
                                "currencyCode": "USD"
                              },
                              "id": "gid://shopify/SubscriptionLine/111111",
                              "quantity": 1,
                              "sellingPlanId": null,
                              "sellingPlanName": null,
                              "title": "Premium Coffee - Dark Roast",
                              "variantId": "gid://shopify/ProductVariant/42549172011164"
                            }
                          },
                          {
                            "node": {
                              "currentPrice": {
                                "amount": "19.99",
                                "currencyCode": "USD"
                              },
                              "discountAllocations": [
                                {
                                  "discount": {
                                    "__typename": "SubscriptionManualDiscount",
                                    "id": "gid://shopify/SubscriptionManualDiscount/333333",
                                    "title": "PRODUCT_DISCOUNT_222222",
                                    "type": "MANUAL",
                                    "value": {
                                      "percentage": 10.0
                                    }
                                  }
                                }
                              ],
                              "id": "gid://shopify/SubscriptionLine/222222",
                              "quantity": 1,
                              "sellingPlanId": null,
                              "sellingPlanName": null,
                              "title": "Special Edition Box",
                              "variantId": "gid://shopify/ProductVariant/98765432101"
                            }
                          }
                        ]
                      },
                      "nextBillingDate": "2024-04-01T00:00:00Z",
                      "status": "ACTIVE"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Product successfully added to subscription with custom price"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Contract Not Found": {
                    "description": "Contract Not Found",
                    "value": {
                      "detail": "No subscription contract found with ID 123456789",
                      "status": 400,
                      "title": "Contract does not exist",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Price": {
                    "description": "Invalid Price",
                    "value": {
                      "detail": "Price must be a positive number",
                      "status": 400,
                      "title": "Invalid price value",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Quantity": {
                    "description": "Invalid Quantity",
                    "value": {
                      "detail": "Invalid quantity value provided",
                      "status": 400,
                      "title": "UserGeneratedError:Quantity must be greater than 0",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Product Not Found": {
                    "description": "Product Not Found",
                    "value": {
                      "detail": "The specified product variant does not exist",
                      "status": 400,
                      "title": "Product Variant not found for ID: 99999999999",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid contract ID, variant ID, quantity, or price"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid API key is required to access this endpoint",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to modify subscription contracts",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to modify subscription"
          },
          "404": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Subscription contract not found"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "Discount Application Failed": {
                    "description": "Discount Application Failed",
                    "value": {
                      "detail": "Shop's subscription discount could not be applied to the custom-priced item",
                      "status": 422,
                      "title": "UserGeneratedError:Unable to apply shop discount",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  },
                  "Draft Creation Failed": {
                    "description": "Draft Creation Failed",
                    "value": {
                      "detail": "Subscription is currently being modified",
                      "status": 422,
                      "title": "Unable to create subscription draft",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  },
                  "Product Not Available": {
                    "description": "Product Not Available",
                    "value": {
                      "detail": "The product variant is out of stock or discontinued",
                      "status": 422,
                      "title": "UserGeneratedError:Product is not available",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  }
                }
              }
            },
            "description": "Product cannot be added to this subscription or price cannot be customized"
          }
        },
        "summary": "Add product with custom price to subscription",
        "tags": [
          "Subscription Products",
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-contract-details": {
      "get": {
        "description": "Retrieves a paginated list of subscription contracts with powerful filtering capabilities. This endpoint enables complex queries to find specific subscriptions based on various criteria including dates, customer information, product details, and subscription characteristics.\n\n**Key Features:**\n- Comprehensive filtering across 20+ parameters\n- Full pagination support with customizable page size\n- Partial text matching for customer and order searches\n- Date range filtering for multiple date fields\n- Product and variant filtering within line items\n- Order amount range filtering\n- Plan type differentiation (prepaid vs pay-per-delivery)\n\n**Pagination:**\n- Uses Spring's Pageable format\n- Default page size: 20 items\n- Maximum page size: 2000 items (exceeding this limit will result in a 400 error)\n- Returns total count in X-Total-Count header\n- Provides navigation links in Link header\n\n**IMPORTANT - Sorting Limitations:**\nDue to the use of native SQL queries, sort parameters MUST use database column names (snake_case) rather than Java field names (camelCase).\n\nCommon sorting examples:\n- `sort=next_billing_date,asc` (NOT nextBillingDate)\n- `sort=customer_name,desc` (NOT customerName)\n- `sort=created_at,asc` (NOT createdAt)\n- `sort=subscription_contract_id,desc` (NOT subscriptionContractId)\n- `sort=order_amount,asc` (NOT orderAmount)\n\n**Date Format:**\nAll date parameters use ISO 8601 format with timezone:\n`yyyy-MM-dd'T'HH:mm:ssXXX`\nExamples: `2024-03-15T10:30:00+00:00` or `2024-03-15T10:30:00Z`\n\n**Date Range Filtering:**\n- For created, updated dates: Can use either 'from', 'to', or both\n- For next billing date: Both 'from' and 'to' must be provided together (current limitation)\n\n**Text Search Behavior:**\n- Customer name searches both name and email fields\n- Order name searches current and historical orders (in subscription_billing_attempt table)\n- All text searches are case-insensitive\n- Partial matches are supported (contains logic)\n- Subscription contract ID search supports partial numeric matching\n\n**Initial (checkout) order:**\n- `orderId`, `orderName`, `orderAmount` and `createdAt` describe the order placed at checkout that created the subscription\n- These orders are not returned by the past orders endpoints, which list renewal billing attempts only. Use this endpoint with `fromCreatedDate` / `toCreatedDate` to sync initial orders\n- Contracts with no Shopify origin order (e.g. imported or migrated from another app) have an empty `orderId` and `orderName` set to `UNKNOWN`\n\n**nextPaidBillingDate:**\n- The next billing date on which the customer is actually charged.\n- For prepaid/cycle-based plans with free or discounted reward cycles, this skips any upcoming cycle that is fully free and lands on the next cycle that gets charged - it can differ from `nextBillingDate` in that case.\n- For plans without free cycles, or when no billing attempt has been scheduled yet, this equals `nextBillingDate`.\n- Returns `null` when no future paid cycle exists (e.g., all remaining cycles are free and the plan's max cycle count has been reached), or when contract pricing data is unavailable.\n\n**Plan Type Classification:**\n- **prepaid**: Billing interval > delivery interval\n- **non-prepaid**: Billing interval = delivery interval\n\n**Performance Considerations:**\n- Complex filters (especially JSON searches and order amount calculations) may impact response time\n- Use specific filters when possible\n- Consider smaller page sizes for complex queries\n- Product, variant, and selling plan searches use JSON_SEARCH which may be slow on large datasets\n\n**Authentication:** Requires valid X-API-Key header (the deprecated 'api_key' query parameter is still accepted but not recommended)",
        "operationId": "getAllSubscriptionContractDetails",
        "parameters": [
          {
            "deprecated": true,
            "description": "API Key (Deprecated - Use X-API-Key header instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key for authentication",
            "example": "apst_your-api-key-here",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Filter by subscriptions created on or after this date",
            "example": "2025-10-01T00:00:00+02:00",
            "in": "query",
            "name": "fromCreatedDate",
            "required": false,
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "description": "Filter by subscriptions created on or before this date",
            "example": "2025-10-31T23:59:59+02:00",
            "in": "query",
            "name": "toCreatedDate",
            "required": false,
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "description": "Filter by subscriptions updated on or after this date",
            "example": "2025-10-01T00:00:00+02:00",
            "in": "query",
            "name": "fromUpdatedDate",
            "required": false,
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "description": "Filter by subscriptions updated on or before this date",
            "example": "2025-10-31T23:59:59+02:00",
            "in": "query",
            "name": "toUpdatedDate",
            "required": false,
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "description": "Filter by subscriptions with next billing date on or after this date. Note: Both fromNextDate and toNextDate must be provided together",
            "example": "2025-10-01T00:00:00+02:00",
            "in": "query",
            "name": "fromNextDate",
            "required": false,
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "description": "Filter by subscriptions with next billing date on or before this date. Note: Both fromNextDate and toNextDate must be provided together",
            "example": "2025-10-31T23:59:59+02:00",
            "in": "query",
            "name": "toNextDate",
            "required": false,
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "description": "Filter by subscription contract ID (partial match supported, case-insensitive)",
            "example": 123456,
            "in": "query",
            "name": "subscriptionContractId",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Filter by customer name or email (partial match, case-insensitive). Searches both customer_name and customer_email fields",
            "example": "john",
            "in": "query",
            "name": "customerName",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Filter by order number (searches current order_name and historical orders in subscription_billing_attempt table, partial match)",
            "example": "SUB-1001",
            "in": "query",
            "name": "orderName",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Filter by subscription status (case-insensitive)",
            "example": "ACTIVE",
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "enum": [
                "ACTIVE",
                "PAUSED",
                "CANCELLED"
              ],
              "type": "string"
            }
          },
          {
            "description": "Filter by delivery interval count (Note: This parameter name is misleading - it actually filters the delivery_policy_interval_count field)",
            "example": 1,
            "in": "query",
            "name": "billingPolicyIntervalCount",
            "required": false,
            "schema": {
              "maximum": 365,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "Filter by delivery interval type (Note: This parameter name is misleading - it actually filters the delivery_policy_interval field)",
            "example": "MONTH",
            "in": "query",
            "name": "billingPolicyInterval",
            "required": false,
            "schema": {
              "enum": [
                "DAY",
                "WEEK",
                "MONTH",
                "YEAR"
              ],
              "type": "string"
            }
          },
          {
            "description": "Filter by plan type classification. 'prepaid' = billing interval count \u2260 delivery interval count, 'non-prepaid' = billing interval count = delivery interval count",
            "example": "prepaid",
            "in": "query",
            "name": "planType",
            "required": false,
            "schema": {
              "enum": [
                "prepaid",
                "non-prepaid"
              ],
              "type": "string"
            }
          },
          {
            "description": "Filter by record type. 'imported' = has imported_id, 'nonImported' = no imported_id",
            "example": "imported",
            "in": "query",
            "name": "recordType",
            "required": false,
            "schema": {
              "enum": [
                "imported",
                "nonImported"
              ],
              "type": "string"
            }
          },
          {
            "description": "Filter by product ID (searches within subscription line items JSON). Provide numeric ID only",
            "example": 7890123456,
            "in": "query",
            "name": "productId",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "Filter by variant ID (searches within subscription line items JSON). Provide numeric ID only",
            "example": 42549172011164,
            "in": "query",
            "name": "variantId",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "Filter by selling plan ID (searches within subscription line items JSON). Provide numeric ID only",
            "example": 123456,
            "in": "query",
            "name": "sellingPlanId",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "Filter by minimum total order amount (calculated from sum of line items: quantity * currentPrice)",
            "example": 50.0,
            "in": "query",
            "name": "minOrderAmount",
            "required": false,
            "schema": {
              "format": "double",
              "type": "number"
            }
          },
          {
            "description": "Filter by maximum total order amount (calculated from sum of line items: quantity * currentPrice)",
            "example": 500.0,
            "in": "query",
            "name": "maxOrderAmount",
            "required": false,
            "schema": {
              "format": "double",
              "type": "number"
            }
          },
          {
            "description": "Pagination and sorting parameters. IMPORTANT: Sort fields must use database column names (snake_case), not Java field names. Maximum page size is 2000.",
            "example": "page=0&size=20&sort=next_billing_date,asc&sort=id,desc",
            "in": "query",
            "name": "pageable",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Pageable"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": [
                      {
                        "activatedOn": "2024-01-15T08:00:00.000+00:00",
                        "billingPolicyInterval": "MONTH",
                        "billingPolicyIntervalCount": 1,
                        "cancelledOn": null,
                        "contractDetailsJson": [
                          {
                            "currentPrice": 99.99,
                            "productId": "gid://shopify/Product/7890123456",
                            "productTitle": "Premium Subscription Box",
                            "quantity": 1,
                            "sellingPlanId": "gid://shopify/SellingPlan/123456",
                            "sellingPlanName": "Deliver every month",
                            "variantId": "gid://shopify/ProductVariant/42549172011164",
                            "variantTitle": "Monthly Plan"
                          }
                        ],
                        "createdAt": "2024-01-15T08:00:00.000+00:00",
                        "currencyCode": "USD",
                        "customerEmail": "john.doe@example.com",
                        "customerId": 987654321,
                        "customerName": "John Doe",
                        "deliveryPolicyInterval": "MONTH",
                        "deliveryPolicyIntervalCount": 1,
                        "graphSubscriptionContractId": "gid://shopify/SubscriptionContract/123456789",
                        "id": 1001,
                        "importedId": null,
                        "maxCycles": null,
                        "minCycles": 3,
                        "nextBillingDate": "2024-04-01T12:00:00.000+00:00",
                        "nextPaidBillingDate": "2024-04-01T12:00:00.000+00:00",
                        "orderName": "#SUB-1001",
                        "pausedOn": null,
                        "status": "active",
                        "subscriptionContractId": 123456789,
                        "totalPrice": 99.99,
                        "updatedAt": "2024-03-01T14:30:00.000+00:00"
                      },
                      {
                        "billingPolicyInterval": "MONTH",
                        "billingPolicyIntervalCount": 3,
                        "createdAt": "2024-02-01T10:00:00.000+00:00",
                        "currencyCode": "USD",
                        "customerEmail": "jane.smith@example.com",
                        "customerId": 987654322,
                        "customerName": "Jane Smith",
                        "deliveryPolicyInterval": "MONTH",
                        "deliveryPolicyIntervalCount": 1,
                        "id": 1002,
                        "nextBillingDate": "2024-05-01T12:00:00.000+00:00",
                        "nextPaidBillingDate": "2024-07-01T12:00:00.000+00:00",
                        "orderName": "#SUB-1002",
                        "status": "paused",
                        "subscriptionContractId": 123456790,
                        "totalPrice": 149.97,
                        "updatedAt": "2024-03-10T16:45:00.000+00:00"
                      }
                    ]
                  }
                },
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/SubscriptionContractDetailsDTO"
                  },
                  "type": "array"
                }
              }
            },
            "description": "Successfully retrieved subscription contracts",
            "headers": {
              "Link": {
                "description": "Pagination navigation links (first, prev, next, last)",
                "schema": {
                  "example": "<http://api.example.com/subscription-contract-details?page=2&size=20>; rel=\"next\"",
                  "type": "string"
                },
                "style": "simple"
              },
              "X-Total-Count": {
                "description": "Total number of matching subscription contracts",
                "schema": {
                  "example": 150,
                  "type": "integer"
                },
                "style": "simple"
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Invalid Date Format": {
                    "description": "Invalid Date Format",
                    "value": {
                      "detail": "Date must be in format: yyyy-MM-dd'T'HH:mm:ssXXX (e.g., 2024-03-15T10:30:00+00:00 or 2024-03-15T10:30:00Z)",
                      "status": 400,
                      "title": "Invalid date format",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Sort Field": {
                    "description": "Invalid Sort Field",
                    "value": {
                      "detail": "Unknown column 'nextBillingDate'. Use snake_case column names for sorting (e.g., 'next_billing_date')",
                      "status": 400,
                      "title": "Invalid sort field",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Status Value": {
                    "description": "Invalid Status Value",
                    "value": {
                      "detail": "Status must be one of: ACTIVE, PAUSED, CANCELLED (case-insensitive)",
                      "status": 400,
                      "title": "Invalid status value",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Bad Request - Invalid parameter format or values"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid API key is required to access this endpoint",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required - missing or invalid API key"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to read subscription contracts",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to access subscription data"
          },
          "500": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "An unexpected error occurred while retrieving subscription contracts",
                  "status": 500,
                  "title": "Internal server error",
                  "type": "https://example.com/errors/internal-error"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Retrieve subscription contracts",
        "tags": [
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-contract-details/analytics/{contractId}": {
      "get": {
        "description": "Retrieves comprehensive analytics for a specific subscription contract, including total revenue generated, number of successful orders, and formatted revenue display. This endpoint provides key performance metrics for understanding the financial impact of individual subscriptions.\n\n**What This Endpoint Returns:**\nFinancial and operational analytics for a single subscription contract, calculated from all successful billing attempts throughout the subscription's lifetime. Unlike realtime contract queries, this provides historical aggregated data.\n\n**Metrics Included:**\n\n**Revenue Metrics:**\n- **totalOrderAmount**: Total revenue in decimal format (e.g., 299.95)\n- **totalOrderRevenue**: Formatted currency string (e.g., \"$299.95\")\n- Calculated from all SUCCESS status billing attempts\n- Includes taxes, shipping, and discounts\n- Does NOT include failed or pending payments\n\n**Order Count:**\n- **totalOrders**: Count of successful billing attempts\n- Represents number of orders generated by subscription\n- Does NOT include failed billing attempts\n- Starts at 0 for brand new subscriptions\n\n**Currency Formatting:**\n- Uses shop's configured money_format\n- Respects shop's currency code (USD, EUR, GBP, etc.)\n- Handles currency symbols and decimal places correctly\n- Falls back to USD if currency unknown\n\n**Calculation Logic:**\n\n**Data Source:**\n```sql\nSELECT \n  COUNT(*) as totalOrders,\n  SUM(order_amount) as totalOrderAmount\nFROM subscription_billing_attempt\nWHERE shop = ? \n  AND contract_id = ?\n  AND status = 'SUCCESS'\n```\n\n**What Gets Counted:**\n- \u2705 Initial subscription order\n- \u2705 All successful recurring orders\n- \u2705 Manual billing attempts that succeeded\n- \u2705 Retry attempts that eventually succeeded\n- \u274c Failed payment attempts\n- \u274c Skipped billing cycles\n- \u274c Cancelled/voided orders\n- \u274c Pending/in-progress billing\n\n**Use Cases:**\n\n**1. Customer Lifetime Value:**\n- Calculate total revenue from specific customer\n- Measure subscription ROI\n- Identify high-value subscriptions\n- Track revenue growth over time\n\n**2. Subscription Performance:**\n- Analyze revenue per subscription\n- Compare subscriptions by total value\n- Identify most profitable subscription types\n- Calculate average order value\n\n**3. Customer Portal:**\n- Display \"You've saved $XXX\" messaging\n- Show \"X orders delivered\" stats\n- Celebrate subscription milestones\n- Build customer loyalty through transparency\n\n**4. Reporting & Analytics:**\n- Build subscription revenue dashboards\n- Generate customer value reports\n- Track subscription health metrics\n- Forecast future revenue\n\n**5. Business Intelligence:**\n- Segment customers by subscription value\n- Identify churn risk (low order count)\n- Calculate retention rates\n- Measure subscription program success\n\n**Response Format:**\n```json\n{\n  \"totalOrders\": 12,\n  \"totalOrderAmount\": 599.88,\n  \"totalOrderRevenue\": \"$599.88\"\n}\n```\n\n**Response Fields:**\n- `totalOrders` (integer): Count of successful billing attempts\n- `totalOrderAmount` (decimal): Numeric revenue total\n- `totalOrderRevenue` (string): Formatted currency display\n\n**Example Scenarios:**\n\n**Brand New Subscription:**\n```json\n{\n  \"totalOrders\": 0,\n  \"totalOrderAmount\": 0.00,\n  \"totalOrderRevenue\": \"$0.00\"\n}\n```\n\n**After First Successful Order:**\n```json\n{\n  \"totalOrders\": 1,\n  \"totalOrderAmount\": 49.99,\n  \"totalOrderRevenue\": \"$49.99\"\n}\n```\n\n**Established Subscription (EUR):**\n```json\n{\n  \"totalOrders\": 24,\n  \"totalOrderAmount\": 1199.76,\n  \"totalOrderRevenue\": \"\u20ac1.199,76\"\n}\n```\n\n**Integration Examples:**\n\n**Customer Portal - Loyalty Display:**\n```javascript\nconst analytics = await fetch(\n  `/api/external/v2/subscription-contract-details/analytics/${contractId}`,\n  { headers: { 'X-API-Key': 'your-key' } }\n).then(r => r.json());\n\nconst loyaltyMessage = `\n  <div class=\"loyalty-badge\">\n    <h3>Thank you for your loyalty!</h3>\n    <p>You've received ${analytics.totalOrders} orders</p>\n    <p>Total value: ${analytics.totalOrderRevenue}</p>\n  </div>\n`;\n```\n\n**Revenue Dashboard:**\n```javascript\n// Fetch analytics for multiple subscriptions\nconst contractIds = [123, 456, 789];\nconst analyticsPromises = contractIds.map(id => \n  getContractAnalytics(id)\n);\n\nconst allAnalytics = await Promise.all(analyticsPromises);\nconst totalRevenue = allAnalytics.reduce(\n  (sum, a) => sum + a.totalOrderAmount, 0\n);\n\nconsole.log(`Total subscription revenue: $${totalRevenue.toFixed(2)}`);\n```\n\n**Important Considerations:**\n\n**Data Accuracy:**\n- Based on Appstle's billing attempt records\n- May differ slightly from Shopify order totals\n- Includes only what Appstle successfully billed\n- Updated after each billing attempt completes\n\n**Currency Handling:**\n- Formatting uses shop's money_format setting\n- Different shops may have different decimal separators\n- Currency symbol placement varies by locale\n- Always use totalOrderAmount for calculations\n\n**Performance:**\n- Fast database aggregation query\n- Typical response time: 100-300ms\n- Indexed by shop and contract ID\n- Suitable for real-time display\n\n**Best Practices:**\n\n1. **Use for Display**: Use totalOrderRevenue for customer-facing display\n2. **Calculate with Amount**: Use totalOrderAmount for mathematical operations\n3. **Cache Strategically**: Cache for dashboards, fetch real-time for critical displays\n4. **Handle Zero**: Gracefully handle new subscriptions with 0 orders\n5. **Validate Contract**: Ensure contract exists before querying analytics\n\n**Limitations:**\n\n**What's NOT Included:**\n- Future projected revenue\n- Failed payment attempt counts\n- Refunds or chargebacks\n- Pending/processing orders\n- Orders from other subscriptions\n\n**Related Calculations:**\n\n**Average Order Value:**\n```javascript\nconst aov = analytics.totalOrderAmount / analytics.totalOrders;\nconsole.log(`Average order value: $${aov.toFixed(2)}`);\n```\n\n**Customer Lifetime Value (projected):**\n```javascript\nconst monthsActive = calculateMonthsActive(contract.createdAt);\nconst monthlyRevenue = analytics.totalOrderAmount / monthsActive;\nconst projectedLTV = monthlyRevenue * 12; // Annual LTV\n```\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "getSubscriptionContractAnalyticsByContractIdExternalV2",
        "parameters": [
          {
            "description": "Contract ID",
            "in": "path",
            "name": "contractId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Active subscription with history": {
                    "description": "Active subscription with history",
                    "value": {
                      "totalOrderAmount": 599.88,
                      "totalOrderRevenue": "$599.88",
                      "totalOrders": 12
                    }
                  },
                  "New subscription (no orders yet)": {
                    "description": "New subscription (no orders yet)",
                    "value": {
                      "totalOrderAmount": 0.0,
                      "totalOrderRevenue": "$0.00",
                      "totalOrders": 0
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/ContractAnalytics"
                }
              }
            },
            "description": "Successfully retrieved contract analytics"
          },
          "400": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contract ID must be a valid positive integer",
                  "status": 400,
                  "title": "Invalid contract ID",
                  "type": "https://example.com/errors/bad-request"
                }
              }
            },
            "description": "Bad request - Invalid contract ID"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header is required",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contract does not belong to your shop",
                  "status": 403,
                  "title": "Access denied",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Forbidden - Contract does not belong to authenticated shop"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "No subscription contract found with ID 12345",
                  "status": 404,
                  "title": "Contract not found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Contract not found"
          }
        },
        "summary": "Get subscription contract analytics and revenue metrics",
        "tags": [
          "Subscription Management",
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-contract-details/billing-interval": {
      "get": {
        "description": "Retrieves all available billing frequency options configured for specific Shopify selling plan(s). Returns the complete set of billing intervals that customers can choose from, including frequency, interval type, and any associated discounts or pricing policies.\n\n**What This Endpoint Does:**\nQueries the subscription group plans database to find all frequency configurations associated with given selling plan ID(s). This is essential for building subscription frequency selectors in customer portals or during subscription modifications.\n\n**Key Concepts:**\n\n**Selling Plans:**\n- Shopify's mechanism for defining subscription options\n- Each product variant can have multiple selling plans\n- Selling plans define billing/delivery frequency\n- Plans are grouped in subscription groups\n\n**Frequency Info:**\n- Specific billing interval configuration\n- E.g., \"Every 2 weeks\", \"Every month\", \"Every 3 months\"\n- Includes pricing policies and discounts\n- Customers select from available frequencies\n\n**Request Parameters:**\n\n**sellingPlanIds (required):**\n- Comma-separated list of Shopify selling plan IDs\n- Example: `\"123456,123457,123458\"`\n- Can query single or multiple plans\n- Returns frequencies for ALL provided plans\n\n**Lookup Process:**\n1. Parse selling plan IDs from comma-separated string\n2. Find subscription groups containing these plans\n3. Extract frequency configurations from group JSON\n4. Return all matching frequency options\n5. Deduplicate if same frequency appears multiple times\n\n**Response Data Included:**\n\n**For Each Frequency Option:**\n- **id**: Selling plan ID\n- **frequencyName**: Display name (e.g., \"Monthly\")\n- **interval**: WEEK, MONTH, or YEAR\n- **intervalCount**: Number of intervals (e.g., 2 for bi-weekly)\n- **deliveryInterval**: Same or different from billing\n- **deliveryIntervalCount**: Delivery frequency\n- **pricingPolicy**: Discount configuration\n- **billingPolicy**: Min/max cycles, anchor settings\n\n**Pricing Policy Details:**\n- Discount type (percentage, fixed amount)\n- Discount value\n- After cycle discounts (e.g., \"50% off first 3 months\")\n- Adjustment type\n\n**Use Cases:**\n\n**1. Frequency Selection UI:**\n- Build dropdown/radio list of frequency options\n- Show available intervals to customers\n- Display pricing for each frequency\n- Enable subscription frequency changes\n\n**2. Subscription Modification:**\n- Show current frequency and alternatives\n- Allow customers to switch frequencies\n- Validate new frequency selection\n- Preview pricing changes\n\n**3. Product Page:**\n- Display subscription frequency options\n- Show \"Subscribe and save\" pricing\n- Calculate savings per frequency\n- Build subscription purchase selectors\n\n**4. Customer Portal:**\n- \"Change Frequency\" functionality\n- Show all available options\n- Highlight current selection\n- Display pricing differences\n\n**Response Format:**\n```json\n[\n  {\n    \"id\": \"123456\",\n    \"frequencyName\": \"Every 2 Weeks\",\n    \"interval\": \"WEEK\",\n    \"intervalCount\": 2,\n    \"deliveryInterval\": \"WEEK\",\n    \"deliveryIntervalCount\": 2,\n    \"pricingPolicy\": {\n      \"adjustmentType\": \"PERCENTAGE\",\n      \"adjustmentValue\": \"10.0\"\n    }\n  },\n  {\n    \"id\": \"123457\",\n    \"frequencyName\": \"Monthly\",\n    \"interval\": \"MONTH\",\n    \"intervalCount\": 1,\n    \"deliveryInterval\": \"MONTH\",\n    \"deliveryIntervalCount\": 1,\n    \"pricingPolicy\": {\n      \"adjustmentType\": \"PERCENTAGE\",\n      \"adjustmentValue\": \"15.0\"\n    }\n  }\n]\n```\n\n**Integration Example:**\n\n**Customer Portal - Frequency Selector:**\n```javascript\n// Get selling plan from current subscription\nconst currentSellingPlanId = subscription.sellingPlanId;\n\n// Fetch available frequencies\nconst frequencies = await fetch(\n  `/api/external/v2/subscription-contract-details/billing-interval?sellingPlanIds=${currentSellingPlanId}`,\n  { headers: { 'X-API-Key': 'your-key' } }\n).then(r => r.json());\n\n// Build selector\nconst selector = frequencies.map(freq => `\n  <option value=\"${freq.id}\" \n    ${freq.id === currentSellingPlanId ? 'selected' : ''}>\n    ${freq.frequencyName} - Save ${freq.pricingPolicy.adjustmentValue}%\n  </option>\n`).join('');\n\ndocument.querySelector('#frequency-select').innerHTML = selector;\n```\n\n**Important Considerations:**\n\n**Data Source:**\n- Queries Appstle database (NOT Shopify API)\n- Based on subscription group configuration\n- Fast response (< 100ms typically)\n- Data synced when groups are updated\n\n**Multiple Selling Plans:**\n- Can query multiple plans at once\n- Returns union of all frequencies\n- Useful for products with multiple subscription options\n- Results may contain duplicates if plans share frequencies\n\n**Empty Results:**\n- Returns empty array `[]` if no plans found\n- Returns empty if selling plan ID invalid\n- Not an error - handle gracefully\n\n**Best Practices:**\n\n1. **Query Relevant Plans**: Only query selling plans for current product/variant\n2. **Display Discounts**: Show savings clearly in UI\n3. **Sort by Interval**: Order options logically (weekly \u2192 monthly \u2192 yearly)\n4. **Highlight Current**: Clearly mark customer's current frequency\n5. **Cache Results**: Cache frequency data per selling plan\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "getSubscriptionContractBillingInterval",
        "parameters": [
          {
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Selling Plan ID",
            "in": "query",
            "name": "sellingPlanIds",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/FrequencyInfoDTO"
                  },
                  "type": "array"
                }
              }
            },
            "description": "Successfully retrieved billing intervals (may be empty array)"
          },
          "400": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "sellingPlanIds parameter is required",
                  "status": 400,
                  "title": "Invalid parameters",
                  "type": "https://example.com/errors/bad-request"
                }
              }
            },
            "description": "Bad request - Missing or invalid selling plan IDs"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header is required",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required"
          }
        },
        "summary": "Get available billing intervals for selling plan(s)",
        "tags": [
          "Subscription Management",
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-contract-details/create-subscription-contract": {
      "post": {
        "description": "Creates a new subscription contract for a customer with specified products, billing frequency, and delivery details. This endpoint allows you to programmatically create subscriptions with custom pricing, delivery schedules, and multiple line items. The subscription will be created in Shopify and synchronized with the Appstle system.\n\n**Important Notes:**\n- Customer must have at least one valid payment method\n- If paymentMethodId is not provided, the default payment method will be used\n- If delivery interval is not specified, it defaults to the billing interval\n- Custom pricing policies can be applied per line item\n- All monetary values are in the store's base currency unless currencyCode is specified\n- CustomAttributes and line item customAttributes use Shopify's AttributeInput format: {\"key\": \"string\", \"value\": \"string\"}\n\n**Pricing Policy Types:**\n- SELLING_PLAN_PRICING_POLICY: Uses the default pricing from the selling plan\n- CUSTOM_PRICING_POLICY: Allows custom discount cycles defined in pricingPolicy array\n- NO_PRICING_POLICY: Uses the base price without any discounts\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "createSubscriptionContractV2",
        "parameters": [
          {
            "deprecated": true,
            "description": "API Key (Deprecated)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubscriptionContractDTO"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "billingPolicy": {
                        "interval": "MONTH",
                        "intervalCount": 1,
                        "maxCycles": 12,
                        "minCycles": 3
                      },
                      "customer": {
                        "email": "customer@example.com",
                        "firstName": "John",
                        "id": "gid://shopify/Customer/987654321",
                        "lastName": "Doe"
                      },
                      "deliveryPolicy": {
                        "interval": "MONTH",
                        "intervalCount": 1
                      },
                      "deliveryPrice": {
                        "amount": "5.99",
                        "currencyCode": "USD"
                      },
                      "id": "gid://shopify/SubscriptionContract/123456789",
                      "lines": {
                        "edges": [
                          {
                            "node": {
                              "currentPrice": {
                                "amount": "25.99",
                                "currencyCode": "USD"
                              },
                              "id": "gid://shopify/SubscriptionLine/111111",
                              "pricingPolicy": {
                                "basePrice": {
                                  "amount": "29.99",
                                  "currencyCode": "USD"
                                }
                              },
                              "quantity": 2,
                              "variantId": "gid://shopify/ProductVariant/42549172011164"
                            }
                          }
                        ]
                      },
                      "nextBillingDate": "2024-02-01T00:00:00Z",
                      "status": "ACTIVE"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Subscription contract successfully created"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Invalid Selling Plan": {
                    "description": "Invalid Selling Plan",
                    "value": {
                      "detail": "The specified selling plan does not exist",
                      "status": 400,
                      "title": "UserGeneratedError:No selling plan found for id: gid://shopify/SellingPlan/999999",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Missing Required Field": {
                    "description": "Missing Required Field",
                    "value": {
                      "detail": "The customerId field must be provided",
                      "status": 400,
                      "title": "UserGeneratedError:Customer ID is required",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Multiple Payment Methods": {
                    "description": "Multiple Payment Methods",
                    "value": {
                      "detail": "When customer has multiple payment methods, paymentMethodId must be specified",
                      "status": 400,
                      "title": "UserGeneratedError:Multiple Payment methods found for the customer",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "No Payment Method": {
                    "description": "No Payment Method",
                    "value": {
                      "detail": "Customer must have at least one valid payment method",
                      "status": 400,
                      "title": "UserGeneratedError:No Payment methods found for the customer",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid request parameters or business rule violation"
          },
          "401": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Authentication required - missing or invalid API key"
          },
          "403": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Insufficient permissions to create subscription contracts"
          },
          "422": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Shopify API error: Product variant not found",
                  "status": 422,
                  "title": "createSubscriptionContractError",
                  "type": "https://example.com/errors/unprocessable-entity"
                }
              }
            },
            "description": "Unable to process the subscription contract due to Shopify API constraints"
          }
        },
        "summary": "Create a new subscription contract",
        "tags": [
          "Subscription Management",
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-contract-details/current-cycle/{contractId}": {
      "get": {
        "description": "Retrieves the current billing cycle number for a specific subscription contract. The cycle number represents how many successful billing attempts have occurred for this subscription, starting from 1 for the initial order.\n\n**What is a Billing Cycle?**\nA billing cycle represents one completed billing period in a subscription's lifetime. Each successful billing attempt increments the cycle count. This number is crucial for:\n- Tracking subscription progress towards minimum/maximum cycle limits\n- Applying cycle-based pricing adjustments (discounts after N cycles)\n- Determining eligibility for cancellation (minimum cycles requirement)\n- Calculating customer lifetime value\n- Analyzing subscription retention metrics\n\n**How Cycle Counting Works:**\n\n**Initial Order:**\n- Cycle 1 starts when subscription is first created\n- Initial order counts as the first billing cycle\n- Includes origin order that created the subscription\n\n**Subsequent Orders:**\n- Each successful billing attempt increments cycle by 1\n- Only SUCCESS status billing attempts are counted\n- Failed/skipped billing attempts do NOT increment cycle\n- Paused subscriptions maintain their current cycle number\n\n**Calculation Formula:**\n```\nCurrent Cycle = 1 + (Number of Successful Billing Attempts)\n```\n\n**Example Timeline:**\n- Day 1: Subscription created, initial order \u2192 Cycle 1\n- Day 30: First recurring order successful \u2192 Cycle 2\n- Day 60: Second recurring order successful \u2192 Cycle 3\n- Day 90: Billing fails (payment declined) \u2192 Still Cycle 3\n- Day 95: Retry successful \u2192 Cycle 4\n\n**Use Cases:**\n\n**1. Cancellation Eligibility:**\n- Verify customer has met minimum cycle requirement\n- Enforce contract terms (e.g., \"3 month minimum\")\n- Display \"Can cancel after N more orders\" messaging\n- Block premature cancellations\n\n**2. Pricing Adjustments:**\n- Apply introductory pricing for first N cycles\n- Trigger loyalty discounts after X cycles\n- Calculate when pricing changes take effect\n- Implement \"First 3 months 50% off\" promotions\n\n**3. Customer Retention:**\n- Identify subscriptions at risky cycle counts\n- Send retention campaigns at specific milestones\n- Track average cycles before churn\n- Celebrate subscription anniversaries\n\n**4. Analytics & Reporting:**\n- Calculate customer lifetime value (cycle \u00d7 price)\n- Analyze subscription duration distribution\n- Track retention curves by cohort\n- Measure success of lifecycle campaigns\n\n**5. Customer Portal Display:**\n- Show \"Order #X of Y\" progress indicators\n- Display remaining cycles until cancellation allowed\n- Show subscription tenure/loyalty status\n- Calculate and display subscription value earned\n\n**Response Format:**\n\nReturns a single integer representing the current cycle number:\n```json\n3\n```\n\n**Response Examples:**\n\n**New subscription (just created):**\n```json\n1\n```\n\n**After 5 successful billing attempts:**\n```json\n6\n```\nNote: Initial order (1) + 5 successful renewals = Cycle 6\n\n**Important Considerations:**\n\n**Cycle vs. Billing Attempts:**\n- Failed billing attempts don't increment cycle\n- Skipped orders don't increment cycle\n- Manual order creation may not increment cycle\n- Cycle represents successful billing events only\n\n**Paused Subscriptions:**\n- Cycle number remains frozen while paused\n- Resumes at same cycle when un-paused\n- Pause duration doesn't affect cycle count\n\n**Minimum/Maximum Cycles:**\n- `minCycles`: Minimum cycles before cancellation allowed\n- `maxCycles`: Subscription auto-expires after this many cycles\n- Use this endpoint to check progress towards these limits\n\n**Data Source:**\n- Queries Appstle database (not Shopify API)\n- Counts records in subscription_billing_attempt table\n- Filters by SUCCESS status only\n- Fast response time (< 100ms typically)\n\n**Integration Example:**\n\n**Check if customer can cancel:**\n```javascript\n// Get subscription details\nconst contract = await getSubscriptionContract(contractId);\nconst currentCycle = await fetch(\n  `/api/external/v2/subscription-contract-details/current-cycle/${contractId}`,\n  { headers: { 'X-API-Key': 'your-key' } }\n).then(r => r.json());\n\nconst minCycles = contract.minCycles || 0;\n\nif (currentCycle >= minCycles) {\n  console.log('Customer can cancel now');\n  showCancelButton();\n} else {\n  const cyclesRemaining = minCycles - currentCycle;\n  console.log(`Must complete ${cyclesRemaining} more orders before canceling`);\n  showMinimumCommitmentMessage(cyclesRemaining);\n}\n```\n\n**Display progress to max cycles:**\n```javascript\nconst currentCycle = await getCycleNumber(contractId);\nconst maxCycles = contract.maxCycles;\n\nif (maxCycles) {\n  const progress = (currentCycle / maxCycles) * 100;\n  console.log(`Subscription ${progress.toFixed(0)}% complete (${currentCycle}/${maxCycles})`);\n  \n  if (currentCycle === maxCycles) {\n    console.log('This is the final cycle - subscription will expire after this order');\n  }\n}\n```\n\n**Performance Characteristics:**\n\n**Fast Query:**\n- Simple database count query\n- Indexed by shop and contractId\n- Typical response time: 50-150ms\n- Suitable for real-time UI updates\n\n**Best Practices:**\n\n1. **Cache Results**: Cache cycle number briefly (few minutes) to reduce API calls\n2. **Combine with Contract Data**: Fetch contract details simultaneously for min/max cycles\n3. **Handle Edge Cases**: Account for subscriptions with no successful billings yet\n4. **Display Progress**: Show cycle number in customer-friendly format (\"Order 3 of 12\")\n5. **Sync with Billing**: Update cycle number after each billing attempt completes\n\n**Common Misunderstandings:**\n\n**Myth: Cycle = Months Subscribed**\n- Reality: Cycle = Successful billing attempts, not time elapsed\n- A paused subscription stays at same cycle for months\n- Failed payments don't advance the cycle\n\n**Myth: First order is Cycle 0**\n- Reality: Cycles start at 1, not 0\n- Initial/origin order is Cycle 1\n\n**Related Fields:**\n- `minCycles`: Minimum cycles before cancellation (from contract)\n- `maxCycles`: Maximum cycles before auto-expiry (from contract)\n- `billingInterval`: Frequency between cycles (from contract)\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "getCurrentCycleOfSubscriptionContractV2",
        "parameters": [
          {
            "description": "API Key for authentication",
            "example": "apst_your-api-key-here",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "contractId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Established subscription": {
                    "description": "Subscription has had 5 successful billing renewals plus initial order",
                    "value": 6
                  },
                  "New subscription": {
                    "description": "Subscription just created, on first billing cycle",
                    "value": 1
                  }
                },
                "schema": {
                  "format": "int32",
                  "type": "integer"
                }
              }
            },
            "description": "Successfully retrieved current billing cycle number"
          },
          "400": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contract ID must be a valid positive integer",
                  "status": 400,
                  "title": "Invalid contract ID",
                  "type": "https://example.com/errors/bad-request"
                }
              }
            },
            "description": "Bad request - Invalid contract ID"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header is required",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required - Missing or invalid API key"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Subscription contract does not belong to your shop",
                  "status": 403,
                  "title": "Access denied",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Forbidden - Contract does not belong to authenticated shop"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "No subscription contract found with ID 12345",
                  "status": 404,
                  "title": "Contract not found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Contract not found"
          }
        },
        "summary": "Get current billing cycle number for a subscription contract",
        "tags": [
          "Subscription Management",
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-contract-details/customers": {
      "get": {
        "description": "Returns a paginated list of customers who have subscription contracts. Supports filtering by customer name, email, and subscription count.",
        "operationId": "getAllSubscriptionContractDetailsByShop",
        "parameters": [
          {
            "deprecated": true,
            "description": "API Key (Deprecated - Use X-API-Key header instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key for authentication",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Filter customers by name (partial match supported)",
            "in": "query",
            "name": "name",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Filter customers by exact email address",
            "in": "query",
            "name": "email",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "When true, returns only customers who have more than one active subscription",
            "example": false,
            "in": "query",
            "name": "activeMoreThanOneSubscription",
            "required": false,
            "schema": {
              "default": false,
              "type": "boolean"
            }
          },
          {
            "description": "Pagination parameters (page number and size)",
            "example": {
              "page": 0,
              "size": 10,
              "sort": [
                "id,desc"
              ]
            },
            "in": "query",
            "name": "pageable",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Pageable"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/CustomerInfo"
                  },
                  "type": "array"
                }
              }
            },
            "description": "Successfully retrieved customer list"
          },
          "401": {
            "content": {
              "*/*": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/CustomerInfo"
                  },
                  "type": "array"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "*/*": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/CustomerInfo"
                  },
                  "type": "array"
                }
              }
            },
            "description": "Insufficient permissions to access customer data"
          }
        },
        "summary": "Retrieve customers with subscriptions",
        "tags": [
          "Customers",
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-contract-details/replace-variants-v3": {
      "post": {
        "description": "Replaces existing product variants with new ones in a subscription contract. This endpoint supports both regular subscription products and one-time products, allowing you to swap products, update quantities, and manage the product mix in a subscription.\n\n**Key Features:**\n- **Bulk Replace**: Replace multiple products at once by providing lists of old and new variants\n- **Line-Specific Replace**: Target a specific line item using oldLineId for precise replacement\n- **Quantity Management**: Set new quantities for replaced products\n- **One-Time Products**: Add or remove one-time purchase products independently\n- **Discount Preservation**: Configurable discount carry-forward logic\n\n**Discount Carry Forward Options:**\n- **PRODUCT_THEN_EXISTING**: First tries to apply the new product's selling plan discount, then falls back to existing discount\n- **PRODUCT_PLAN**: Always uses the new product's selling plan discount\n- **EXISTING_PLAN**: Maintains the existing product's discount structure\n\n**Important Notes:**\n- At least one regular subscription product must remain in the contract\n- One-time products and free products don't count towards the minimum product requirement\n- The system automatically handles pricing adjustments based on billing/delivery intervals\n- Shipping prices are automatically recalculated after changes\n\n**Use Cases:**\n- Product upgrades/downgrades (e.g., switching coffee blend or size)\n- Quantity adjustments during product swap\n- Adding limited-time or seasonal products as one-time purchases\n- Bulk product replacements for subscription migrations\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "replaceVariantsV3",
        "parameters": [
          {
            "deprecated": true,
            "description": "API Key (Deprecated)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReplaceVariantsInfoV3"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "id": "gid://shopify/SubscriptionContract/123456789",
                      "lines": {
                        "edges": [
                          {
                            "node": {
                              "currentPrice": {
                                "amount": "35.99",
                                "currencyCode": "USD"
                              },
                              "id": "gid://shopify/SubscriptionLine/999999",
                              "pricingPolicy": {
                                "basePrice": {
                                  "amount": "39.99",
                                  "currencyCode": "USD"
                                },
                                "cycleDiscounts": [
                                  {
                                    "adjustmentType": "PERCENTAGE",
                                    "adjustmentValue": {
                                      "percentage": 10.0
                                    },
                                    "afterCycle": 1
                                  }
                                ]
                              },
                              "quantity": 3,
                              "title": "Premium Coffee - Dark Roast",
                              "variantId": "gid://shopify/ProductVariant/888888",
                              "variantTitle": "1kg / Whole Bean"
                            }
                          },
                          {
                            "node": {
                              "currentPrice": {
                                "amount": "9.99",
                                "currencyCode": "USD"
                              },
                              "customAttributes": [
                                {
                                  "key": "_one_time_product",
                                  "value": "true"
                                }
                              ],
                              "id": "gid://shopify/SubscriptionLine/777777",
                              "quantity": 1,
                              "title": "Coffee Filters - Pack of 100",
                              "variantId": "gid://shopify/ProductVariant/666666"
                            }
                          }
                        ]
                      },
                      "nextBillingDate": "2024-02-15T00:00:00Z",
                      "status": "ACTIVE"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Products successfully replaced"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Last Product Removal": {
                    "description": "Last Product Removal",
                    "value": {
                      "detail": "This operation would remove all subscription products from the contract",
                      "status": 400,
                      "title": "UserGeneratedError:Cannot remove line item. Atleast one subscription product must be present in a subscription",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "No Variants Specified": {
                    "description": "No Variants Specified",
                    "value": {
                      "detail": "You must specify at least one variant to add or remove",
                      "status": 400,
                      "title": "UserGeneratedError:No variants to add or remove",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Product Not Found": {
                    "description": "Product Not Found",
                    "value": {
                      "detail": "The new variant ID does not exist in your store",
                      "status": 400,
                      "title": "Product Variant not found for ID: gid://shopify/ProductVariant/999999",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Same Source and Destination": {
                    "description": "Same Source and Destination",
                    "value": {
                      "detail": "You cannot replace a variant with itself",
                      "status": 400,
                      "title": "UserGeneratedError:Source and destination variants cannot be same",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Variant Not Found": {
                    "description": "Variant Not Found",
                    "value": {
                      "detail": "The specified old variant IDs do not exist in the subscription",
                      "status": 400,
                      "title": "UserGeneratedError:Old variants didn't match with the existing variants",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid request parameters or business rule violation"
          },
          "401": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Authentication required - missing or invalid API key"
          },
          "403": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Insufficient permissions to modify subscription contracts"
          }
        },
        "summary": "Replace product variants in a subscription contract",
        "tags": [
          "Subscription Management",
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-contract-details/shopify/customer/{customerId}/payment-methods": {
      "get": {
        "description": "Retrieves all payment methods associated with a customer directly from Shopify's payment API. This endpoint returns detailed information about stored payment instruments including credit/debit cards, digital wallets, and other payment methods that the customer can use for subscription billing.\n\n**What This Endpoint Does:**\nQueries Shopify's GraphQL API to fetch the customer's payment methods, including active instruments and optionally revoked (expired, removed, or failed) payment methods. This provides real-time payment method data directly from Shopify's payment vault.\n\n**Payment Method Types Supported:**\n\n**Credit/Debit Cards:**\n- Visa, Mastercard, American Express, Discover\n- Card last 4 digits\n- Expiry month and year\n- Card brand and type\n- Billing address associated with card\n\n**Digital Wallets:**\n- Shop Pay\n- Apple Pay\n- Google Pay\n- PayPal (when stored)\n\n**Alternative Payment Methods:**\n- Bank accounts (ACH, SEPA)\n- Buy Now Pay Later instruments\n- Store credit\n\n**Payment Method Information Returned:**\n\n**For Each Payment Method:**\n- **Payment Instrument ID**: Unique identifier (used for updates)\n- **Display Name**: Human-readable name (e.g., \"Visa ending in 4242\")\n- **Payment Type**: Card, wallet, bank account, etc.\n- **Status**: ACTIVE, REVOKED, EXPIRED, FAILED\n- **Is Default**: Whether this is the customer's default payment method\n- **Last 4 Digits**: For cards and bank accounts\n- **Expiry Date**: For cards (month/year)\n- **Brand**: Visa, Mastercard, Amex, etc.\n- **Billing Address**: Address associated with payment method\n- **Created Date**: When payment method was added\n\n**Query Parameters:**\n\n**allowRevokedMethod (optional, default: false):**\n- `false`: Returns only active, usable payment methods\n- `true`: Returns both active AND revoked payment methods\n\n**Revoked Payment Methods:**\nInclude expired cards, deleted payment methods, failed instruments, and customer-removed methods. Useful for historical records and troubleshooting, but cannot be used for new billing attempts.\n\n**Use Cases:**\n\n**1. Customer Portal:**\n- Display saved payment methods\n- Allow customer to select default payment method\n- Show payment method update/delete options\n- Validate payment methods before subscription modification\n\n**2. Subscription Management:**\n- Verify customer has valid payment method before creating subscription\n- Check payment method expiry before next billing\n- Identify subscriptions at risk due to expiring cards\n- Prompt customer to update payment if needed\n\n**3. Payment Method Updates:**\n- List available payment methods for customer selection\n- Identify payment instrument ID for update operations\n- Validate payment method before switching subscription\n\n**4. Troubleshooting & Support:**\n- Debug payment failures\n- Verify which payment method is being used\n- Check if payment method is expired or revoked\n- Assist customer with payment issues\n\n**5. Analytics & Alerts:**\n- Track payment methods approaching expiry\n- Send proactive notifications to update cards\n- Analyze payment method distribution\n- Identify customers with no valid payment methods\n\n**Response Structure:**\n\nReturns CustomerPaymentMethodsQuery.PaymentMethods object from Shopify GraphQL:\n```json\n{\n  \"nodes\": [\n    {\n      \"id\": \"gid://shopify/CustomerPaymentMethod/abc123\",\n      \"instrument\": {\n        \"__typename\": \"CustomerCreditCard\",\n        \"brand\": \"VISA\",\n        \"lastDigits\": \"4242\",\n        \"expiryMonth\": 12,\n        \"expiryYear\": 2025,\n        \"name\": \"John Doe\"\n      },\n      \"revokedAt\": null,\n      \"revokedReason\": null,\n      \"subscriptionContracts\": [...]\n    }\n  ]\n}\n```\n\n**Common Scenarios:**\n\n**Scenario 1: Customer with multiple cards**\nReturns array with multiple payment method objects, each representing a stored card.\n\n**Scenario 2: Customer with no payment methods**\nReturns empty nodes array - customer needs to add payment method.\n\n**Scenario 3: Expired card included (allowRevokedMethod=true)**\nReturns both active cards and expired/revoked cards with revokedAt timestamp.\n\n**Important Considerations:**\n\n**Data Source:**\n- Queries Shopify API in real-time (not Appstle database)\n- Always returns current Shopify payment method state\n- Subject to Shopify API rate limits\n\n**Performance:**\n- Response time: 300-800ms (depends on Shopify API)\n- Slower than database queries\n- Consider caching for non-critical displays\n\n**Security:**\n- Never returns full card numbers (PCI compliance)\n- Returns only last 4 digits\n- CVV is never stored or returned\n- Payment instrument IDs are tokenized references\n\n**Privacy:**\n- Customer ID validated against shop\n- Cannot query payment methods from other shops\n- Requires appropriate API permissions\n\n**Best Practices:**\n\n1. **Default to Active Only**: Use `allowRevokedMethod=false` for payment selection UIs\n2. **Check Expiry Dates**: Validate card expiry before using for subscriptions\n3. **Cache Responsibly**: Cache for short periods (5-10 min) to reduce API calls\n4. **Handle Empty Response**: Always handle case where customer has no payment methods\n5. **Show User-Friendly Names**: Display brand and last 4 (e.g., \"Visa \u2022\u2022\u2022\u2022 4242\")\n6. **Indicate Default**: Highlight the default payment method clearly\n\n**Integration Examples:**\n\n**Example 1: Display payment methods in customer portal**\n```javascript\nconst paymentMethods = await fetch(\n  `/api/external/v2/subscription-contract-details/shopify/customer/${customerId}/payment-methods`,\n  { headers: { 'X-API-Key': 'your-key' } }\n).then(r => r.json());\n\npaymentMethods.nodes.forEach(pm => {\n  if (pm.instrument.__typename === 'CustomerCreditCard') {\n    console.log(`${pm.instrument.brand} ending in ${pm.instrument.lastDigits}`);\n    if (pm.instrument.expiryYear < currentYear) {\n      console.warn('Card expired!');\n    }\n  }\n});\n```\n\n**Example 2: Check for valid payment before creating subscription**\n```javascript\nconst paymentMethods = await fetch(...);\nconst hasValidPayment = paymentMethods.nodes.some(pm => \n  !pm.revokedAt && pm.instrument.expiryYear >= currentYear\n);\n\nif (!hasValidPayment) {\n  alert('Please add a valid payment method before subscribing');\n}\n```\n\n**Related Endpoints:**\n- `PUT /api/external/v2/subscription-contracts-update-payment-method` - Update subscription payment method\n- `POST /api/external/v2/associate-shopify-customer-to-external-payment-gateways` - Add external payment method\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "getShopifyCustomerPaymentDetails",
        "parameters": [
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Customer Id",
            "in": "path",
            "name": "customerId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "Get revoked payment methods?",
            "in": "query",
            "name": "allowRevokedMethod",
            "required": false,
            "schema": {
              "default": false,
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Customer with payment methods": {
                    "description": "Customer with payment methods",
                    "value": {
                      "nodes": [
                        {
                          "id": "gid://shopify/CustomerPaymentMethod/abc123",
                          "instrument": {
                            "__typename": "CustomerCreditCard",
                            "brand": "VISA",
                            "expiryMonth": 12,
                            "expiryYear": 2025,
                            "lastDigits": "4242",
                            "name": "John Doe",
                            "source": "SHOPIFY"
                          },
                          "revokedAt": null,
                          "revokedReason": null
                        },
                        {
                          "id": "gid://shopify/CustomerPaymentMethod/def456",
                          "instrument": {
                            "__typename": "CustomerShopPayAgreement",
                            "lastDigits": "1234",
                            "name": "Shop Pay"
                          },
                          "revokedAt": null,
                          "revokedReason": null
                        }
                      ]
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/PaymentMethods"
                }
              }
            },
            "description": "Successfully retrieved customer payment methods from Shopify"
          },
          "400": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Customer ID must be a valid positive integer",
                  "status": 400,
                  "title": "Invalid request",
                  "type": "https://example.com/errors/bad-request"
                }
              }
            },
            "description": "Bad request - Invalid customer ID or parameters"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header is required",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Customer does not belong to your shop or API key lacks payment method read permissions",
                  "status": 403,
                  "title": "Access denied",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Forbidden - Customer does not belong to shop or insufficient permissions"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "No customer found with ID 12345 in Shopify",
                  "status": 404,
                  "title": "Customer not found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Customer not found in Shopify"
          },
          "429": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Shopify API rate limit exceeded. Please retry after 60 seconds.",
                  "retryAfter": 60,
                  "status": 429,
                  "title": "Rate limit exceeded",
                  "type": "https://example.com/errors/rate-limit"
                }
              }
            },
            "description": "Rate limit exceeded - Shopify API rate limit hit"
          },
          "502": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Failed to retrieve payment methods from Shopify. Please try again later.",
                  "status": 502,
                  "title": "Shopify API error",
                  "type": "https://example.com/errors/bad-gateway"
                }
              }
            },
            "description": "Bad gateway - Shopify API error"
          }
        },
        "summary": "Get customer payment methods from Shopify",
        "tags": [
          "Customers",
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-contract-details/split-existing-contract": {
      "post": {
        "description": "Creates a new subscription contract by either splitting (moving) or duplicating selected line items from an existing contract. This endpoint allows you to divide a subscription into multiple contracts or create a copy with specific products.\n\n**Split vs Duplicate Mode:**\n- **Split (isSplitContract=true)**: Moves the selected line items from the original contract to a new contract. The original contract will no longer contain these items.\n- **Duplicate (isSplitContract=false)**: Creates a new contract with copies of the selected line items while keeping them in the original contract.\n\n**Important Notes:**\n- When splitting, at least one subscription product must remain in the original contract\n- The new contract inherits all settings from the original: customer, payment method, billing/delivery policies, shipping address, and custom attributes\n- Billing schedule is automatically generated for the new contract\n- One-time products and free products don't count towards the minimum product requirement\n\n**Use Cases:**\n- Split a subscription when customer wants different delivery schedules for different products\n- Create a gift subscription from an existing subscription\n- Separate products for different shipping addresses\n- Duplicate a subscription for testing or backup purposes\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "splitExistingContract",
        "parameters": [
          {
            "deprecated": true,
            "description": "API Key (Deprecated)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Subscription contract ID",
            "in": "query",
            "name": "contractId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "Split or duplicate mode",
            "in": "query",
            "name": "isSplitContract",
            "required": false,
            "schema": {
              "default": false,
              "type": "boolean"
            }
          },
          {
            "description": "Attempt billing immediately",
            "in": "query",
            "name": "attemptBilling",
            "required": false,
            "schema": {
              "default": false,
              "type": "boolean"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "billingPolicy": {
                        "interval": "MONTH",
                        "intervalCount": 1
                      },
                      "customAttributes": [
                        {
                          "key": "_origin_type",
                          "value": "SPLIT_CONTRACT"
                        },
                        {
                          "key": "_original_contract_id",
                          "value": "123456789"
                        }
                      ],
                      "customer": {
                        "email": "customer@example.com",
                        "id": "gid://shopify/Customer/111111"
                      },
                      "deliveryPolicy": {
                        "interval": "MONTH",
                        "intervalCount": 1
                      },
                      "id": "gid://shopify/SubscriptionContract/987654321",
                      "lines": {
                        "edges": [
                          {
                            "node": {
                              "currentPrice": {
                                "amount": "29.99",
                                "currencyCode": "USD"
                              },
                              "id": "gid://shopify/SubscriptionLine/222222",
                              "quantity": 2,
                              "title": "Premium Coffee - Medium Roast",
                              "variantId": "gid://shopify/ProductVariant/333333"
                            }
                          }
                        ]
                      },
                      "nextBillingDate": "2024-02-15T00:00:00Z",
                      "originOrder": {
                        "id": "gid://shopify/Order/123456789"
                      },
                      "status": "ACTIVE"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Contract successfully split/duplicated"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "All Products Selected": {
                    "description": "All Products Selected",
                    "value": {
                      "detail": "When splitting a contract, you cannot move all products. At least one subscription product must remain.",
                      "status": 400,
                      "title": "UserGeneratedError:All products cannot be selected, at least one product is required in the current contract.",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Contract Not Found": {
                    "description": "Contract Not Found",
                    "value": {
                      "detail": "The specified contract ID does not exist or you don't have access to it",
                      "status": 400,
                      "title": "UserGeneratedError:Subscription contract not found for given contract id",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Line IDs": {
                    "description": "Invalid Line IDs",
                    "value": {
                      "detail": "None of the provided line IDs exist in the contract",
                      "status": 400,
                      "title": "No valid line items found",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "No Payment Method": {
                    "description": "No Payment Method",
                    "value": {
                      "detail": "The original contract's customer must have a valid payment method",
                      "status": 400,
                      "title": "UserGeneratedError:No Payment methods found for the customer",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid request parameters or business rule violation"
          },
          "401": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Authentication required - missing or invalid API key"
          },
          "403": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Insufficient permissions to split subscription contracts"
          }
        },
        "summary": "Split or duplicate an existing subscription contract",
        "tags": [
          "Subscription Management",
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-contract-details/subscription-fulfillments/{contractId}": {
      "get": {
        "description": "Retrieves fulfillment information for the most recent successful order associated with a subscription contract. This includes tracking details, shipment status, delivery estimates, and fulfillment line items from Shopify.\n\n**What This Endpoint Returns:**\nComplete fulfillment data for the subscription's last successfully billed order, queried in real-time from Shopify's GraphQL API. Shows customers when and how their subscription items will be (or were) delivered.\n\n**Fulfillment Data Included:**\n\n**Shipment Tracking:**\n- Tracking numbers and URLs\n- Carrier information (USPS, FedEx, UPS, etc.)\n- Tracking company details\n- Tracking status updates\n\n**Delivery Status:**\n- Fulfillment status (fulfilled, in_transit, out_for_delivery, delivered, etc.)\n- Estimated delivery date\n- Actual delivery timestamp (if delivered)\n- Delivery method (shipping, pickup, local delivery)\n\n**Fulfillment Details:**\n- Fulfilled line items (which products shipped)\n- Quantities fulfilled\n- Fulfillment service (manual, automated, 3PL)\n- Fulfillment created/updated dates\n- Multiple fulfillments (if order shipped in parts)\n\n**Location Information:**\n- Fulfillment location/warehouse\n- Origin address details\n- Fulfillment service name\n\n**Order Determination Logic:**\n\n**Which Order is Retrieved:**\n1. Finds most recent SUCCESS billing attempt for contract\n2. If found: Uses that order's Shopify order ID\n3. If none: Falls back to subscription's origin order ID\n4. Queries Shopify for that order's fulfillments\n\n**Why This Matters:**\n- Shows CURRENT/LATEST fulfillment status\n- Not historical fulfillments from months ago\n- Reflects what customer is waiting for NOW\n- Updates after each new billing cycle\n\n**Use Cases:**\n\n**1. Customer Portal \"Where's My Order\":**\n- Display tracking information\n- Show estimated delivery date\n- Provide carrier tracking links\n- Update fulfillment status\n\n**2. Subscription Order Tracking:**\n- Track recurring order deliveries\n- Monitor fulfillment progress\n- Identify delayed shipments\n- Provide proactive delivery updates\n\n**3. Customer Support:**\n- Answer \"where is my order\" questions\n- Verify shipment details\n- Troubleshoot delivery issues\n- Provide accurate tracking info\n\n**4. Automated Notifications:**\n- Send tracking emails automatically\n- Notify customers of shipments\n- Alert on delivery completion\n- Trigger review request flows\n\n**5. Subscription Management:**\n- Show fulfillment in subscription history\n- Display delivery patterns\n- Track fulfillment reliability\n- Monitor shipping performance\n\n**Response Structure:**\n\nReturns Shopify Order object with fulfillments:\n```json\n{\n  \"id\": \"gid://shopify/Order/123456789\",\n  \"name\": \"#1001\",\n  \"fulfillmentOrders\": {\n    \"edges\": [\n      {\n        \"node\": {\n          \"id\": \"gid://shopify/FulfillmentOrder/111111\",\n          \"status\": \"SUCCESS\",\n          \"fulfillments\": {\n            \"edges\": [\n              {\n                \"node\": {\n                  \"trackingInfo\": [\n                    {\n                      \"number\": \"1Z999AA10123456784\",\n                      \"url\": \"https://wwwapps.ups.com/tracking/...\",\n                      \"company\": \"UPS\"\n                    }\n                  ],\n                  \"status\": \"IN_TRANSIT\",\n                  \"estimatedDeliveryAt\": \"2024-03-20T00:00:00Z\",\n                  \"deliveredAt\": null\n                }\n              }\n            ]\n          }\n        }\n      }\n    ]\n  }\n}\n```\n\n**Common Scenarios:**\n\n**Scenario: Order Fulfilled & Shipped**\n```json\n{\n  \"trackingInfo\": [{\"number\": \"9400...\", \"company\": \"USPS\"}],\n  \"status\": \"IN_TRANSIT\",\n  \"estimatedDeliveryAt\": \"2024-03-18T00:00:00Z\"\n}\n```\n\n**Scenario: Order Delivered**\n```json\n{\n  \"status\": \"DELIVERED\",\n  \"deliveredAt\": \"2024-03-15T14:23:00Z\"\n}\n```\n\n**Scenario: Not Yet Fulfilled**\n```json\n{\n  \"fulfillmentOrders\": {\n    \"edges\": [\n      {\n        \"node\": {\n          \"status\": \"OPEN\",\n          \"fulfillments\": {\"edges\": []}\n        }\n      }\n    ]\n  }\n}\n```\n\n**Scenario: No Order Yet (New Subscription)**\nReturns `null` or empty response\n\n**Important Considerations:**\n\n**Real-Time Shopify Query:**\n- Makes live call to Shopify GraphQL API\n- NOT cached data\n- Response time: 500-1500ms\n- Subject to Shopify rate limits\n\n**Data Freshness:**\n- Returns current fulfillment status from Shopify\n- Tracking updates reflect Shopify's data\n- May lag behind carrier's actual status\n- Shopify updates tracking periodically\n\n**Null Responses:**\n- Returns null if no orders exist yet\n- Returns null if order ID not found\n- Handle gracefully in UI\n\n**Multiple Fulfillments:**\n- Order may have multiple fulfillments (split shipments)\n- Each fulfillment has own tracking\n- Iterate through all fulfillment nodes\n\n**Integration Example:**\n\n**Customer Portal - Track Shipment:**\n```javascript\nconst order = await fetch(\n  `/api/external/v2/subscription-contract-details/subscription-fulfillments/${contractId}`,\n  { headers: { 'X-API-Key': 'your-key' } }\n).then(r => r.json());\n\nif (!order) {\n  return '<p>No shipment information available yet.</p>';\n}\n\nconst fulfillments = order.fulfillmentOrders?.edges || [];\nfulfillments.forEach(fo => {\n  fo.node.fulfillments?.edges?.forEach(f => {\n    const tracking = f.node.trackingInfo?.[0];\n    if (tracking) {\n      console.log(`Track with ${tracking.company}: ${tracking.number}`);\n      console.log(`URL: ${tracking.url}`);\n    }\n  });\n});\n```\n\n**Best Practices:**\n\n1. **Cache Response**: Cache for 30-60 minutes to reduce Shopify API calls\n2. **Handle Nulls**: Always check for null/empty responses\n3. **Parse GraphQL**: Navigate edges/nodes structure carefully\n4. **Show All Tracking**: Display all fulfillments if multiple shipments\n5. **Link to Carrier**: Provide clickable tracking URLs\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "getSubscriptionFulfillmentsExternalV2",
        "parameters": [
          {
            "description": "Contract ID",
            "in": "path",
            "name": "contractId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Order"
                }
              }
            },
            "description": "Successfully retrieved fulfillment details (may be null if no orders exist)"
          },
          "400": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contract ID must be a valid positive integer",
                  "status": 400,
                  "title": "Invalid contract ID",
                  "type": "https://example.com/errors/bad-request"
                }
              }
            },
            "description": "Bad request - Invalid contract ID"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header is required",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contract does not belong to your shop",
                  "status": 403,
                  "title": "Access denied",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Forbidden - Contract does not belong to authenticated shop"
          },
          "502": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Failed to retrieve fulfillment data from Shopify",
                  "status": 502,
                  "title": "Shopify API error",
                  "type": "https://example.com/errors/bad-gateway"
                }
              }
            },
            "description": "Bad gateway - Shopify API error"
          }
        },
        "summary": "Get subscription fulfillment details for latest order",
        "tags": [
          "Subscription Management",
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-contract-one-offs-by-contractId": {
      "get": {
        "description": "Retrieves all one-time products (add-ons) associated with a specific subscription contract across all billing attempts. One-time products are additional items that customers can add to their subscription orders on a non-recurring basis. Each one-time product is tied to a specific billing attempt and will only be included in that particular order.\n\n**Key Features:**\n- Returns ALL one-time products across all queued billing attempts\n- Each product includes the billing attempt ID to identify which order it belongs to\n- Includes product details: variant ID, quantity, title, image, and price\n- Products are automatically removed after the associated billing attempt is processed\n\n**Use Cases:**\n- Display all one-time products added to a subscription across all upcoming orders\n- Allow customers to review their one-time add-ons in customer portal\n- Enable merchants to see all one-time products for a contract\n- Integrate with external systems to manage subscription add-ons\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "getOneOffsForSubscriptionContractV2",
        "parameters": [
          {
            "deprecated": true,
            "description": "API Key (Deprecated - Use X-API-Key header instead)",
            "example": "apst_your-api-key-here",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key for authentication. This key identifies your shop and must be included in the X-API-Key header.",
            "example": "apst_your-api-key-here",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "The unique identifier of the subscription contract to retrieve one-time products for",
            "example": 98765,
            "in": "query",
            "name": "contractId",
            "required": true,
            "schema": {
              "description": "Must be a valid contract ID that belongs to the authenticated shop",
              "format": "int64",
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": [
                      {
                        "billingAttemptId": 11111,
                        "contractId": 67890,
                        "createdAt": "2024-01-15T10:30:00Z",
                        "currencyCode": "USD",
                        "id": 12345,
                        "image": "https://cdn.shopify.com/s/files/1/0000/0000/products/filter.jpg",
                        "price": "9.99",
                        "productTitle": "Coffee Filters - Pack of 100",
                        "quantity": 2,
                        "shop": "example-shop.myshopify.com",
                        "updatedAt": "2024-01-15T10:30:00Z",
                        "variantId": 22222,
                        "variantTitle": "Standard Size"
                      },
                      {
                        "billingAttemptId": 11112,
                        "contractId": 67890,
                        "createdAt": "2024-01-16T14:20:00Z",
                        "currencyCode": "USD",
                        "id": 12346,
                        "image": "https://cdn.shopify.com/s/files/1/0000/0000/products/scoop.jpg",
                        "price": "14.99",
                        "productTitle": "Coffee Scoop",
                        "quantity": 1,
                        "shop": "example-shop.myshopify.com",
                        "updatedAt": "2024-01-16T14:20:00Z",
                        "variantId": 33333,
                        "variantTitle": "Stainless Steel"
                      }
                    ]
                  }
                },
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/SubscriptionContractOneOffDTO"
                  },
                  "type": "array"
                }
              }
            },
            "description": "Successfully retrieved one-time products"
          },
          "400": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contract does not belong to this shop",
                  "status": 400,
                  "title": "Invalid contract",
                  "type": "https://example.com/errors/bad-request"
                }
              }
            },
            "description": "Invalid contract ID or contract doesn't belong to authenticated shop"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header is required",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to view one-time products",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to view one-time products"
          }
        },
        "summary": "Get all one-time products for a subscription contract",
        "tags": [
          "Subscription One-Time Products",
          "Product Catalog"
        ]
      }
    },
    "/api/external/v2/subscription-contract-one-offs-by-contractId-and-billing-attempt-id": {
      "delete": {
        "description": "Removes a previously added one-time product from a specific subscription order. This permanently deletes the one-time product from the specified billing attempt. The operation is idempotent - attempting to delete a non-existent product will succeed without error.\n\n**Important Notes:**\n- Only removes the product from the specified billing attempt\n- Cannot remove products from billing attempts that are already processed\n- Activity logs are created for audit trails\n- Returns the updated list of all one-time products for the contract\n\n**Use Cases:**\n- Allow customers to remove unwanted add-ons before order processing\n- Clean up cart-like functionality in customer portals\n- Programmatically manage one-time product selections\n- Implement \"undo\" functionality for product additions\n\n**Business Rules:**\n- Contract must belong to the authenticated shop\n- The specific combination of contractId + billingAttemptId + variantId identifies the product to remove\n- No error is thrown if the product doesn't exist (idempotent operation)\n\n**Authentication:** Requires valid X-API-Key header that identifies the shop",
        "operationId": "deleteOneOffByV2",
        "parameters": [
          {
            "deprecated": true,
            "description": "API Key (Deprecated - Use X-API-Key header instead)",
            "example": "apst_your-api-key-here",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key for authentication. This key identifies your shop and must be included in the X-API-Key header.",
            "example": "apst_your-api-key-here",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "The unique identifier of the subscription contract",
            "example": 98765,
            "in": "query",
            "name": "contractId",
            "required": true,
            "schema": {
              "format": "int64",
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "The billing attempt ID that contains the product to remove",
            "example": 54321,
            "in": "query",
            "name": "billingAttemptId",
            "required": true,
            "schema": {
              "format": "int64",
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "The Shopify product variant ID to remove from the one-time purchases",
            "example": 42549172011164,
            "in": "query",
            "name": "variantId",
            "required": true,
            "schema": {
              "format": "int64",
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "All Products Removed": {
                    "description": "Last one-time product was removed. Contract now has no one-time products.",
                    "value": []
                  },
                  "Multiple Products Remain": {
                    "description": "One product removed, multiple products remain across different billing attempts",
                    "value": [
                      {
                        "billingAttemptId": 54321,
                        "id": 12347,
                        "price": 14.99,
                        "quantity": 1,
                        "shop": "example-store.myshopify.com",
                        "subscriptionContractId": 98765,
                        "variantHandle": "seasonal-blend-250g",
                        "variantId": 42549172011166
                      },
                      {
                        "billingAttemptId": 54322,
                        "id": 12348,
                        "price": 39.99,
                        "quantity": 1,
                        "shop": "example-store.myshopify.com",
                        "subscriptionContractId": 98765,
                        "variantHandle": "coffee-grinder-manual",
                        "variantId": 42549172011167
                      }
                    ]
                  },
                  "Product Didn't Exist": {
                    "description": "Attempted to remove non-existent product. Operation succeeds, returns existing products.",
                    "value": [
                      {
                        "billingAttemptId": 54322,
                        "id": 12346,
                        "price": 8.99,
                        "quantity": 1,
                        "shop": "example-store.myshopify.com",
                        "subscriptionContractId": 98765,
                        "variantHandle": "coffee-filters-pack-100",
                        "variantId": 42549172011165
                      }
                    ]
                  },
                  "Product Removed Successfully": {
                    "description": "Product was removed. Response shows remaining one-time products.",
                    "value": [
                      {
                        "billingAttemptId": 54321,
                        "id": 12345,
                        "price": 19.99,
                        "quantity": 2,
                        "shop": "example-store.myshopify.com",
                        "subscriptionContractId": 98765,
                        "variantHandle": "premium-coffee-blend-500g",
                        "variantId": 42549172011164
                      }
                    ]
                  }
                },
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/SubscriptionContractOneOffDTO"
                  },
                  "type": "array"
                }
              }
            },
            "description": "Successfully removed the one-time product or product didn't exist. Returns all remaining one-time products for the contract."
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Invalid Parameter Format": {
                    "description": "Invalid Parameter Format",
                    "value": {
                      "detail": "Failed to convert value of type 'java.lang.String' to required type 'java.lang.Long'; For input string: 'invalid'",
                      "status": 400,
                      "title": "Bad Request",
                      "type": "https://example.com/probs/bad-request"
                    }
                  },
                  "Missing Required Parameter": {
                    "description": "Missing Required Parameter",
                    "value": {
                      "detail": "Required request parameter 'variantId' for method parameter type Long is not present",
                      "status": 400,
                      "title": "Bad Request",
                      "type": "https://example.com/probs/bad-request"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request parameters"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Full authentication is required to access this resource",
                  "status": 401,
                  "title": "Unauthorized",
                  "type": "https://example.com/probs/unauthorized"
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Authentication required - missing or invalid API key"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Access denied - contract does not belong to authenticated shop",
                  "status": 403,
                  "title": "Forbidden",
                  "type": "https://example.com/probs/forbidden"
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Forbidden - contract belongs to different shop or insufficient permissions"
          }
        },
        "summary": "Remove one-time product from subscription order",
        "tags": [
          "Subscription One-Time Products"
        ]
      },
      "put": {
        "deprecated": true,
        "description": "**Discontinued.** One-time products are no longer applied to the generated order or cleaned up afterward \u2014 this endpoint now always returns 400 and creates nothing. Do not build new integrations against it.",
        "operationId": "saveOneOffByV2",
        "parameters": [
          {
            "deprecated": true,
            "description": "API Key (Deprecated - Use X-API-Key header instead)",
            "example": "apst_your-api-key-here",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key for authentication. This key identifies your shop and must be included in the X-API-Key header.",
            "example": "apst_your-api-key-here",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "The unique identifier of the subscription contract",
            "example": 98765,
            "in": "query",
            "name": "contractId",
            "required": true,
            "schema": {
              "format": "int64",
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "The billing attempt ID to add the product to. If invalid or not QUEUED, the system will automatically use the next upcoming order.",
            "example": 54321,
            "in": "query",
            "name": "billingAttemptId",
            "required": true,
            "schema": {
              "format": "int64",
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "The Shopify product variant ID to add as a one-time purchase",
            "example": 42549172011164,
            "in": "query",
            "name": "variantId",
            "required": true,
            "schema": {
              "format": "int64",
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "The handle/slug of the product variant for URL-friendly identification",
            "example": "premium-coffee-blend-500g",
            "in": "query",
            "name": "variantHandle",
            "required": true,
            "schema": {
              "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$",
              "type": "string"
            }
          },
          {
            "description": "The quantity of the product to add. Defaults to 1 if not specified.",
            "example": 2,
            "in": "query",
            "name": "quantity",
            "required": false,
            "schema": {
              "default": 1,
              "maximum": 999,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "First Product Added": {
                    "description": "First one-time product added to this contract",
                    "value": [
                      {
                        "billingAttemptId": 54321,
                        "id": 12351,
                        "price": 34.99,
                        "quantity": 3,
                        "shop": "example-store.myshopify.com",
                        "subscriptionContractId": 98765,
                        "variantHandle": "limited-edition-roast",
                        "variantId": 42549172011168
                      }
                    ]
                  },
                  "Product Added Successfully": {
                    "description": "New product added to the list. Response includes all one-time products for the contract.",
                    "value": [
                      {
                        "billingAttemptId": 54321,
                        "id": 12345,
                        "price": 19.99,
                        "quantity": 2,
                        "shop": "example-store.myshopify.com",
                        "subscriptionContractId": 98765,
                        "variantHandle": "premium-coffee-blend-500g",
                        "variantId": 42549172011164
                      },
                      {
                        "billingAttemptId": 54321,
                        "id": 12350,
                        "price": 29.99,
                        "quantity": 1,
                        "shop": "example-store.myshopify.com",
                        "subscriptionContractId": 98765,
                        "variantHandle": "coffee-sampler-pack",
                        "variantId": 42549172011167
                      }
                    ]
                  },
                  "Product Already Exists": {
                    "description": "Product already exists in the billing attempt. No duplicate created. Returns existing list.",
                    "value": [
                      {
                        "billingAttemptId": 54321,
                        "id": 12345,
                        "price": 19.99,
                        "quantity": 2,
                        "shop": "example-store.myshopify.com",
                        "subscriptionContractId": 98765,
                        "variantHandle": "premium-coffee-blend-500g",
                        "variantId": 42549172011164
                      }
                    ]
                  }
                },
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/SubscriptionContractOneOffDTO"
                  },
                  "type": "array"
                }
              }
            },
            "description": "Successfully added one-time product or product already exists. Returns all one-time products for the contract."
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Contract Frozen": {
                    "description": "Contract has minimum cycle requirements that prevent modifications",
                    "value": {
                      "detail": "Order modifications are frozen until minimum cycle requirements are met",
                      "status": 400,
                      "title": "Bad Request",
                      "type": "https://example.com/probs/bad-request",
                      "violations": {
                        "field": "contractId",
                        "message": "frozen_until_min_cycles"
                      }
                    }
                  },
                  "Invalid Parameter Format": {
                    "description": "Invalid Parameter Format",
                    "value": {
                      "detail": "Failed to convert value of type 'java.lang.String' to required type 'java.lang.Integer'; For input string: 'abc'",
                      "status": 400,
                      "title": "Bad Request",
                      "type": "https://example.com/probs/bad-request"
                    }
                  },
                  "Missing Required Parameter": {
                    "description": "Missing Required Parameter",
                    "value": {
                      "detail": "Required request parameter 'variantId' for method parameter type Long is not present",
                      "status": 400,
                      "title": "Bad Request",
                      "type": "https://example.com/probs/bad-request"
                    }
                  },
                  "No Upcoming Orders": {
                    "description": "No QUEUED billing attempts exist for this contract",
                    "value": {
                      "detail": "There is no upcoming order scheduled.",
                      "status": 400,
                      "title": "Bad Request",
                      "type": "https://example.com/probs/bad-request",
                      "violations": {
                        "field": "data",
                        "message": "idnull"
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Bad request - validation failed or business rule violation"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Full authentication is required to access this resource",
                  "status": 401,
                  "title": "Unauthorized",
                  "type": "https://example.com/probs/unauthorized"
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Authentication required - missing or invalid API key"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Access denied - contract does not belong to authenticated shop",
                  "status": 403,
                  "title": "Forbidden",
                  "type": "https://example.com/probs/forbidden"
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Forbidden - contract belongs to different shop or insufficient permissions"
          }
        },
        "summary": "Add one-time product to subscription order",
        "tags": [
          "Subscription One-Time Products"
        ]
      }
    },
    "/api/external/v2/subscription-contracts-add-discount": {
      "put": {
        "description": "Creates and applies a custom manual discount to an existing subscription contract. This powerful endpoint supports multiple discount types and configurations for flexible pricing strategies.\n\n**Discount Types:**\n- **PERCENTAGE**: Percentage off the order (e.g., 10% off)\n- **FIXED**: Fixed amount off the order (e.g., $10 off)\n- **PRICE**: Override price (sets total to specific amount)\n\n**Key Features:**\n- Custom discount titles for easy identification\n- Cycle limits for time-bound promotions\n- Per-item or subtotal application options\n- Stacks with other discounts per Shopify rules\n- Automatic shipping price recalculation\n- Activity logging for audit trails\n\n**Application Methods:**\n- **Subtotal Discount** (appliesOnEachItem=false): Applied to order total after line item calculations\n- **Per-Item Discount** (appliesOnEachItem=true): Applied to each line item individually\n\n**Cycle Limits:**\n- Set recurringCycleLimit to apply discount for specific number of orders\n- Leave null for unlimited duration\n- Useful for '3 months at 20% off' promotions\n\n**Retention Campaigns:**\nThis endpoint integrates with cancellation retention workflows:\n- Can trigger merchant notifications\n- Tracks discount usage for retention analytics\n- Helps prevent churn with targeted offers\n\n**Important Notes:**\n- Discounts apply to future orders only\n- Cannot modify discounts once applied (must remove and re-add)\n- Some discount combinations may not be allowed by Shopify\n- Price overrides should be used carefully\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "addDiscountV2",
        "parameters": [
          {
            "description": "Subscription contract ID to apply discount to. Provide the numeric ID without the gid:// prefix",
            "example": 123456789,
            "in": "query",
            "name": "contractId",
            "required": true,
            "schema": {
              "format": "int64",
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "deprecated": true,
            "description": "API Key (Deprecated - Use X-API-Key header instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key for authentication",
            "example": "apst_your-api-key-here",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Discount percentage (1-100). Required when discountType is PERCENTAGE",
            "example": 10,
            "in": "query",
            "name": "percentage",
            "required": false,
            "schema": {
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "Custom title for the discount. If not provided, a default title will be generated",
            "example": "Loyalty Discount",
            "in": "query",
            "name": "discountTitle",
            "required": false,
            "schema": {
              "maxLength": 255,
              "type": "string"
            }
          },
          {
            "description": "Number of billing cycles the discount applies to. Leave null for unlimited duration",
            "example": 3,
            "in": "query",
            "name": "recurringCycleLimit",
            "required": false,
            "schema": {
              "maximum": 9999,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "Application method: true = apply to each line item individually, false = apply to order subtotal",
            "example": false,
            "in": "query",
            "name": "appliesOnEachItem",
            "required": false,
            "schema": {
              "default": false,
              "type": "boolean"
            }
          },
          {
            "description": "Fixed discount amount in store currency. Required when discountType is FIXED or PRICE",
            "example": 10.99,
            "in": "query",
            "name": "amount",
            "required": false,
            "schema": {
              "format": "double",
              "maximum": 999999.99,
              "minimum": 0.01,
              "type": "number"
            }
          },
          {
            "description": "Type of discount to apply",
            "example": "PERCENTAGE",
            "in": "query",
            "name": "discountType",
            "required": false,
            "schema": {
              "enum": [
                "PERCENTAGE",
                "FIXED",
                "PRICE"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "customer": {
                        "email": "customer@example.com",
                        "id": "gid://shopify/Customer/987654321"
                      },
                      "discounts": {
                        "edges": [
                          {
                            "node": {
                              "id": "gid://shopify/SubscriptionManualDiscount/555555",
                              "recurringCycleLimit": 3,
                              "targetType": "ALL_LINES",
                              "title": "Loyalty Discount",
                              "type": "MANUAL",
                              "value": {
                                "percentage": 10.0
                              }
                            }
                          }
                        ]
                      },
                      "id": "gid://shopify/SubscriptionContract/123456789",
                      "lines": {
                        "edges": [
                          {
                            "node": {
                              "currentPrice": {
                                "amount": "29.99",
                                "currencyCode": "USD"
                              },
                              "id": "gid://shopify/SubscriptionLine/111111",
                              "quantity": 1,
                              "variantId": "gid://shopify/ProductVariant/42549172011164"
                            }
                          }
                        ]
                      },
                      "nextBillingDate": "2024-04-01T12:00:00Z",
                      "status": "ACTIVE"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Discount successfully added"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Invalid Cycle Limit": {
                    "description": "Invalid Cycle Limit",
                    "value": {
                      "detail": "Recurring cycle limit must be a positive integer",
                      "status": 400,
                      "title": "Invalid cycle limit",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Discount Type": {
                    "description": "Invalid Discount Type",
                    "value": {
                      "detail": "Discount type must be one of: PERCENTAGE, FIXED, PRICE",
                      "status": 400,
                      "title": "Invalid discount type",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Percentage Value": {
                    "description": "Invalid Percentage Value",
                    "value": {
                      "detail": "Percentage must be between 1 and 100",
                      "status": 400,
                      "title": "Invalid percentage value",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Missing Required Parameter": {
                    "description": "Missing Required Parameter",
                    "value": {
                      "detail": "Percentage is required when discountType is PERCENTAGE",
                      "status": 400,
                      "title": "Invalid discount parameters",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid parameters for discount creation"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid API key is required to access this endpoint",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required - missing or invalid API key"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to modify subscription contracts",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to modify subscription"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Subscription contract with ID 123456789 not found",
                  "status": 404,
                  "title": "Resource not found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Subscription contract not found"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "Conflicting Discounts": {
                    "description": "Conflicting Discounts",
                    "value": {
                      "detail": "This discount cannot be combined with existing discounts on the subscription",
                      "status": 422,
                      "title": "Discount conflict",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  },
                  "Shopify API Error": {
                    "description": "Shopify API Error",
                    "value": {
                      "detail": "Shopify API error: Cannot modify subscription during active billing attempt",
                      "status": 422,
                      "title": "Unable to apply discount",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  }
                }
              }
            },
            "description": "Discount parameters valid but cannot be applied"
          }
        },
        "summary": "Add custom discount to subscription",
        "tags": [
          "Subscription Contracts",
          "Subscription Discounts"
        ]
      }
    },
    "/api/external/v2/subscription-contracts-add-line-item": {
      "put": {
        "description": "Adds a new product line item to an existing subscription contract. Can add either recurring products that will appear in each order or one-time products that appear only in the next order.\n\n**Key Features:**\n- Supports both recurring and one-time product additions\n- Automatically applies appropriate pricing policies based on discount carry-forward settings\n- Handles duplicate products by updating quantity (if enabled) or adding as new line\n- Calculates prices based on billing/delivery frequency multipliers\n- Sends email notifications to customers (unless suppressed)\n- Creates activity logs for audit trail\n\n**Pricing Policy Application:**\nThe system applies discounts based on the store's discount carry-forward setting:\n- **PRODUCT_PLAN**: Uses the discount from the product's selling plan\n- **EXISTING_PLAN**: Applies the discount structure from existing subscription items\n- **PRODUCT_THEN_EXISTING**: First attempts product plan, falls back to existing if not found\n\n**One-Time Products:**\nProducts added with `isOneTimeProduct=true` will:\n- Only appear in the next scheduled order\n- Be removed automatically after the next order bills successfully\n- Still attempt to match with appropriate selling plans\n- Can have subscription discounts applied if store setting allows\n\n**Duplicate Product Handling:**\nWhen adding a product that already exists in the subscription:\n- If store has 'updateExistingQuantityOnAddProduct' enabled and product is not one-time: Updates existing quantity\n- Otherwise: Adds as a new line item\n\n**Price Calculation:**\n- Base price is fetched considering contract currency and delivery country\n- Price is multiplied by fulfillment frequency ratio (billing interval / delivery interval)\n- Example: Monthly billing with weekly delivery = price \u00d7 4\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "addLineItemV2",
        "parameters": [
          {
            "description": "Subscription contract ID to add product to. Provide the numeric ID without the gid:// prefix",
            "example": 123456789,
            "in": "query",
            "name": "contractId",
            "required": true,
            "schema": {
              "pattern": "^[0-9]+$",
              "type": "string"
            }
          },
          {
            "deprecated": true,
            "description": "API Key (Deprecated - Use X-API-Key header instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key for authentication",
            "example": "apst_your-api-key-here",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Quantity of product to add. Must be a positive integer",
            "example": 2,
            "in": "query",
            "name": "quantity",
            "required": true,
            "schema": {
              "maximum": 999,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "Shopify variant ID of the product to add. Can be provided as numeric ID or with gid:// prefix",
            "example": 42549172011164,
            "in": "query",
            "name": "variantId",
            "required": true,
            "schema": {
              "pattern": "^([0-9]+|gid://shopify/ProductVariant/[0-9]+)$",
              "type": "string"
            }
          },
          {
            "description": "When true, product will only be included in the next order and automatically removed after that order bills successfully. When false, product will be included in all future orders until manually removed or subscription ends. One-time products are useful for samples, gifts, or limited-time additions",
            "example": false,
            "in": "query",
            "name": "isOneTimeProduct",
            "required": false,
            "schema": {
              "default": false,
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "billingPolicy": {
                        "interval": "MONTH",
                        "intervalCount": 1
                      },
                      "customer": {
                        "email": "customer@example.com",
                        "firstName": "John",
                        "id": "gid://shopify/Customer/987654321",
                        "lastName": "Doe"
                      },
                      "deliveryPolicy": {
                        "interval": "MONTH",
                        "intervalCount": 1
                      },
                      "id": "gid://shopify/SubscriptionContract/123456789",
                      "lines": {
                        "edges": [
                          {
                            "node": {
                              "currentPrice": {
                                "amount": "29.99",
                                "currencyCode": "USD"
                              },
                              "id": "gid://shopify/SubscriptionLine/111111",
                              "quantity": 2,
                              "sellingPlanId": "gid://shopify/SellingPlan/123456",
                              "sellingPlanName": "Deliver every month",
                              "variantId": "gid://shopify/ProductVariant/42549172011164"
                            }
                          },
                          {
                            "node": {
                              "currentPrice": {
                                "amount": "19.99",
                                "currencyCode": "USD"
                              },
                              "customAttributes": [
                                {
                                  "key": "_one_time_product",
                                  "value": "true"
                                }
                              ],
                              "id": "gid://shopify/SubscriptionLine/222222",
                              "quantity": 1,
                              "variantId": "gid://shopify/ProductVariant/98765432101"
                            }
                          }
                        ]
                      },
                      "nextBillingDate": "2024-03-01T00:00:00Z",
                      "status": "ACTIVE"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Product successfully added to subscription"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Build-a-Box Validation Error": {
                    "description": "Build-a-Box Validation Error",
                    "value": {
                      "detail": "Adding this quantity would exceed the maximum allowed items for this build-a-box subscription",
                      "status": 400,
                      "title": "UserGeneratedError:Build-a-box quantity limit exceeded",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Contract ID": {
                    "description": "Invalid Contract ID",
                    "value": {
                      "detail": "No subscription contract found with ID: 123456789",
                      "status": 400,
                      "title": "UserGeneratedError:Subscription contract not found",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Quantity": {
                    "description": "Invalid Quantity",
                    "value": {
                      "detail": "Quantity must be greater than 0",
                      "status": 400,
                      "title": "UserGeneratedError:Invalid quantity",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Product Variant Not Found": {
                    "description": "Product Variant Not Found",
                    "value": {
                      "detail": "The specified product variant does not exist in the store",
                      "status": 400,
                      "title": "Product Variant not found for ID: 99999999999",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid request parameters or business rule violation"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid API key is required to access this endpoint",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required - missing or invalid API key"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to modify subscription contracts",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to modify subscription"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Subscription contract with ID 123456789 not found",
                  "status": 404,
                  "title": "Resource not found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Subscription contract not found"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "Draft Commit Error": {
                    "description": "Draft Commit Error",
                    "value": {
                      "detail": "Unable to commit subscription changes: Billing attempt in progress",
                      "status": 422,
                      "title": "subscriptionDraftCommitError",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  },
                  "Shopify GraphQL Error": {
                    "description": "Shopify GraphQL Error",
                    "value": {
                      "detail": "Shopify API error: Product is not available for subscription",
                      "status": 422,
                      "title": "subscriptionDraftLineAddError",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  }
                }
              }
            },
            "description": "Unable to process the request due to Shopify API constraints"
          }
        },
        "summary": "Add product to subscription",
        "tags": [
          "Subscription Products",
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-contracts-add-line-items": {
      "put": {
        "description": "Adds multiple product line items to an existing subscription contract in a single request. This batch operation is more efficient than making multiple individual requests and ensures all products are added with consistent processing.\n\n**Key Features:**\n- Batch addition of multiple products in one API call\n- All products are added as recurring items (not one-time)\n- Automatic quantity defaulting (0 or null becomes 1)\n- Sequential processing with full validation for each item\n- Returns final subscription state after all additions\n- Same pricing and discount logic as single-item endpoint\n\n**Processing Behavior:**\n- Products are added sequentially, not in parallel\n- If any product fails, previous additions remain\n- Each product goes through full validation\n- Existing product handling follows store settings\n- Activity logs created for each product added\n\n**Duplicate Product Handling:**\nIf a product already exists in the subscription:\n- With 'updateExistingQuantityOnAddProduct' enabled: Updates quantity\n- Without setting: Adds as new line item\n- Setting applies to all products in the batch\n\n**Pricing and Discounts:**\nEach product receives:\n- Appropriate selling plan assignment\n- Discount carry-forward based on store settings\n- Currency and country-specific pricing\n- Fulfillment frequency multiplier application\n\n**Build-a-Box Validation:**\n- Applied if any product has _bb_id attribute\n- Validates total quantity after all additions\n- May fail entire batch if limits exceeded\n\n**Post-Processing:**\nAfter all products are added:\n- Build-a-Box discounts recalculated once\n- Product discounts synchronized\n- Single email notification sent\n- Shipping price updated once\n\n**Important Notes:**\n- Maximum recommended batch size: 10-20 products\n- Larger batches may timeout\n- All products become recurring items\n- Use single-item endpoint for one-time products\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "addLineItems",
        "parameters": [
          {
            "description": "Subscription contract ID to add products to. Provide the numeric ID without the gid:// prefix",
            "example": 123456789,
            "in": "query",
            "name": "contractId",
            "required": true,
            "schema": {
              "format": "int64",
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "deprecated": true,
            "description": "API Key (Deprecated - Use X-API-Key header instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key for authentication",
            "example": "apst_your-api-key-here",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "examples": {
                "Add Three Products": {
                  "description": "Add Three Products",
                  "value": {
                    "42549172011164": 1,
                    "42549172043932": 2,
                    "42549172076700": 1
                  }
                },
                "Build-a-Box Bundle": {
                  "description": "Build-a-Box Bundle",
                  "value": {
                    "42549172011164": 2,
                    "42549172043932": 2,
                    "42549172076700": 2,
                    "42549172109468": 1,
                    "42549172142236": 1
                  }
                },
                "With Default Quantities": {
                  "description": "With Default Quantities",
                  "value": {
                    "42549172011164": 0,
                    "42549172043932": null,
                    "42549172076700": 3
                  }
                }
              },
              "schema": {
                "type": "string"
              }
            }
          },
          "description": "Map of variant IDs to quantities. Keys are variant IDs (numeric only, no gid:// prefix), values are quantities to add. Null or 0 quantities default to 1.",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "billingPolicy": {
                        "interval": "MONTH",
                        "intervalCount": 1
                      },
                      "customer": {
                        "email": "customer@example.com",
                        "id": "gid://shopify/Customer/987654321"
                      },
                      "deliveryPolicy": {
                        "interval": "MONTH",
                        "intervalCount": 1
                      },
                      "discounts": {
                        "edges": [
                          {
                            "node": {
                              "id": "gid://shopify/SubscriptionManualDiscount/444444",
                              "targetType": "ALL_LINES",
                              "title": "BUILD_A_BOX_DISCOUNT_ABC123",
                              "value": {
                                "percentage": 20.0
                              }
                            }
                          }
                        ]
                      },
                      "id": "gid://shopify/SubscriptionContract/123456789",
                      "lines": {
                        "edges": [
                          {
                            "node": {
                              "currentPrice": {
                                "amount": "59.98",
                                "currencyCode": "USD"
                              },
                              "id": "gid://shopify/SubscriptionLine/111111",
                              "quantity": 2,
                              "sellingPlanId": "gid://shopify/SellingPlan/123456",
                              "sellingPlanName": "Deliver every month",
                              "title": "Premium Coffee - Dark Roast",
                              "variantId": "gid://shopify/ProductVariant/42549172011164"
                            }
                          },
                          {
                            "node": {
                              "currentPrice": {
                                "amount": "24.99",
                                "currencyCode": "USD"
                              },
                              "id": "gid://shopify/SubscriptionLine/222222",
                              "quantity": 1,
                              "sellingPlanId": "gid://shopify/SellingPlan/123456",
                              "sellingPlanName": "Deliver every month",
                              "title": "Organic Tea - Green",
                              "variantId": "gid://shopify/ProductVariant/42549172043932"
                            }
                          },
                          {
                            "node": {
                              "currentPrice": {
                                "amount": "19.98",
                                "currencyCode": "USD"
                              },
                              "id": "gid://shopify/SubscriptionLine/333333",
                              "quantity": 2,
                              "sellingPlanId": "gid://shopify/SellingPlan/123456",
                              "sellingPlanName": "Deliver every month",
                              "title": "Coffee Filters - 100 pack",
                              "variantId": "gid://shopify/ProductVariant/42549172076700"
                            }
                          }
                        ]
                      },
                      "nextBillingDate": "2024-04-01T12:00:00Z",
                      "status": "ACTIVE"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Products successfully added to subscription"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Build-a-Box Maximum Exceeded": {
                    "description": "Build-a-Box Maximum Exceeded",
                    "value": {
                      "detail": "Adding these products would exceed Build-a-Box limits",
                      "status": 400,
                      "title": "UserGeneratedError:Maximum 12 quantity is required",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Empty Request Body": {
                    "description": "Empty Request Body",
                    "value": {
                      "detail": "Request body must contain at least one variant ID and quantity",
                      "status": 400,
                      "title": "Invalid request body",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Quantity": {
                    "description": "Invalid Quantity",
                    "value": {
                      "detail": "Quantities must be positive integers",
                      "status": 400,
                      "title": "Invalid quantity value",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Variant ID": {
                    "description": "Invalid Variant ID",
                    "value": {
                      "detail": "One or more product variants do not exist",
                      "status": 400,
                      "title": "Product Variant not found for ID: 99999999999",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid request parameters or business rule violation"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid API key is required to access this endpoint",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required - missing or invalid API key"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to modify subscription contracts",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to modify subscription"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Subscription contract with ID 123456789 not found",
                  "status": 404,
                  "title": "Resource not found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Subscription contract not found"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "Partial Success Warning": {
                    "description": "Partial Success Warning",
                    "value": {
                      "addedVariants": [
                        "42549172011164",
                        "42549172043932"
                      ],
                      "detail": "Some products were added successfully, but others failed",
                      "failedVariants": [
                        {
                          "error": "No selling plan available",
                          "variantId": "42549172076700"
                        }
                      ],
                      "status": 422,
                      "title": "Partial success",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  },
                  "Product Not Available for Subscription": {
                    "description": "Product Not Available for Subscription",
                    "value": {
                      "detail": "One or more products are not configured for subscription sales",
                      "status": 422,
                      "title": "UserGeneratedError:Product is not available for subscription",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  }
                }
              }
            },
            "description": "One or more products cannot be added due to Shopify constraints"
          }
        },
        "summary": "Add multiple products to subscription",
        "tags": [
          "Subscription Products",
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-contracts-apply-discount": {
      "put": {
        "description": "Applies a Shopify discount code to an existing subscription contract. The discount will be applied to future orders generated by this subscription.\n\n**Key Features:**\n- Validates discount code through Shopify's discount system\n- Prevents duplicate discount code applications\n- Uses database locking to prevent race conditions\n- Automatically recalculates shipping prices if needed\n- Creates audit trail through activity logs\n- Returns updated subscription with discount details\n\n**Discount Code Validation:**\n- Must be an active Shopify discount code in the store\n- Must be applicable to subscription orders\n- Cannot be applied if already active on the subscription\n- Subject to Shopify's discount rules and restrictions\n\n**Customer Portal Restrictions:**\nWhen called from customer portal context:\n- If 'enableAllowOnlyOneDiscountCode' is enabled, customers cannot apply additional codes\n- This restriction ensures single discount policy enforcement\n- External API calls bypass this restriction\n\n**Concurrency Protection:**\n- Uses database-level locking on the subscription contract\n- Prevents simultaneous discount applications\n- Ensures data consistency in high-traffic scenarios\n\n**Post-Application Effects:**\n- Discount applies to all future orders from the subscription\n- May trigger shipping price recalculation\n- Creates 'DISCOUNT_APPLIED' activity log entry\n- Updates subscription's discount collection\n\n**Important Notes:**\n- Discount codes are case-sensitive\n- Invalid or expired codes will return appropriate errors\n- Discounts stack according to Shopify's combination rules\n- Some discounts may not be compatible with subscriptions\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "applyDiscountCodeV2",
        "parameters": [
          {
            "description": "Subscription contract ID to apply discount to. Provide the numeric ID without the gid:// prefix",
            "example": 123456789,
            "in": "query",
            "name": "contractId",
            "required": true,
            "schema": {
              "format": "int64",
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "deprecated": true,
            "description": "API Key (Deprecated - Use X-API-Key header instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key for authentication",
            "example": "apst_your-api-key-here",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Valid Shopify discount code to apply. Case-sensitive. Must be an active discount code in your Shopify store.",
            "example": "SAVE10",
            "in": "query",
            "name": "discountCode",
            "required": true,
            "schema": {
              "maxLength": 255,
              "minLength": 1,
              "pattern": "^[A-Za-z0-9_-]+$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "customer": {
                        "email": "customer@example.com",
                        "firstName": "John",
                        "id": "gid://shopify/Customer/987654321",
                        "lastName": "Doe"
                      },
                      "discounts": {
                        "edges": [
                          {
                            "node": {
                              "id": "gid://shopify/SubscriptionManualDiscount/888888",
                              "targetType": "ALL_LINES",
                              "title": "SAVE10",
                              "value": {
                                "percentage": 10.0
                              }
                            }
                          }
                        ]
                      },
                      "id": "gid://shopify/SubscriptionContract/123456789",
                      "lines": {
                        "edges": [
                          {
                            "node": {
                              "currentPrice": {
                                "amount": "29.99",
                                "currencyCode": "USD"
                              },
                              "id": "gid://shopify/SubscriptionLine/111111",
                              "quantity": 2,
                              "variantId": "gid://shopify/ProductVariant/42549172011164"
                            }
                          }
                        ]
                      },
                      "nextBillingDate": "2024-03-01T00:00:00Z",
                      "status": "ACTIVE"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Discount code successfully applied"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Discount Already Applied": {
                    "description": "Discount Already Applied",
                    "value": {
                      "detail": "The discount code SAVE10 is already active on this subscription",
                      "status": 400,
                      "title": "UserGeneratedError:Discount is already applied",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Discount Not Applicable": {
                    "description": "Discount Not Applicable",
                    "value": {
                      "detail": "This discount code is not configured for subscription orders",
                      "status": 400,
                      "title": "UserGeneratedError:Discount cannot be applied to subscriptions",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Empty Discount Code": {
                    "description": "Empty Discount Code",
                    "value": {
                      "detail": "Discount code cannot be empty",
                      "status": 400,
                      "title": "Invalid discount code",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Discount Code": {
                    "description": "Invalid Discount Code",
                    "value": {
                      "detail": "The discount code INVALID123 does not exist or has expired",
                      "status": 400,
                      "title": "UserGeneratedError:Discount code is invalid",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Multiple Discounts Not Allowed": {
                    "description": "Multiple Discounts Not Allowed",
                    "value": {
                      "detail": "Only one discount code is allowed per subscription",
                      "status": 400,
                      "title": "UserGeneratedError:Permission denied, Subscription cannot be modified",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid request parameters or business rule violation"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid API key is required to access this endpoint",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required - missing or invalid API key"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to modify subscription contracts",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to modify subscription"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "No subscription contract found with ID 123456789",
                  "status": 404,
                  "title": "Subscription contract not found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Subscription contract not found"
          },
          "409": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Another operation is currently modifying this subscription. Please try again.",
                  "status": 409,
                  "title": "Subscription is being modified",
                  "type": "https://example.com/errors/conflict"
                }
              }
            },
            "description": "Concurrent modification conflict"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "Draft Commit Error": {
                    "description": "Draft Commit Error",
                    "value": {
                      "detail": "Cannot modify subscription during active billing attempt",
                      "status": 422,
                      "title": "UserGeneratedError:Unable to commit subscription changes",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  },
                  "Shopify API Error": {
                    "description": "Shopify API Error",
                    "value": {
                      "detail": "Shopify API error: Discount code minimum purchase requirement not met",
                      "status": 422,
                      "title": "Unable to apply discount code",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  }
                }
              }
            },
            "description": "Discount code exists but cannot be applied due to Shopify constraints"
          }
        },
        "summary": "Apply discount code to subscription",
        "tags": [
          "Subscription Contracts",
          "Subscription Discounts"
        ]
      }
    },
    "/api/external/v2/subscription-contracts-bulk-update-line-item-attributes": {
      "put": {
        "description": "This API replaces all existing attributes for the specified line items within subscription contracts. Use carefully, as any attributes not included in the request will be removed.",
        "operationId": "updateMultipleContractsLineItemAttributesV2",
        "parameters": [
          {
            "description": "API Key for authentication",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Optional comma-separated list of subscription contract IDs to update. Example: 32665403611,3266540311,326654036123. Ignored if allSubscriptions=true.",
            "in": "query",
            "name": "contractIds",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "If true, updates all active subscriptions of the shop. If false (default), updates only the provided contractId or contractIds.",
            "in": "query",
            "name": "allSubscriptions",
            "required": false,
            "schema": {
              "default": false,
              "type": "boolean"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "examples": {
                "Attributes Example": {
                  "description": "Attributes Example",
                  "value": [
                    {
                      "key": "color",
                      "value": "red"
                    },
                    {
                      "key": "size",
                      "value": "M"
                    }
                  ]
                }
              },
              "schema": {
                "items": {
                  "$ref": "#/components/schemas/AttributeInfo"
                },
                "type": "array"
              }
            }
          },
          "description": "A JSON array of attributes. \u26a0\ufe0f Note: Providing this array will replace all existing attributes in the specified contract. Add or update attributes carefully, as any attributes not included in the request will be removed."
        },
        "responses": {
          "200": {
            "content": {
              "*/*": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "OK"
          }
        },
        "summary": "Replace all line item attributes in bulk across subscription contracts",
        "tags": [
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-contracts-email-magic-link": {
      "get": {
        "description": "Sends an automated email to a customer containing a secure magic link for accessing their subscription management portal. The email is sent using the shop's configured email template and includes a time-limited authentication token.\n\n**What This Endpoint Does:**\n1. Validates customer exists and has subscriptions\n2. Generates secure portal access token\n3. Retrieves shop's email template configuration\n4. Sends personalized email with magic link\n5. Logs activity for audit trail\n\n**Magic Link Functionality:**\n\n**What is a Magic Link?**\nA magic link is a special URL containing an encrypted authentication token that allows customers to access their portal without entering a password. Clicking the link automatically logs them in.\n\n**Link Contents:**\n- Shop's portal URL\n- Encrypted customer token (2-hour expiration)\n- Direct access to subscription management\n- No password required\n\n**Security:**\n- Token expires in 2 hours\n- Single customer authentication\n- Cannot be used by others\n- Logged for security audit\n\n**Request Parameters:**\n\n**email (required):**\n- Customer's email address\n- Must exactly match email in Shopify\n- Customer must have at least one subscription\n- Case-sensitive in some systems\n\n**Email Template Configuration:**\n\n**Template Requirements:**\n- Email template must be configured in Appstle settings\n- Template type: SUBSCRIPTION_MANAGEMENT_LINK\n- Template must not be disabled\n- Template includes shop branding and customization\n\n**Email Content:**\n- Personalized greeting with customer name\n- Clickable magic link button/link\n- Expiration notice (link valid 2 hours)\n- Shop branding and footer\n- Optional custom messaging\n\n**Template Variables:**\n- `{customer_name}`: Customer's display name\n- `{magic_link}`: Portal URL with token\n- `{shop_name}`: Store name\n- `{expiration_time}`: Token expiry time\n\n**Use Cases:**\n\n**1. Customer Self-Service:**\n- \"Forgot password\" alternative\n- Quick portal access without account setup\n- Passwordless authentication flow\n- Reduce friction for customers\n\n**2. Subscription Management Prompts:**\n- \"Manage your subscription\" emails\n- Pre-billing reminders with management link\n- Post-purchase subscription setup\n- Re-engagement campaigns\n\n**3. Customer Support:**\n- Send portal access to customers\n- Enable self-service during support interactions\n- Provide instant portal access\n- Reduce support workload\n\n**4. Automated Workflows:**\n- Payment failure recovery emails\n- Subscription expiration notices\n- Pause/skip reminders\n- Renewal notifications\n\n**5. Marketing Campaigns:**\n- Subscription feature announcements\n- New product availability\n- Loyalty program invitations\n- Referral program links\n\n**Process Flow:**\n\n```\n1. API receives email parameter\n2. Searches subscription database for customer email\n3. If not found \u2192 Returns 400 error\n4. If found \u2192 Retrieves customer subscriptions\n5. Sorts subscriptions by status (active first)\n6. Checks email template configuration\n7. If disabled \u2192 Returns 400 error with instructions\n8. If enabled \u2192 Generates magic link token\n9. Prepares email with template\n10. Sends email via configured provider\n11. Logs activity (source: MERCHANT_EXTERNAL_API)\n12. Returns success message\n```\n\n**Response Format:**\n```json\n\"Email triggered successfully.\"\n```\n\n**Simple string response** confirming email queued for delivery.\n\n**Important Considerations:**\n\n**Customer Validation:**\n- Email MUST exist in subscription database\n- Customer MUST have at least one subscription\n- Customers without subscriptions cannot receive link\n- Returns error if customer not found\n\n**Email Template Disabled:**\n- If template disabled in settings: Returns error\n- Error message guides merchant to enable template\n- Path: \"More -> Notification Settings\"\n- Template must be explicitly enabled\n\n**Email Delivery:**\n- Email sent asynchronously\n- Success response doesn't guarantee delivery\n- Check email logs for delivery confirmation\n- Respects shop's email provider settings\n\n**Multiple Subscriptions:**\n- If customer has multiple subscriptions: Sorts by status\n- Active subscriptions shown first\n- Link provides access to ALL customer subscriptions\n- Portal displays all contracts\n\n**Activity Logging:**\n- All magic link emails logged\n- Source: MERCHANT_EXTERNAL_API\n- Includes timestamp and customer\n- Viewable in activity logs\n\n**Integration Examples:**\n\n**Webhook Trigger - Payment Failed:**\n```javascript\nasync function handlePaymentFailure(webhook) {\n  const customerEmail = webhook.customer.email;\n  \n  // Send magic link to customer\n  await fetch(\n    `/api/external/v2/subscription-contracts-email-magic-link?email=${customerEmail}`,\n    { headers: { 'X-API-Key': process.env.APPSTLE_API_KEY } }\n  );\n  \n  console.log(`Magic link sent to ${customerEmail} for payment update`);\n}\n```\n\n**Customer Support Button:**\n```javascript\nasync function sendPortalAccess(customerEmail) {\n  try {\n    const response = await fetch(\n      `/api/external/v2/subscription-contracts-email-magic-link?email=${encodeURIComponent(customerEmail)}`,\n      { \n        headers: { 'X-API-Key': apiKey },\n        method: 'GET'\n      }\n    );\n    \n    if (response.ok) {\n      alert('Portal access email sent to customer!');\n    }\n  } catch (error) {\n    console.error('Failed to send magic link:', error);\n  }\n}\n```\n\n**Best Practices:**\n\n1. **Validate Email**: Check email format before calling API\n2. **Rate Limiting**: Don't spam customers - limit frequency\n3. **Error Handling**: Handle customer not found gracefully\n4. **User Feedback**: Confirm email sent to user\n5. **Test Template**: Ensure email template configured and working\n6. **Monitor Logs**: Check activity logs for delivery issues\n\n**Common Errors:**\n\n**\"Customer Email does not exist\":**\n- Email not found in subscription database\n- Customer has no subscriptions\n- Email may be misspelled\n\n**\"Email template not found\":**\n- SUBSCRIPTION_MANAGEMENT_LINK template not configured\n- Contact Appstle support to set up template\n\n**\"Email is currently disabled\":**\n- Template disabled in Notification Settings\n- Navigate to More -> Notification Settings\n- Enable \"Subscription Management Link\" email\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "emailMagicLinkV2",
        "parameters": [
          {
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Customer email",
            "in": "query",
            "name": "email",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": "Email triggered successfully.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Email successfully queued for delivery"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Customer Not Found": {
                    "description": "Customer Not Found",
                    "value": {
                      "detail": "UserGeneratedError:Customer Email does not exist",
                      "status": 400,
                      "title": "Customer not found",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Email Template Disabled": {
                    "description": "Email Template Disabled",
                    "value": {
                      "detail": "UserGeneratedError:The Subscription Management Link email is currently disabled in Notification Settings. To enable it, go to More -> Notification Settings.",
                      "status": 400,
                      "title": "Email disabled",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Email Template Not Found": {
                    "description": "Email Template Not Found",
                    "value": {
                      "detail": "UserGeneratedError:Email template not found",
                      "status": 400,
                      "title": "Email template not configured",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Bad request - Customer not found or email template disabled"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header is required",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required"
          },
          "500": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Failed to send magic link email",
                  "status": 500,
                  "title": "Email send failed",
                  "type": "https://example.com/errors/internal-error"
                }
              }
            },
            "description": "Internal server error - Email send failure"
          }
        },
        "summary": "Send magic link email to customer for portal access",
        "tags": [
          "Subscription Contracts",
          "Customer Portal"
        ]
      }
    },
    "/api/external/v2/subscription-contracts-remove-discount": {
      "put": {
        "description": "Removes a specific discount from a subscription contract based on the discount ID. This will affect the pricing of all future orders generated by the subscription.\n\n**Key Features:**\n- Removes any type of discount: automatic, manual, or code-based\n- Uses Shopify's draft system for safe removal\n- Immediate effect on future order pricing\n- Cannot be undone - discount must be re-applied if needed\n- Activity log tracks removed discounts\n\n**Finding Discount IDs:**\nDiscount IDs can be found in the subscription contract's discount collection:\n- Query the subscription contract to see `discounts.edges[].node.id`\n- Format: `gid://shopify/SubscriptionManualDiscount/123456`\n- Each discount has a unique ID regardless of type\n\n**Types of Discounts:**\n- **Manual Discounts**: Applied via API (percentage, fixed, price)\n- **Code Discounts**: Applied using discount codes\n- **Automatic Discounts**: Applied by Shopify based on rules\n- **Build-a-Box Discounts**: Volume-based discounts\n- **Selling Plan Discounts**: Built into the subscription plan\n\n**Impact on Pricing:**\nWhen a discount is removed:\n- Future orders use full price (no discount)\n- Existing orders are not affected\n- Other discounts remain active\n- Shipping prices may be recalculated\n- Customer sees updated pricing immediately\n\n**Common Use Cases:**\n- End promotional period discounts\n- Remove expired or invalid discount codes\n- Clear discounts before applying new ones\n- Customer service adjustments\n- Correct pricing errors\n\n**Important Notes:**\n- Cannot remove selling plan built-in discounts\n- No customer notification sent (consider sending separately)\n- Cannot selectively remove - removes entire discount\n- Build-a-Box discounts may auto-reapply based on quantity\n- Some discounts may be required by business rules\n\n**Post-Removal Considerations:**\n- Customer may notice price increase on next order\n- May affect customer retention if unexpected\n- Consider grace periods or notifications\n- Document reason for removal in your system\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "removeDiscountV2",
        "parameters": [
          {
            "description": "Subscription contract ID to remove discount from",
            "example": 123456789,
            "in": "query",
            "name": "contractId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "deprecated": true,
            "description": "API Key (Deprecated - Use X-API-Key header instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key for authentication",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "ID of the discount to be removed. Must be the full GraphQL ID including the gid:// prefix. You can find discount IDs by querying the subscription contract and looking at the discounts collection. Format example: gid://shopify/SubscriptionManualDiscount/123456789",
            "example": "gid://shopify/SubscriptionManualDiscount/123456789",
            "in": "query",
            "name": "discountId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "customer": {
                        "email": "customer@example.com",
                        "id": "gid://shopify/Customer/987654321"
                      },
                      "deliveryPrice": {
                        "amount": "5.99",
                        "currencyCode": "USD"
                      },
                      "discounts": {
                        "edges": []
                      },
                      "id": "gid://shopify/SubscriptionContract/123456789",
                      "lines": {
                        "edges": [
                          {
                            "node": {
                              "currentPrice": {
                                "amount": "39.99",
                                "currencyCode": "USD"
                              },
                              "id": "gid://shopify/SubscriptionLine/111111",
                              "pricingPolicy": {
                                "basePrice": {
                                  "amount": "39.99",
                                  "currencyCode": "USD"
                                }
                              },
                              "quantity": 2,
                              "title": "Premium Coffee - Monthly Supply",
                              "variantId": "gid://shopify/ProductVariant/42549172011164"
                            }
                          }
                        ]
                      },
                      "nextBillingDate": "2024-04-01T00:00:00Z",
                      "status": "ACTIVE"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Discount successfully removed"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Cannot Remove System Discount": {
                    "description": "Cannot Remove System Discount",
                    "value": {
                      "detail": "This discount is required by the subscription plan and cannot be removed",
                      "status": 400,
                      "title": "Cannot remove this discount",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Contract Not Found": {
                    "description": "Contract Not Found",
                    "value": {
                      "detail": "No subscription contract found with ID 123456789",
                      "status": 400,
                      "title": "Contract does not exist",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Discount Not Found": {
                    "description": "Discount Not Found",
                    "value": {
                      "detail": "The specified discount does not exist on this subscription",
                      "status": 400,
                      "title": "Discount with id gid://shopify/SubscriptionManualDiscount/999999 not found",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Discount ID Format": {
                    "description": "Invalid Discount ID Format",
                    "value": {
                      "detail": "Discount ID must be in format: gid://shopify/SubscriptionManualDiscount/[numeric_id]",
                      "status": 400,
                      "title": "Invalid discount ID format",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid contract ID or discount ID"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid API key is required to access this endpoint",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to modify subscription contracts",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to modify subscription"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Subscription contract with ID 123456789 not found",
                  "status": 404,
                  "title": "Resource not found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Subscription contract not found"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "Draft Creation Failed": {
                    "description": "Draft Creation Failed",
                    "value": {
                      "detail": "Subscription is currently being modified by another process",
                      "status": 422,
                      "title": "Unable to create subscription draft",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  },
                  "Shopify API Error": {
                    "description": "Shopify API Error",
                    "value": {
                      "detail": "Shopify API error: Cannot modify subscription during active billing attempt",
                      "status": 422,
                      "title": "Unable to remove discount",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  }
                }
              }
            },
            "description": "Discount exists but cannot be removed"
          }
        },
        "summary": "Remove discount from subscription",
        "tags": [
          "Subscription Contracts",
          "Subscription Discounts"
        ]
      }
    },
    "/api/external/v2/subscription-contracts-remove-line-item": {
      "put": {
        "description": "Removes a specific product line item from an existing subscription contract. Can optionally retain prorated discounts associated with the removed product.\n\n**Key Features:**\n- Validates minimum subscription requirements before removal\n- Handles discount cleanup for line-specific discounts\n- Enforces minimum cycle commitments on products\n- Supports Build-a-Box quantity validation\n- Automatic retry on concurrent modification conflicts\n- Email notifications for subscription changes\n\n**Validation Rules:**\n- At least one recurring subscription product must remain after removal\n- One-time products and free products don't count toward the minimum\n- Products with minimum cycle commitments cannot be removed until fulfilled\n- Build-a-Box subscriptions validate against minimum/maximum quantity rules\n\n**Discount Handling:**\nWhen `removeDiscount=true` (default):\n- Discounts applied only to the removed line item are deleted\n- Discounts applied to multiple line items are retained\n- System automatically identifies which discounts to remove\n\n**Retry Mechanism:**\nThe endpoint automatically retries in these scenarios:\n- Concurrent modification detected (another process updated the subscription)\n- Invalid discount code errors (removes problematic discount and retries)\n- This ensures reliable operation in high-traffic environments\n\n**Post-Removal Actions:**\n- Activity log created for audit trail\n- Email notification sent to customer\n- Shipping price recalculated asynchronously\n- Build-a-Box discounts resynced if applicable\n- Product-specific discounts resynced\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "removeLineItemV2",
        "parameters": [
          {
            "description": "Subscription contract ID to remove product from. Provide the numeric ID without the gid:// prefix",
            "example": 123456789,
            "in": "query",
            "name": "contractId",
            "required": true,
            "schema": {
              "pattern": "^[0-9]+$",
              "type": "string"
            }
          },
          {
            "deprecated": true,
            "description": "API Key (Deprecated - Use X-API-Key header instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key for authentication",
            "example": "apst_your-api-key-here",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Line item ID of the product to remove. Must be the full GraphQL ID including the gid:// prefix",
            "example": "gid://shopify/SubscriptionLine/123456789",
            "in": "query",
            "name": "lineId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Controls whether to remove discounts that apply only to this line item. When true (default), line-specific discounts are removed. When false, attempts to retain discounts where possible. Note: Discounts that apply to multiple lines are always retained regardless of this setting",
            "example": true,
            "in": "query",
            "name": "removeDiscount",
            "required": false,
            "schema": {
              "default": true,
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "billingPolicy": {
                        "interval": "MONTH",
                        "intervalCount": 1
                      },
                      "customer": {
                        "email": "customer@example.com",
                        "firstName": "John",
                        "id": "gid://shopify/Customer/987654321",
                        "lastName": "Doe"
                      },
                      "deliveryPolicy": {
                        "interval": "MONTH",
                        "intervalCount": 1
                      },
                      "discounts": {
                        "edges": [
                          {
                            "node": {
                              "id": "gid://shopify/SubscriptionManualDiscount/999999",
                              "targetType": "ALL_LINES",
                              "title": "10% OFF SUBSCRIPTION",
                              "value": {
                                "percentage": 10
                              }
                            }
                          }
                        ]
                      },
                      "id": "gid://shopify/SubscriptionContract/123456789",
                      "lines": {
                        "edges": [
                          {
                            "node": {
                              "currentPrice": {
                                "amount": "29.99",
                                "currencyCode": "USD"
                              },
                              "id": "gid://shopify/SubscriptionLine/111111",
                              "quantity": 2,
                              "sellingPlanId": "gid://shopify/SellingPlan/123456",
                              "sellingPlanName": "Deliver every month",
                              "variantId": "gid://shopify/ProductVariant/42549172011164"
                            }
                          }
                        ]
                      },
                      "nextBillingDate": "2024-03-01T00:00:00Z",
                      "status": "ACTIVE"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Product successfully removed from subscription"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Build-a-Box Validation Error": {
                    "description": "Build-a-Box Validation Error",
                    "value": {
                      "detail": "Build-a-Box subscriptions must maintain minimum item quantities",
                      "status": 400,
                      "title": "UserGeneratedError:Removing this item would violate the minimum quantity requirement for your Build-a-Box subscription",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Line ID Format": {
                    "description": "Invalid Line ID Format",
                    "value": {
                      "detail": "Line ID must be in format: gid://shopify/SubscriptionLine/[numeric_id]",
                      "status": 400,
                      "title": "Invalid line item ID format",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Last Product Removal Attempt": {
                    "description": "Last Product Removal Attempt",
                    "value": {
                      "detail": "Cannot remove the last recurring product from the subscription",
                      "status": 400,
                      "title": "UserGeneratedError:Cannot remove line item. Atleast one subscription product must be present in a subscription",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Line Item Not Found": {
                    "description": "Line Item Not Found",
                    "value": {
                      "detail": "The specified line item does not exist in this subscription",
                      "status": 400,
                      "title": "Couldn't find LineId=gid://shopify/SubscriptionLine/999999",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Minimum Cycles Not Met": {
                    "description": "Minimum Cycles Not Met",
                    "value": {
                      "detail": "Product has a minimum cycle requirement that has not been fulfilled",
                      "status": 400,
                      "title": "UserGeneratedError:This product requires a minimum commitment of {{minCycles}} billing cycles before removal",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid request parameters or business rule violation"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid API key is required to access this endpoint",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required - missing or invalid API key"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to modify subscription contracts",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to modify subscription"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Subscription contract with ID 123456789 not found",
                  "status": 404,
                  "title": "Resource not found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Subscription contract not found"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "Concurrent Modification": {
                    "description": "Concurrent Modification",
                    "value": {
                      "detail": "Another process modified the subscription. The system will automatically retry.",
                      "status": 422,
                      "title": "The subscription contract has changed. Retry the operation.",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  },
                  "Draft Commit Error": {
                    "description": "Draft Commit Error",
                    "value": {
                      "detail": "Shopify API error: Billing attempt in progress",
                      "status": 422,
                      "title": "UserGeneratedError:Unable to commit subscription changes",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  }
                }
              }
            },
            "description": "Unable to process the removal due to Shopify API constraints"
          }
        },
        "summary": "Remove product from subscription",
        "tags": [
          "Subscription Products",
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-contracts-remove-line-items": {
      "put": {
        "description": "Removes multiple product line items from an existing subscription contract in a single request. Products are removed sequentially, allowing partial success if errors occur.\n\n**Key Features:**\n- Sequential processing - items removed one by one\n- Partial success allowed - previous removals persist if later ones fail\n- Validates each removal against current subscription state\n- Smart discount cleanup for line-specific discounts\n- Comprehensive validation for each product removal\n- Triggers all side effects after each successful removal\n\n**Processing Order Matters:**\nItems are removed in the order provided:\n1. First item validated and removed\n2. Second item validated against updated state\n3. Continue until all processed or error occurs\n4. Returns final subscription state\n\n**Validation Per Item:**\n- Line item must exist in subscription\n- At least one recurring product must remain\n- Build-a-Box min/max quantities maintained\n- Minimum cycle commitments honored\n- One-time and free products don't count toward minimum\n\n**Discount Handling:**\nWhen `removeDiscount=true`:\n- Removes discounts applied ONLY to the removed line\n- Preserves discounts that apply to multiple lines\n- Each removal evaluates discounts independently\n- Build-a-Box discounts auto-adjust based on quantity\n\n**Side Effects Per Removal:**\nEach successful removal triggers:\n- Activity log entry created\n- Customer email sent\n- Shipping price recalculation\n- Build-a-Box discount resync\n- Product discount adjustments\n\n**Partial Success Scenarios:**\nIf removing 3 items and the 2nd fails:\n- 1st item: Successfully removed\n- 2nd item: Fails, error returned\n- 3rd item: Not attempted\n- Result: Subscription with 1st item removed\n\n**Performance Considerations:**\n- Each removal is a separate Shopify API transaction\n- Multiple emails may be sent to customer\n- Consider using single remove for 1-2 items\n- Large batches may timeout\n- Recommended max: 5-10 items per request\n\n**Build-a-Box Handling:**\nFor Build-a-Box subscriptions:\n- Validates total quantity after EACH removal\n- May fail mid-batch if minimum breached\n- Discounts recalculate after each item\n- Consider removal order carefully\n\n**Important Notes:**\n- NOT atomic - no rollback on partial failure\n- Order of line IDs affects success probability\n- Customer receives email per removed item\n- All validations apply as if removing individually\n- Response shows final state after all attempts\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "removeLineItems",
        "parameters": [
          {
            "description": "Subscription contract ID to remove products from",
            "example": 123456789,
            "in": "query",
            "name": "contractId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "deprecated": true,
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key for authentication",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "When true, removes discounts that apply only to each removed line item. When false, attempts to retain all discounts. Discounts that apply to multiple lines are always retained regardless of this setting.",
            "example": false,
            "in": "query",
            "name": "removeDiscount",
            "required": false,
            "schema": {
              "default": false,
              "type": "boolean"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "description": "List of line item IDs to remove. IDs must be in full GraphQL format. Items are processed sequentially in the order provided. If any removal fails, processing stops but previous removals are kept.",
                "items": {
                  "type": "string"
                },
                "type": "array"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "customer": {
                        "email": "customer@example.com",
                        "id": "gid://shopify/Customer/987654321"
                      },
                      "discounts": {
                        "edges": [
                          {
                            "node": {
                              "id": "gid://shopify/SubscriptionManualDiscount/444444",
                              "targetType": "ALL_LINES",
                              "title": "10% OFF ALL ITEMS"
                            }
                          }
                        ]
                      },
                      "id": "gid://shopify/SubscriptionContract/123456789",
                      "lines": {
                        "edges": [
                          {
                            "node": {
                              "currentPrice": {
                                "amount": "19.99",
                                "currencyCode": "USD"
                              },
                              "id": "gid://shopify/SubscriptionLine/333333",
                              "quantity": 1,
                              "title": "Essential Product - Monthly",
                              "variantId": "gid://shopify/ProductVariant/42549172076700"
                            }
                          }
                        ]
                      },
                      "nextBillingDate": "2024-04-01T00:00:00Z",
                      "status": "ACTIVE"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Products successfully removed from subscription (full or partial success)"
          },
          "207": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "2 of 3 items removed successfully",
                  "failedLineIds": [
                    {
                      "error": "Would violate minimum product requirement",
                      "lineId": "gid://shopify/SubscriptionLine/333333"
                    }
                  ],
                  "removedLineIds": [
                    "gid://shopify/SubscriptionLine/111111",
                    "gid://shopify/SubscriptionLine/222222"
                  ],
                  "status": 207,
                  "title": "Partial success",
                  "type": "https://example.com/partial-success"
                }
              }
            },
            "description": "Multi-Status - Some items removed successfully, others failed"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Build-a-Box Minimum Violation": {
                    "description": "Build-a-Box Minimum Violation",
                    "value": {
                      "code": "minQuantityNotReached",
                      "detail": "Removing item would violate Build-a-Box minimum quantity. Some items may have been removed.",
                      "status": 400,
                      "title": "UserGeneratedError:Minimum 6 quantity is required",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Empty Line IDs List": {
                    "description": "Empty Line IDs List",
                    "value": {
                      "detail": "Line IDs list cannot be empty",
                      "status": 400,
                      "title": "Invalid request body",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Line Item Not Found (Partial Success)": {
                    "description": "Line Item Not Found (Partial Success)",
                    "value": {
                      "detail": "Line item not found. Previous items in batch may have been removed successfully.",
                      "status": 400,
                      "title": "Couldn't find LineId=gid://shopify/SubscriptionLine/999999",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Minimum Cycles Not Met": {
                    "description": "Minimum Cycles Not Met",
                    "value": {
                      "detail": "Product has minimum cycle requirement. Previous removals in batch were successful.",
                      "status": 400,
                      "title": "UserGeneratedError:Subscription cannot be modified until 3 orders have completed.",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Would Remove Last Product": {
                    "description": "Would Remove Last Product",
                    "value": {
                      "detail": "Removing these items would leave no recurring products in the subscription",
                      "status": 400,
                      "title": "UserGeneratedError:Cannot remove line item. Atleast one subscription product must be present in a subscription",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid contract ID or line item IDs - may indicate partial failure"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid API key is required to access this endpoint",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to modify subscription contracts",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to modify subscription"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Subscription contract with ID 123456789 not found",
                  "status": 404,
                  "title": "Resource not found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Subscription contract not found"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "Concurrent Modification": {
                    "description": "Concurrent Modification",
                    "value": {
                      "detail": "Another process modified the subscription. Some items may have been removed.",
                      "status": 422,
                      "title": "UserGeneratedError:The subscription contract has changed. Retry the operation.",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  },
                  "Shopify API Error": {
                    "description": "Shopify API Error",
                    "value": {
                      "detail": "Shopify API error: Cannot modify subscription during active billing attempt",
                      "status": 422,
                      "title": "Unable to remove line item",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  }
                }
              }
            },
            "description": "One or more products cannot be removed due to subscription constraints"
          }
        },
        "summary": "Remove multiple products from subscription",
        "tags": [
          "Subscription Products",
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-contracts-update-billing-date": {
      "put": {
        "description": "Reschedules the next billing date for an active subscription contract. This endpoint allows you to change when the next order will be created and processed.\n\n**Key Features:**\n- Updates the next billing date to the specified date\n- Optionally reschedules all future orders based on the new date\n- Syncs the updated date to Shopify\n- Sends confirmation email to customer\n\n**The rescheduleFutureOrder Parameter:**\n- **true** (default): Updates the next billing date AND recalculates all future queued orders based on the new date. Use this to shift the entire billing schedule.\n- **false**: Only updates the next billing date. Other queued orders remain unchanged. Use this for one-time date adjustments.\n\n**Important Notes:**\n- The new date must be in the future (with 10 minute grace period)\n- Date is validated against the shop's timezone\n- If anchor days are configured, future orders may align to those anchors\n\n**Process Flow:**\n1. Validates the contract exists and belongs to the shop\n2. Validates the new date is not in the past\n3. Updates the billing attempt to the new date\n4. Syncs the updated nextBillingDate to Shopify\n5. If rescheduleFutureOrder=true, regenerates the queue from the new date\n6. Sends confirmation email to customer\n7. Records activity log entry\n\n**Date Format:**\n- Must be ISO 8601 format with timezone\n- Examples: `2024-03-15T12:00:00Z`, `2024-03-15T12:00:00+05:30`\n- URL encode the date when passing as query parameter\n\n**Timezone Handling:**\n- The provided date is used as-is for the billing attempt\n- Validation (past date check) uses the shop's configured timezone\n- All dates in the response are in UTC (Z suffix)\n\n**Date Restrictions (Customer Portal Only):**\nWhen called from customer portal context:\n- Minimum days from today (skipDaysFromCurrentDate setting)\n- Maximum days from today (billingDateRestrictToDays setting)\n- External API calls bypass these restrictions\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "updateNextBillingDateV2",
        "parameters": [
          {
            "description": "Subscription contract ID to update",
            "example": 123456789,
            "in": "query",
            "name": "contractId",
            "required": true,
            "schema": {
              "format": "int64",
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "deprecated": true,
            "description": "API Key (Deprecated - Use X-API-Key header instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "If true (or value not provided), next billing date will be changed and also schedule for future upcoming orders will be changed based on new updated billing date.\nIf false, then only next billing date will be changed, but the schedule for future upcoming orders will not change.",
            "example": true,
            "in": "query",
            "name": "rescheduleFutureOrder",
            "required": false,
            "schema": {
              "default": true,
              "type": "boolean"
            }
          },
          {
            "description": "API Key for authentication",
            "example": "apst_your-api-key-here",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "New billing date in ISO 8601 format with timezone. The date must be in the future and may be subject to merchant-configured restrictions. Common formats:\n- UTC: 2024-03-15T12:00:00Z\n- With offset: 2024-03-15T12:00:00+05:30\n- With timezone: 2024-03-15T12:00:00[America/New_York]\n\nThe system will convert the date to the shop's timezone for validation.",
            "example": "2024-03-15T12:00:00Z",
            "in": "query",
            "name": "nextBillingDate",
            "required": true,
            "schema": {
              "format": "date-time",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(Z|[+-]\\d{2}:\\d{2}|\\[.+\\])$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "__typename": "SubscriptionContract",
                      "billingPolicy": {
                        "interval": "MONTH",
                        "intervalCount": 1
                      },
                      "customer": {
                        "displayName": "John Doe",
                        "email": "customer@example.com"
                      },
                      "id": "gid://shopify/SubscriptionContract/123456789",
                      "nextBillingDate": "2024-03-15T12:00:00Z",
                      "status": "ACTIVE",
                      "updatedAt": "2024-02-15T10:30:00Z"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Billing date successfully updated. The response contains the updated subscription contract from Shopify with the new nextBillingDate.",
            "headers": {
              "X-Application-Context": {
                "description": "Application context with alert message",
                "schema": {
                  "example": "appname:Subscription Updated:",
                  "type": "string"
                },
                "style": "simple"
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Contract Not Found": {
                    "description": "Contract Not Found",
                    "summary": "Invalid contract ID",
                    "value": {
                      "detail": "No subscription contract found with the specified ID",
                      "instance": "/api/external/v2/subscription-contracts-update-billing-date",
                      "status": 400,
                      "title": "Contract does not exist",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Date Outside Allowed Range": {
                    "description": "Date Outside Allowed Range",
                    "summary": "Customer portal date restrictions",
                    "value": {
                      "detail": "The selected date is outside the allowed range for rescheduling",
                      "instance": "/api/external/v2/subscription-contracts-update-billing-date",
                      "status": 400,
                      "title": "Can't reschedule on this 2024-12-31T00:00:00Z",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Date in Past": {
                    "description": "Date in Past",
                    "summary": "Billing date cannot be in the past",
                    "value": {
                      "detail": "The billing date must be a future date",
                      "instance": "/api/external/v2/subscription-contracts-update-billing-date",
                      "status": 400,
                      "title": "The billing date you are trying to set (2024-01-01T00:00:00Z) is in the past. Billing dates cannot be updated to a time that has already passed. Please select a future billing date.",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Date Format": {
                    "description": "Invalid Date Format",
                    "summary": "Date must be ISO 8601 format",
                    "value": {
                      "detail": "Date must be in ISO 8601 format with timezone (e.g., 2024-03-15T12:00:00Z or 2024-03-15T12:00:00+05:30)",
                      "instance": "/api/external/v2/subscription-contracts-update-billing-date",
                      "status": 400,
                      "title": "Invalid date format",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Shopify API Error": {
                    "description": "Shopify API Error",
                    "summary": "Failed to sync with Shopify",
                    "value": {
                      "detail": "Shopify returned an error when attempting to update the billing date",
                      "instance": "/api/external/v2/subscription-contracts-update-billing-date",
                      "status": 400,
                      "title": "UserGeneratedError:Unable to update billing date",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid request or date validation failed"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header is required",
                  "instance": "/api/external/v2/subscription-contracts-update-billing-date",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to modify subscription contracts",
                  "instance": "/api/external/v2/subscription-contracts-update-billing-date",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to update billing date"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Subscription contract with the specified ID not found in the system",
                  "instance": "/api/external/v2/subscription-contracts-update-billing-date",
                  "status": 404,
                  "title": "Resource not found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Subscription contract not found"
          }
        },
        "summary": "Update next billing date for a subscription contract",
        "tags": [
          "Subscription Contracts",
          "Billing & Payments"
        ]
      }
    },
    "/api/external/v2/subscription-contracts-update-billing-interval": {
      "put": {
        "description": "Updates the billing frequency (how often the customer is charged) for a subscription contract. This comprehensive operation recalculates billing dates, adjusts pricing, updates selling plans, and may also modify delivery intervals.\n\n**Key Features:**\n- Changes billing frequency while maintaining subscription continuity\n- Automatically adjusts delivery interval when linked to billing\n- Recalculates next billing date based on store settings\n- Reprices all line items for the new frequency\n- Finds and applies matching selling plans\n- Handles anchor day adjustments for consistent billing\n- Validates prepaid subscription constraints\n\n**Billing Interval Types:**\n- **DAY**: Daily billing (use with caution)\n- **WEEK**: Weekly billing (e.g., every 1, 2, 3 weeks)\n- **MONTH**: Monthly billing (e.g., every 1, 2, 3 months)\n- **YEAR**: Annual billing\n\n**Validation Rules:**\n- Cannot set the same interval as current (no-op prevention)\n- For prepaid subscriptions: billing interval must exceed delivery interval\n- Example: Can't bill monthly if delivering weekly (would be paying for 1 delivery but receiving 4)\n\n**Next Billing Date Calculation:**\nThe system uses sophisticated logic to determine the new billing date:\n1. Starts from current or last successful billing date\n2. Applies store timezone and order time preferences\n3. Ensures date is in the future\n4. Respects day-of-week preferences if configured\n5. May keep current date if 'enableChangeFromNextBillingDate' is false\n\n**Side Effects:**\n- **Delivery Interval**: Updated if currently equal to billing interval\n- **Line Item Pricing**: Recalculated based on new frequency multiplier\n- **Selling Plans**: Finds and applies best matching plans for products\n- **Anchor Days**: Updates billing anchor for consistent scheduling\n- **Email Notifications**: Sends 'ORDER_FREQUENCY_UPDATED' to customer\n- **Activity Logs**: Records both billing and delivery changes\n\n**Prepaid vs Pay-Per-Delivery:**\n- Pay-per-delivery: Billing and delivery intervals typically match\n- Prepaid: Customer pays upfront for multiple deliveries\n- This endpoint enforces prepaid logic to prevent undercharging\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "updateBillingIntervalV2",
        "parameters": [
          {
            "description": "Subscription contract ID to update. Provide the numeric ID without the gid:// prefix",
            "example": 123456789,
            "in": "query",
            "name": "contractId",
            "required": true,
            "schema": {
              "format": "int64",
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "deprecated": true,
            "description": "API Key (Deprecated - Use X-API-Key header instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key for authentication",
            "example": "apst_your-api-key-here",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Number of intervals between billings. For example, intervalCount=2 with interval=WEEK means 'every 2 weeks'",
            "example": 2,
            "in": "query",
            "name": "intervalCount",
            "required": true,
            "schema": {
              "maximum": 365,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "Type of interval for billing frequency",
            "example": "MONTH",
            "in": "query",
            "name": "interval",
            "required": true,
            "schema": {
              "enum": [
                "DAY",
                "WEEK",
                "MONTH",
                "YEAR",
                "$UNKNOWN"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "billingPolicy": {
                        "anchors": [
                          {
                            "day": 1,
                            "type": "MONTHDAY"
                          }
                        ],
                        "interval": "MONTH",
                        "intervalCount": 2
                      },
                      "customer": {
                        "email": "customer@example.com",
                        "id": "gid://shopify/Customer/987654321"
                      },
                      "deliveryPolicy": {
                        "interval": "MONTH",
                        "intervalCount": 2
                      },
                      "id": "gid://shopify/SubscriptionContract/123456789",
                      "lines": {
                        "edges": [
                          {
                            "node": {
                              "currentPrice": {
                                "amount": "59.98",
                                "currencyCode": "USD"
                              },
                              "id": "gid://shopify/SubscriptionLine/111111",
                              "pricingPolicy": {
                                "basePrice": {
                                  "amount": "29.99",
                                  "currencyCode": "USD"
                                }
                              },
                              "quantity": 1,
                              "sellingPlanId": "gid://shopify/SellingPlan/222222",
                              "sellingPlanName": "Deliver every 2 months",
                              "variantId": "gid://shopify/ProductVariant/42549172011164"
                            }
                          }
                        ]
                      },
                      "nextBillingDate": "2024-04-01T12:00:00Z",
                      "status": "ACTIVE"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Billing interval updated successfully"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Contract Not Found": {
                    "description": "Contract Not Found",
                    "value": {
                      "detail": "No subscription contract found with ID 123456789",
                      "status": 400,
                      "title": "Subscription contract not found",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Interval Count": {
                    "description": "Invalid Interval Count",
                    "value": {
                      "detail": "Interval count must be between 1 and 365",
                      "status": 400,
                      "title": "Invalid interval count",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Interval Type": {
                    "description": "Invalid Interval Type",
                    "value": {
                      "detail": "Interval must be one of: DAY, WEEK, MONTH, YEAR",
                      "status": 400,
                      "title": "Invalid interval type",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Prepaid Validation Error": {
                    "description": "Prepaid Validation Error",
                    "value": {
                      "detail": "Cannot bill monthly for weekly deliveries in prepaid subscriptions",
                      "status": 400,
                      "title": "UserGeneratedError:Billing interval cannot be less than or equal to delivery interval for prepaid contracts",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Same Interval Error": {
                    "description": "Same Interval Error",
                    "value": {
                      "detail": "The subscription is already set to bill every 1 month",
                      "status": 400,
                      "title": "UserGeneratedError:Billing interval cannot be the same as old billing interval",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid request parameters or business rule violation"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid API key is required to access this endpoint",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required - missing or invalid API key"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to modify subscription contracts",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to update billing interval"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Subscription contract with ID 123456789 not found",
                  "status": 404,
                  "title": "Resource not found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Subscription contract not found"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "No Matching Selling Plan": {
                    "description": "No Matching Selling Plan",
                    "value": {
                      "detail": "No selling plan found for the requested billing frequency",
                      "status": 422,
                      "title": "No selling plan available",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  },
                  "Shopify API Error": {
                    "description": "Shopify API Error",
                    "value": {
                      "detail": "Shopify API error: Cannot modify subscription during active billing attempt",
                      "status": 422,
                      "title": "Unable to update billing interval",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  }
                }
              }
            },
            "description": "Billing interval update failed due to Shopify constraints"
          }
        },
        "summary": "Update billing interval for a subscription contract",
        "tags": [
          "Subscription Contracts",
          "Billing & Payments"
        ]
      }
    },
    "/api/external/v2/subscription-contracts-update-delivery-interval": {
      "put": {
        "description": "Updates the delivery interval for the specified subscription contract.\nThis endpoint allows external API consumers to change the delivery interval count\nand type (of type SellingPlanInterval) used for scheduling deliveries.\n\nThe service validates that the contract exists, that the new delivery interval\ndiffers from the current setting, and that it meets all business rules.\n\nAuthentication is enforced via the X-API-Key header (the 'api_key' parameter is deprecated).\n",
        "operationId": "updateDeliveryIntervalV2",
        "parameters": [
          {
            "description": "Contract ID",
            "in": "query",
            "name": "contractId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Delivery Interval Count",
            "in": "query",
            "name": "deliveryIntervalCount",
            "required": true,
            "schema": {
              "format": "int32",
              "type": "integer"
            }
          },
          {
            "description": "Delivery Interval Type",
            "in": "query",
            "name": "deliveryInterval",
            "required": true,
            "schema": {
              "enum": [
                "DAY",
                "WEEK",
                "MONTH",
                "YEAR",
                "$UNKNOWN"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Delivery interval updated successfully"
          },
          "400": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Invalid contract ID or delivery interval values"
          },
          "401": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Insufficient permissions to update delivery interval"
          },
          "404": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Subscription contract not found"
          },
          "422": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Delivery interval update failed due to business rules"
          }
        },
        "summary": "Update delivery interval for a subscription contract",
        "tags": [
          "Subscription Management",
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-contracts-update-delivery-method": {
      "put": {
        "description": "Updates the delivery method for a subscription contract, supporting standard shipping, local delivery, and customer pickup options. The delivery method determines how future orders will be fulfilled.\n\n**Delivery Method Types:**\nThe system automatically determines the type based on the subscription's current delivery address:\n- **SHIPPING**: Standard shipping to customer address (default)\n- **LOCAL**: Local delivery within merchant's delivery zones\n- **PICK_UP**: Customer pickup at designated location\n\n**Two Ways to Update:**\n1. **Manual Parameters**: Omit delivery-method-id and provide title, code, and presentment title directly. This preserves the delivery price on both legacy and market-driven shops and enables the contract's manual price override.\n2. **Delivery Method ID**: Provide a Shopify DeliveryMethodDefinition ID or a full Market delivery-option GraphQL ID returned by the shop delivery-options catalogue.\n\n**Using Delivery Method ID:**\nWhen providing a delivery-method-id:\n- Legacy shops fetch the method from Shopify's delivery profiles\n- Automatically sets title, code, and presentment title\n- Applies associated delivery price if defined\n- DeliveryMethodDefinition IDs can be numeric or full GraphQL IDs; Market option IDs must be full GraphQL IDs\n- On market-driven shops, the server resolves the selected option's title and applies a unique current quote for the contract under its draft lock\n- A missing or ambiguous live quote rejects the update without changing the contract\n- Applying a live quote resumes automatic shipping price synchronization\n\n**Delivery Type Requirements:**\n- **Standard Shipping**: No additional requirements\n- **Local Delivery**: Phone number must exist in delivery address\n- **Pickup**: Pickup location must be configured in subscription\n\n**Price Updates:**\n- If using delivery-method-id with a fixed price, updates delivery price\n- Manual updates don't change the delivery price\n- Price changes affect all future orders\n\n**Side Effects:**\n- Creates activity log entry with method details\n- May remove invalid discount codes automatically\n- Updates apply to all future orders immediately\n- No customer notification sent\n\n**Common Use Cases:**\n- Switch from standard shipping to express shipping\n- Change pickup location for customer convenience\n- Update local delivery options based on availability\n- Apply seasonal delivery methods\n\n**Important Notes:**\n- Cannot change the delivery type (shipping/local/pickup) - only the method within that type\n- Delivery methods must be configured in Shopify's shipping settings\n- Changes don't affect orders already in fulfillment\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "updateDeliveryMethod",
        "parameters": [
          {
            "description": "API Key for authentication",
            "example": "apst_your-api-key-here",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Subscription contract ID to update",
            "example": 123456789,
            "in": "query",
            "name": "contractId",
            "required": true,
            "schema": {
              "format": "int64",
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "Display name of the delivery method. This is what customers see. Ignored if delivery-method-id is provided.",
            "example": "Express Shipping",
            "in": "query",
            "name": "delivery-method-title",
            "required": true,
            "schema": {
              "maxLength": 255,
              "type": "string"
            }
          },
          {
            "description": "Internal code for the delivery method. Often same as title. Used for system identification. Ignored if delivery-method-id is provided.",
            "example": "EXPRESS_SHIP",
            "in": "query",
            "name": "delivery-method-code",
            "required": true,
            "schema": {
              "maxLength": 255,
              "type": "string"
            }
          },
          {
            "description": "Localized version of the title for multi-language stores. Often same as title for single-language stores. Ignored if delivery-method-id is provided.",
            "example": "Express Shipping",
            "in": "query",
            "name": "delivery-method-presentment-title",
            "required": true,
            "schema": {
              "maxLength": 255,
              "type": "string"
            }
          },
          {
            "description": "Optional DeliveryMethodDefinition ID (numeric or full GraphQL ID), or a full Market option ID such as gid://shopify/DeliveryFlatRateOptionDefinition/123. Market-driven shops apply a current eligible quote for the selected option. Omit for a custom title/code edit that preserves the current delivery price and enables manual price override.",
            "example": 123456,
            "in": "query",
            "name": "delivery-method-id",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Delivery method successfully updated",
            "headers": {
              "X-Alert": {
                "description": "Success message",
                "schema": {
                  "example": "Subscription Updated",
                  "type": "string"
                },
                "style": "simple"
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Invalid Delivery Method ID": {
                    "description": "Invalid Delivery Method ID",
                    "value": {
                      "detail": "The specified delivery method does not exist in store's delivery profiles",
                      "status": 400,
                      "title": "UserGeneratedError:Delivery method not found for deliveryMethodID:999999",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Local Delivery Phone Required": {
                    "description": "Local Delivery Phone Required",
                    "value": {
                      "detail": "Local delivery requires a phone number in the delivery address",
                      "status": 400,
                      "title": "UserGeneratedError:Phone number is required",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "No Delivery Address": {
                    "description": "No Delivery Address",
                    "value": {
                      "detail": "Subscription has no delivery address configured",
                      "status": 400,
                      "title": "UserGeneratedError:Delivery method not found for contract:123456789",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Shopify API Error": {
                    "description": "Shopify API Error",
                    "value": {
                      "detail": "Delivery method is not available for this delivery address",
                      "status": 400,
                      "title": "UserGeneratedError:Unable to update delivery method",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid request or update failed"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header is required",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to modify delivery methods",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions"
          },
          "404": {
            "description": "Subscription contract not found"
          },
          "422": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Selected delivery method cannot be used with subscription products",
                  "status": 422,
                  "title": "Delivery method incompatible",
                  "type": "https://example.com/errors/unprocessable-entity"
                }
              }
            },
            "description": "Delivery method cannot be applied"
          }
        },
        "summary": "Update subscription delivery method",
        "tags": [
          "Subscription Management",
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-contracts-update-delivery-price": {
      "put": {
        "description": "Updates the fixed delivery price for all future orders in a subscription contract. This allows manual override of calculated shipping rates with a custom delivery fee.\n\n**Key Features:**\n- Sets a fixed delivery price regardless of shipping calculations\n- Overrides any dynamic shipping rates from carriers\n- Applies to all future orders immediately\n- Can set to 0 for free delivery\n- Automatically handles invalid discount codes\n- Tracks price changes in activity log\n\n**How Delivery Pricing Works:**\n- **Calculated Rates**: Default behavior uses carrier rates and rules\n- **Manual Override**: This endpoint sets a fixed price\n- **Precedence**: Manual price overrides all calculations\n- **Currency**: Always in shop's base currency\n\n**Common Use Cases:**\n- **Free Shipping Promotions**: Set to 0.00\n- **Flat Rate Shipping**: Fixed price regardless of location\n- **VIP Customer Rates**: Special shipping prices\n- **Subscription Perks**: Reduced delivery fees\n- **Price Corrections**: Fix shipping calculation errors\n- **Regional Adjustments**: Custom rates for specific areas\n\n**Impact on Orders:**\n- Next order uses new delivery price\n- All future recurring orders affected\n- Existing orders keep original pricing\n- Customer sees updated total immediately\n- No recalculation on address changes\n\n**Price Validation:**\n- Must be a valid decimal number\n- Can be 0 for free shipping\n- No maximum limit enforced\n- Negative values typically rejected by Shopify\n- Currency precision respected (e.g., 2 decimals for USD)\n\n**Side Effects:**\n- Invalid discount codes automatically removed\n- Activity log created with old/new prices\n- No customer email notification sent\n- Shipping tax recalculated if applicable\n- Total order value updated\n\n**Reverting to Calculated Rates:**\nTo restore dynamic shipping calculations:\n1. Use the sync shipping price endpoint\n2. Or update delivery method\n3. Manual price remains until explicitly changed\n\n**Important Notes:**\n- Price includes all delivery charges (shipping + handling)\n- Does not affect delivery method or speed\n- Consider customer communication for increases\n- May affect subscription profitability\n- Some payment methods may decline on total changes\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "updateDeliveryPrice",
        "parameters": [
          {
            "description": "The unique identifier of the subscription contract",
            "example": 123456789,
            "in": "query",
            "name": "contractId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "New delivery price to be applied to the subscription contract. This is a fixed price that overrides any calculated shipping rates. Set to 0 for free delivery. Price must be in the shop's base currency.",
            "example": 9.99,
            "in": "query",
            "name": "deliveryPrice",
            "required": true,
            "schema": {
              "format": "double",
              "maximum": 99999.99,
              "minimum": 0,
              "type": "number"
            }
          },
          {
            "deprecated": true,
            "description": "Deprecated API Key parameter; use the X-API-Key header instead",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key for authentication",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "customer": {
                        "displayName": "John Doe",
                        "email": "customer@example.com",
                        "id": "gid://shopify/Customer/987654321"
                      },
                      "deliveryMethod": {
                        "__typename": "SubscriptionDeliveryMethodShipping",
                        "shippingOption": {
                          "code": "STANDARD",
                          "presentmentTitle": "Standard Shipping (5-7 days)",
                          "title": "Standard Shipping"
                        }
                      },
                      "deliveryPrice": {
                        "amount": "9.99",
                        "currencyCode": "USD"
                      },
                      "id": "gid://shopify/SubscriptionContract/123456789",
                      "lines": {
                        "edges": [
                          {
                            "node": {
                              "currentPrice": {
                                "amount": "39.99",
                                "currencyCode": "USD"
                              },
                              "id": "gid://shopify/SubscriptionLine/111111",
                              "quantity": 1,
                              "title": "Monthly Subscription Box",
                              "variantId": "gid://shopify/ProductVariant/42549172011164"
                            }
                          }
                        ]
                      },
                      "nextBillingDate": "2024-04-01T00:00:00Z",
                      "status": "ACTIVE",
                      "totalPrice": {
                        "amount": "49.98",
                        "currencyCode": "USD"
                      }
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Successfully updated delivery price and returned the updated subscription contract"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Contract Not Found": {
                    "description": "Contract Not Found",
                    "value": {
                      "detail": "No subscription contract found with ID 123456789",
                      "status": 400,
                      "title": "Contract does not exist",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Delivery Price": {
                    "description": "Invalid Delivery Price",
                    "value": {
                      "detail": "Delivery price must be a valid positive number",
                      "status": 400,
                      "title": "Invalid delivery price",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Negative Price Error": {
                    "description": "Negative Price Error",
                    "value": {
                      "detail": "Delivery price must be 0 or greater",
                      "status": 400,
                      "title": "UserGeneratedError:Delivery price cannot be negative",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "No Delivery Method": {
                    "description": "No Delivery Method",
                    "value": {
                      "detail": "Cannot set delivery price for subscriptions without delivery method",
                      "status": 400,
                      "title": "UserGeneratedError:No delivery method configured",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid contract ID, delivery price, or update failure due to business logic constraints"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid API key is required to access this endpoint",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required or invalid API key"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to modify delivery pricing",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to update the delivery price"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Subscription contract with ID 123456789 not found",
                  "status": 404,
                  "title": "Resource not found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Subscription contract not found"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "Currency Precision Error": {
                    "description": "Currency Precision Error",
                    "value": {
                      "detail": "Price 9.999 exceeds currency precision for USD (2 decimal places)",
                      "status": 422,
                      "title": "UserGeneratedError:Invalid price precision",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  },
                  "Invalid Discount Code Removed": {
                    "description": "Invalid Discount Code Removed",
                    "value": {
                      "detail": "Delivery price updated successfully, but invalid discount code 'FREESHIP' was automatically removed",
                      "status": 422,
                      "title": "Delivery price updated with warnings",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  },
                  "Shopify API Error": {
                    "description": "Shopify API Error",
                    "value": {
                      "detail": "Shopify API error: Cannot modify subscription during active billing attempt",
                      "status": 422,
                      "title": "UserGeneratedError:Unable to update delivery price",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  }
                }
              }
            },
            "description": "Delivery price update failed due to invalid input or system constraints"
          }
        },
        "summary": "Update delivery price for a subscription contract",
        "tags": [
          "Subscription Management",
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-contracts-update-delivery-price-override": {
      "put": {
        "description": "Sets the \"Use Custom Delivery Price\" option (`allowDeliveryPriceOverride`) for a subscription contract.\nThis is the same checkbox shown in the Delivery Information section of the subscription in the merchant portal.\n\n- **true**: The contract keeps its current delivery price. Automatic shipping price syncs from your Shopify\n  shipping settings are skipped for this contract. Use this together with\n  `PUT /api/external/v2/subscription-contracts-update-delivery-price` to keep a manually set price.\n- **false**: The delivery price syncs with your Shopify shipping settings again. When the option is turned off,\n  the delivery price is recalculated from your Shopify shipping rates in the background (unless automatic\n  shipping price calculation is turned off in your shop settings).\n\nSending the value the contract already has makes no changes.\n\nAuthentication is enforced via the X-API-Key header (the 'api_key' parameter is deprecated).\n",
        "operationId": "updateDeliveryPriceOverrideV2",
        "parameters": [
          {
            "description": "Contract ID",
            "example": 123456789,
            "in": "query",
            "name": "contractId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "Use Custom Delivery Price. true keeps the contract's current delivery price and skips automatic shipping price syncs; false syncs the delivery price with your Shopify shipping settings again.",
            "example": true,
            "in": "query",
            "name": "allowDeliveryPriceOverride",
            "required": true,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContractDetailsDTO"
                }
              }
            },
            "description": "Custom delivery price option updated. Returns the subscription contract details, including allowDeliveryPriceOverride."
          },
          "400": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContractDetailsDTO"
                }
              }
            },
            "description": "Invalid contract ID or the contract does not belong to this shop"
          },
          "401": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContractDetailsDTO"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContractDetailsDTO"
                }
              }
            },
            "description": "Insufficient permissions to update the subscription contract"
          }
        },
        "summary": "Turn custom delivery price on or off for a subscription contract",
        "tags": [
          "Subscription Management",
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-contracts-update-existing-payment-method": {
      "put": {
        "description": "Updates the payment method for an existing subscription contract to use a different existing payment method. The new payment method must already be associated with the customer in Shopify.\n\n**Important Notes:**\n- The payment method must already exist in the customer's Shopify payment methods\n- Only valid, non-revoked payment methods can be used\n- The update is processed through Shopify's subscription draft system\n- Payment method details are cached locally after successful update\n\n**Process Flow:**\n1. Validates subscription contract exists\n2. Creates a draft update in Shopify\n3. Updates the draft with new payment method\n4. Commits the draft to apply changes\n5. Caches payment instrument details locally\n6. Records activity log entry\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "updateExistingPaymentMethodV2",
        "parameters": [
          {
            "description": "Subscription contract ID to update payment method for. Must be a valid contract ID that belongs to the authenticated shop.",
            "example": 123456789,
            "in": "query",
            "name": "contractId",
            "required": true,
            "schema": {
              "format": "int64",
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "ID of the existing customer payment method to use. Must be a valid Shopify GraphQL payment method ID in the format 'gid://shopify/CustomerPaymentMethod/{id}'. The payment method must:\n- Already exist in the customer's Shopify account\n- Be in a valid state (not expired or revoked)\n- Be authorized for subscription use\n\nYou can retrieve available payment methods using the customer payment methods endpoint.",
            "example": "gid://shopify/CustomerPaymentMethod/cdb2bbe581599b20439ebf636a380b8b",
            "in": "query",
            "name": "paymentMethodId",
            "required": true,
            "schema": {
              "pattern": "^gid://shopify/CustomerPaymentMethod/[a-zA-Z0-9]+$",
              "type": "string"
            }
          },
          {
            "description": "API Key for authentication",
            "example": "apst_your-api-key-here",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "message": "Payment method updated successfully"
                }
              }
            },
            "description": "Payment method updated successfully"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Contract Not Found": {
                    "description": "Contract Not Found",
                    "value": {
                      "detail": "No subscription contract found with the specified ID",
                      "instance": "/api/external/v2/subscription-contracts-update-existing-payment-method",
                      "status": 400,
                      "title": "Contract does not exist",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Payment Method": {
                    "description": "Invalid Payment Method",
                    "value": {
                      "detail": "Payment method ID is required and must be valid",
                      "instance": "/api/external/v2/subscription-contracts-update-existing-payment-method",
                      "status": 400,
                      "title": "UserGeneratedError:Invalid payment method provided",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Payment Method Status": {
                    "description": "Invalid Payment Method Status",
                    "value": {
                      "detail": "The payment method cannot be used because it is expired or revoked",
                      "instance": "/api/external/v2/subscription-contracts-update-existing-payment-method",
                      "status": 400,
                      "title": "UserGeneratedError:Payment method is expired",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Payment Method Not Found": {
                    "description": "Payment Method Not Found",
                    "value": {
                      "detail": "The specified payment method does not exist or is not associated with this customer",
                      "instance": "/api/external/v2/subscription-contracts-update-existing-payment-method",
                      "status": 400,
                      "title": "UserGeneratedError:Payment method not found",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Shopify API Error": {
                    "description": "Shopify API Error",
                    "value": {
                      "detail": "Shopify returned an error when attempting to update the payment method",
                      "instance": "/api/external/v2/subscription-contracts-update-existing-payment-method",
                      "status": 400,
                      "title": "UserGeneratedError:Unable to update payment method at this time",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid request or update failed"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header is required",
                  "instance": "/api/external/v2/subscription-contracts-update-existing-payment-method",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to update payment methods",
                  "instance": "/api/external/v2/subscription-contracts-update-existing-payment-method",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to update payment method"
          },
          "404": {
            "description": "Subscription contract not found"
          },
          "422": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Cannot update payment method while subscription has pending charges",
                  "instance": "/api/external/v2/subscription-contracts-update-existing-payment-method",
                  "status": 422,
                  "title": "Payment method update failed",
                  "type": "https://example.com/errors/unprocessable-entity"
                }
              }
            },
            "description": "Payment method update failed due to business rules"
          }
        },
        "summary": "Update subscription payment method",
        "tags": [
          "Subscription Payments",
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-contracts-update-frequency-by-compatible-plan": {
      "put": {
        "description": "Strict compatible frequency update. Use frequencyKey from /api/data/external/v2/compatible-selling-plan-frequencies or a sellingPlanId that belongs to one compatible frequency option. The existing /api/external/v2/subscription-contracts-update-frequency-by-selling-plan endpoint remains legacy for backward compatibility.",
        "operationId": "updateFrequencyByCompatiblePlanV2",
        "parameters": [
          {
            "description": "Subscription contract ID to update. Provide the numeric ID without the gid:// prefix",
            "example": 123456789,
            "in": "query",
            "name": "contractId",
            "required": true,
            "schema": {
              "format": "int64",
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "API Key for authentication",
            "example": "apst_your-api-key-here",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Compatible frequency key returned by /api/data/external/v2/compatible-selling-plan-frequencies",
            "example": "MONTH:1",
            "in": "query",
            "name": "frequencyKey",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "A selling plan ID from a compatible frequency option. Provide the numeric ID without gid:// prefix.",
            "example": 56789,
            "in": "query",
            "name": "sellingPlanId",
            "required": false,
            "schema": {
              "format": "int64",
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "OK"
          }
        },
        "summary": "Update Subscription contract frequency by compatible selling-plan frequency",
        "tags": [
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-contracts-update-frequency-by-selling-plan": {
      "put": {
        "operationId": "updateFrequencyBySellingPlanV2",
        "parameters": [
          {
            "description": "Subscription contract ID to update. Provide the numeric ID without the gid:// prefix",
            "example": 123456789,
            "in": "query",
            "name": "contractId",
            "required": true,
            "schema": {
              "format": "int64",
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "API Key for authentication",
            "example": "apst_your-api-key-here",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "The unique identifier of the new selling plan. Provide the numeric ID without gid:// prefix.",
            "example": 56789,
            "in": "query",
            "name": "sellingPlanId",
            "required": true,
            "schema": {
              "format": "int64",
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "billingPolicy": {
                        "anchors": [],
                        "interval": "DAY",
                        "intervalCount": 5,
                        "maxCycles": 6,
                        "minCycles": 3
                      },
                      "customer": {
                        "displayName": "abc xyz",
                        "email": "abc@gmail.com",
                        "firstName": "abc",
                        "id": "gid://shopify/Customer/111111111111",
                        "lastName": "xyz"
                      },
                      "customerPaymentMethod": {
                        "id": "gid://shopify/CustomerPaymentMethod/1111111111111111111",
                        "instrument": {
                          "brand": "bogus",
                          "expiryMonth": 12,
                          "expiryYear": 2030,
                          "lastDigits": "1",
                          "name": "abc xyz"
                        }
                      },
                      "deliveryMethod": {
                        "address": {
                          "address1": "test",
                          "city": "Sunnyvale",
                          "country": "United States",
                          "province": "California",
                          "zip": "94087"
                        }
                      },
                      "deliveryPolicy": {
                        "anchors": [],
                        "interval": "DAY",
                        "intervalCount": 5
                      },
                      "id": "gid://shopify/SubscriptionContract/123456789",
                      "lines": {
                        "edges": [
                          {
                            "node": {
                              "currentPrice": {
                                "amount": "154.0",
                                "currencyCode": "USD"
                              },
                              "id": "gid://shopify/SubscriptionLine/49e73332-5dfc-4fba-9ee7-111111111",
                              "lineDiscountedPrice": {
                                "amount": "154.0",
                                "currencyCode": "USD"
                              },
                              "productId": "gid://shopify/Product/1111111111",
                              "quantity": 1,
                              "sellingPlanId": "gid://shopify/SellingPlan/691881211111",
                              "sellingPlanName": "4 Monthly Subscription",
                              "taxable": true,
                              "title": "Blub Indoor",
                              "variantId": "gid://shopify/ProductVariant/111111111111",
                              "variantImage": {
                                "transformedSrc": "https://cdn.shopify.com/s/files/1/0933/4738/1543/files/shopping_41111111111111111111111111111111111"
                              }
                            }
                          }
                        ]
                      },
                      "nextBillingDate": "2025-08-08T13:00:00Z",
                      "status": "ACTIVE"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Subscription contract frequency updated successfully"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Contract Not Found": {
                    "description": "Contract Not Found",
                    "value": {
                      "detail": "No subscription contract found with ID 32212746535",
                      "status": 400,
                      "title": "Subscription contract not found",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Interval Count": {
                    "description": "Invalid Interval Count",
                    "value": {
                      "detail": "Interval count must be between 1 and 365",
                      "status": 400,
                      "title": "Invalid interval count",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Interval Type": {
                    "description": "Invalid Interval Type",
                    "value": {
                      "detail": "Interval must be one of: DAY, WEEK, MONTH, YEAR",
                      "status": 400,
                      "title": "Invalid interval type",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Prepaid Validation Error": {
                    "description": "Prepaid Validation Error",
                    "value": {
                      "detail": "Cannot bill every 5 days for 5-day deliveries in prepaid subscriptions",
                      "status": 400,
                      "title": "UserGeneratedError:Billing interval cannot be less than or equal to delivery interval for prepaid contracts",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Same Interval Error": {
                    "description": "Same Interval Error",
                    "value": {
                      "detail": "The subscription is already set to bill every 5 days",
                      "status": 400,
                      "title": "UserGeneratedError:Billing interval cannot be the same as old billing interval",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid request parameters or business rule violation"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid API key is required to access this endpoint",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required - missing or invalid API key"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to modify subscription contracts",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to update subscription contract"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Subscription contract with ID 32212746535 not found",
                  "status": 404,
                  "title": "Resource not found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Subscription contract not found"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "No Matching Selling Plan": {
                    "description": "No Matching Selling Plan",
                    "value": {
                      "detail": "No selling plan found for the requested billing frequency",
                      "status": 422,
                      "title": "No selling plan available",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  },
                  "Shopify API Error": {
                    "description": "Shopify API Error",
                    "value": {
                      "detail": "Shopify API error: Cannot modify subscription during active billing attempt",
                      "status": 422,
                      "title": "Unable to update subscription contract",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  }
                }
              }
            },
            "description": "Update failed due to Shopify constraints"
          }
        },
        "summary": "Update Subscription contract frequency by selling plan",
        "tags": [
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-contracts-update-line-item": {
      "put": {
        "description": "Comprehensive endpoint for updating a subscription line item's quantity, price, product variant, and/or selling plan in a single API call. Changes are applied intelligently - only modified values trigger updates.\n\n**Key Features:**\n- Update any combination of: quantity, price, variant, or selling plan\n- Intelligent change detection - only updates what's different\n- Automatic handling of prepaid subscription pricing\n- Preserves existing discount cycles when updating price\n- Partial success allowed - some updates may fail while others succeed\n- Each change creates separate activity log entries\n\n**Prepaid Subscription Handling:**\nFor prepaid subscriptions (billing interval > delivery interval):\n- When `isPricePerUnit=true`: Price is multiplied by interval ratio\n- Example: Monthly billing, weekly delivery = price \u00d7 4\n- When `isPricePerUnit=false`: Price is used as total billing amount\n\n**Update Process:**\n1. Validates line item exists in the subscription\n2. Calculates interval multiplier for prepaid logic\n3. Updates in order: selling plan \u2192 price \u2192 quantity \u2192 variant\n4. Each update uses separate Shopify GraphQL mutation\n5. Failures are logged but don't block other updates\n\n**Selling Plan Updates:**\n- Can update by ID or name (name takes precedence)\n- Only updates if different from current plan\n- Useful for changing delivery frequency options\n\n**Price Updates:**\n- Preserves existing discount cycles (up to 2 cycles)\n- Recalculates cycle discounts based on new base price\n- Triggers shipping price recalculation\n- Sends price update email to customer\n\n**Quantity Updates:**\n- Validates against min/max quantity rules\n- Updates Build-a-Box totals if applicable\n- May trigger discount recalculations\n\n**Variant Updates:**\n- Changes the product itself (different SKU)\n- Validates new variant exists and is available\n- May affect pricing and discounts\n\n**Important Notes:**\n- All parameters except contractId and lineId are optional\n- Provide only the values you want to change\n- Price is always in shop's base currency\n- Changes apply to future orders only\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "updateLineItemV2",
        "parameters": [
          {
            "description": "Subscription contract ID",
            "example": 123456789,
            "in": "query",
            "name": "contractId",
            "required": true,
            "schema": {
              "format": "int64",
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "deprecated": true,
            "description": "API Key (Deprecated - Use X-API-Key header instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key for authentication",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "New quantity for the line item. Leave unchanged if not updating quantity.",
            "example": 3,
            "in": "query",
            "name": "quantity",
            "required": false,
            "schema": {
              "maximum": 9999,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "New product variant ID in Shopify GID format (e.g., gid://shopify/ProductVariant/42549172011164). This updates the associated product. Leave this parameter blank if you are not switching products.",
            "example": "gid://shopify/ProductVariant/42549172011164",
            "in": "query",
            "name": "variantId",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Line item ID to update. Must be the full GraphQL ID including gid:// prefix",
            "example": "gid://shopify/SubscriptionLine/111111",
            "in": "query",
            "name": "lineId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "New price for the line item in shop currency. Behavior depends on isPricePerUnit flag.",
            "example": 29.99,
            "in": "query",
            "name": "price",
            "required": false,
            "schema": {
              "format": "double",
              "maximum": 999999.99,
              "minimum": 0.01,
              "type": "number"
            }
          },
          {
            "description": "Determines how price is interpreted for prepaid subscriptions:\n- true: Price is per unit (per delivery), will be multiplied by interval ratio\n- false: Price is total billing amount (for all deliveries in billing period)\n\nExample: Monthly billing, weekly delivery, price=$10\n- isPricePerUnit=true: Customer pays $40/month ($10 \u00d7 4 weeks)\n- isPricePerUnit=false: Customer pays $10/month total",
            "example": false,
            "in": "query",
            "name": "isPricePerUnit",
            "required": false,
            "schema": {
              "default": false,
              "type": "boolean"
            }
          },
          {
            "description": "Name of the selling plan to apply. Takes precedence over current selling plan. Used to change delivery frequencies.",
            "example": "Deliver every 2 weeks",
            "in": "query",
            "name": "sellingPlanName",
            "required": false,
            "schema": {
              "maxLength": 255,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "billingPolicy": {
                        "interval": "MONTH",
                        "intervalCount": 1
                      },
                      "deliveryPolicy": {
                        "interval": "WEEK",
                        "intervalCount": 1
                      },
                      "id": "gid://shopify/SubscriptionContract/123456789",
                      "lines": {
                        "edges": [
                          {
                            "node": {
                              "currentPrice": {
                                "amount": "119.97",
                                "currencyCode": "USD"
                              },
                              "id": "gid://shopify/SubscriptionLine/111111",
                              "pricingPolicy": {
                                "basePrice": {
                                  "amount": "9.99",
                                  "currencyCode": "USD"
                                },
                                "cycleDiscounts": [
                                  {
                                    "adjustmentType": "PERCENTAGE",
                                    "adjustmentValue": {
                                      "percentage": 10.0
                                    },
                                    "afterCycle": 3,
                                    "computedPrice": {
                                      "amount": "107.97",
                                      "currencyCode": "USD"
                                    }
                                  }
                                ]
                              },
                              "quantity": 3,
                              "sellingPlanId": "gid://shopify/SellingPlan/777777",
                              "sellingPlanName": "Deliver every week",
                              "title": "Premium Coffee - Medium Roast",
                              "variantId": "gid://shopify/ProductVariant/98765432101"
                            }
                          }
                        ]
                      },
                      "nextBillingDate": "2024-03-01T00:00:00Z",
                      "status": "ACTIVE"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Line item successfully updated"
          },
          "207": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Partial success - some updates succeeded while others failed"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Invalid Quantity": {
                    "description": "Invalid Quantity",
                    "value": {
                      "detail": "Invalid quantity value provided",
                      "status": 400,
                      "title": "UserGeneratedError:Quantity must be greater than 0",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Selling Plan": {
                    "description": "Invalid Selling Plan",
                    "value": {
                      "detail": "No selling plan found with the specified name",
                      "status": 400,
                      "title": "UserGeneratedError:Selling plan not found",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Line Item Not Found": {
                    "description": "Line Item Not Found",
                    "value": {
                      "detail": "The specified line item does not exist in this subscription",
                      "status": 400,
                      "title": "No line item found for contract:123456789 and line id:gid://shopify/SubscriptionLine/999999",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Price Too Low": {
                    "description": "Price Too Low",
                    "value": {
                      "detail": "Invalid price value provided",
                      "status": 400,
                      "title": "UserGeneratedError:Price must be greater than 0",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Variant Not Found": {
                    "description": "Variant Not Found",
                    "value": {
                      "detail": "The specified product variant does not exist",
                      "status": 400,
                      "title": "Product Variant not found for ID: 99999999999",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid request parameters or update failed"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header is required",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to modify subscription contracts",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions"
          },
          "404": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Subscription contract not found"
          }
        },
        "summary": "Update multiple properties of a subscription line item",
        "tags": [
          "Subscription Products",
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-contracts-update-line-item-attributes": {
      "put": {
        "description": "Replaces the custom attributes (line item properties) of one line in a subscription contract with exactly the list you send. Any attribute you leave out is removed, Appstle's own included, so to change one attribute, read the line's current attributes first and send the complete list with your change included. A Build-A-Box line stores the box in five attributes (`products`, `_appstle-bb-id`, `__appstle-bb-name`, `_appstle-bb-product-sku` and `__appstle-bb-variants`), and a one-time line carries `_appstle-one-time-product`: leave that out and the line is no longer removed after the next order. The call acts as the merchant, so none of the customer portal's rules apply: not the editing setting, the product-change window, the minimum-cycle freeze or the box's limits. Authenticate with the `X-API-Key` header. The `api_key` query parameter is deprecated.",
        "operationId": "updateLineItemAttributesV2",
        "parameters": [
          {
            "description": "The unique identifier of the subscription contract",
            "example": 123456789,
            "in": "query",
            "name": "contractId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "deprecated": true,
            "description": "Deprecated: API key (use X-API-Key header instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key for authentication",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "The line to update, as the line's GID from the contract's lines.",
            "example": "gid://shopify/SubscriptionLine/2f8c1d4e-7a3b-4c19-9d5e-6b0a1c2d3e4f",
            "in": "query",
            "name": "lineId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "description": "The line's complete list of attributes, as key and value pairs. It replaces all existing attributes: include every attribute the line should keep, because any you leave out are removed.",
                "items": {
                  "$ref": "#/components/schemas/AttributeInfo"
                },
                "type": "array"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Line item attributes updated successfully"
          },
          "400": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Invalid contract ID, line item ID, or attribute values"
          },
          "401": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Insufficient permissions to update the subscription"
          },
          "404": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Subscription contract or line item not found"
          }
        },
        "summary": "Update line item attributes for a subscription contract",
        "tags": [
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-contracts-update-line-item-price": {
      "put": {
        "description": "Updates the base price of a specific product line item within a subscription contract. This endpoint intelligently handles pricing updates while preserving existing discount structures.\n\n**Key Features:**\n- Updates base price while maintaining discount cycles\n- Automatically calculates prepaid subscription prices\n- Preserves existing percentage/fixed discounts\n- Validates actual price changes before updating\n- Triggers shipping and discount recalculations\n- Sends price update notifications to customers\n\n**Base Price vs Current Price:**\n- **Base Price**: The unit price before any multipliers\n- **Current Price**: Base price \u00d7 fulfillment multiplier\n- For monthly billing/weekly delivery: Current = Base \u00d7 4\n- For pay-per-delivery: Current = Base \u00d7 1\n\n**Discount Preservation:**\nBy default, this endpoint preserves existing discount cycles:\n- Percentage discounts adjust to new base price\n- Fixed discounts remain at same dollar amount\n- Discount schedule (after X cycles) unchanged\n\n**Prepaid Subscription Handling:**\nFor prepaid subscriptions (billing interval > delivery interval):\n- Automatically calculates fulfillment multiplier\n- Updates current price accordingly\n- Ensures correct billing amounts\n\n**Post-Update Actions:**\n1. Build-a-Box discount recalculation\n2. Product discount synchronization\n3. Shipping price updates\n4. Customer email notifications\n5. Activity log creation\n\n**Important Notes:**\n- Price changes apply to future orders only\n- Cannot set price below $0.01\n- Maximum 2 discount cycles preserved\n- No update if price unchanged\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "updateLineItemPriceV2",
        "parameters": [
          {
            "description": "Subscription contract ID. Provide the numeric ID without the gid:// prefix",
            "example": 123456789,
            "in": "query",
            "name": "contractId",
            "required": true,
            "schema": {
              "format": "int64",
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "deprecated": true,
            "description": "API Key (Deprecated - Use X-API-Key header instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key for authentication",
            "example": "apst_your-api-key-here",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "New base price for the line item (unit price before multipliers)",
            "example": 24.99,
            "in": "query",
            "name": "basePrice",
            "required": true,
            "schema": {
              "format": "double",
              "maximum": 999999.99,
              "minimum": 0.01,
              "type": "number"
            }
          },
          {
            "description": "Line item ID to update. Must be the full GraphQL ID including the gid:// prefix",
            "example": "gid://shopify/SubscriptionLine/4245-cfgfg-xcfdg",
            "in": "query",
            "name": "lineId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "billingPolicy": {
                        "interval": "MONTH",
                        "intervalCount": 1
                      },
                      "customer": {
                        "email": "customer@example.com",
                        "id": "gid://shopify/Customer/987654321"
                      },
                      "deliveryPolicy": {
                        "interval": "WEEK",
                        "intervalCount": 1
                      },
                      "id": "gid://shopify/SubscriptionContract/123456789",
                      "lines": {
                        "edges": [
                          {
                            "node": {
                              "currentPrice": {
                                "amount": "99.96",
                                "currencyCode": "USD"
                              },
                              "id": "gid://shopify/SubscriptionLine/111111",
                              "pricingPolicy": {
                                "basePrice": {
                                  "amount": "24.99",
                                  "currencyCode": "USD"
                                },
                                "cycleDiscounts": [
                                  {
                                    "adjustmentType": "PERCENTAGE",
                                    "adjustmentValue": {
                                      "percentage": 10.0
                                    },
                                    "afterCycle": 3,
                                    "computedPrice": {
                                      "amount": "89.96",
                                      "currencyCode": "USD"
                                    }
                                  }
                                ]
                              },
                              "quantity": 1,
                              "title": "Premium Coffee - Monthly Supply",
                              "variantId": "gid://shopify/ProductVariant/42549172011164"
                            }
                          }
                        ]
                      },
                      "nextBillingDate": "2024-04-01T12:00:00Z",
                      "status": "ACTIVE"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Line item price successfully updated"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Invalid Base Price": {
                    "description": "Invalid Base Price",
                    "value": {
                      "detail": "Base price must be greater than 0",
                      "status": 400,
                      "title": "Invalid base price",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Line ID Format": {
                    "description": "Invalid Line ID Format",
                    "value": {
                      "detail": "Line ID must be in format: gid://shopify/SubscriptionLine/[numeric_id]",
                      "status": 400,
                      "title": "Invalid line ID format",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Line Item Not Found": {
                    "description": "Line Item Not Found",
                    "value": {
                      "detail": "No line item found with ID: gid://shopify/SubscriptionLine/999999",
                      "status": 400,
                      "title": "Line item not found",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid request parameters"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid API key is required to access this endpoint",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required - missing or invalid API key"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to modify subscription contracts",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to modify subscription"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Subscription contract with ID 123456789 not found",
                  "status": 404,
                  "title": "Resource not found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Subscription contract not found"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "No Price Change": {
                    "description": "No Price Change",
                    "value": {
                      "detail": "The new base price is the same as the current base price",
                      "status": 422,
                      "title": "No update needed",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  },
                  "Shopify API Error": {
                    "description": "Shopify API Error",
                    "value": {
                      "detail": "Shopify API error: Cannot modify subscription during active billing attempt",
                      "status": 422,
                      "title": "UserGeneratedError:Unable to update line item price",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  }
                }
              }
            },
            "description": "Unable to process the price update"
          }
        },
        "summary": "Update product line item price",
        "tags": [
          "Subscription Products",
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-contracts-update-line-item-pricing-policy": {
      "put": {
        "description": "Sets up advanced pricing rules for a subscription line item that change based on the number of successful orders (cycles). This powerful feature enables loyalty discounts, promotional pricing tiers, and subscribe-and-save models.\n\n**What are Pricing Policies?**\nPricing policies define how a product's price changes over the subscription lifetime:\n- **Base Price**: Starting price for the product\n- **Cycle Discounts**: Price changes after specific numbers of orders\n- **Automatic Application**: System applies correct price based on order history\n\n**Supported Discount Types:**\n- **PERCENTAGE**: Percentage off base price (e.g., 10% off)\n- **FIXED**: Fixed amount off base price (e.g., $5 off)\n- **PRICE**: Override with new fixed price (e.g., $19.99)\nNote: SHIPPING and FREE_PRODUCT types are not supported by this endpoint\n\n**Cycle Counting:**\n- Cycles start at 1 (first order is cycle 1)\n- Only successful billing attempts count\n- Failed payments don't increment the cycle\n- Current cycle = 1 + count of successful past orders\n\n**Common Use Cases:**\n1. **Subscribe & Save**: 10% off starting from 3rd order\n2. **Loyalty Tiers**: 5% off after 3 orders, 10% after 6 orders\n3. **Introductory Pricing**: First 2 orders at $9.99, then $14.99\n4. **Promotional Periods**: Special price for orders 3-5\n\n**Important Limitations:**\n- Maximum 2 cycle discounts per line item\n- Cycles must have different afterCycle values\n- Changes apply to future orders only\n- Existing orders keep their original pricing\n\n**Prepaid Subscription Handling:**\nFor prepaid subscriptions (e.g., pay monthly for weekly delivery):\n- Base price is per delivery\n- Current price = base price \u00d7 delivery frequency\n- Discounts apply to base price, then multiply\n\n**Side Effects:**\n- Sends price update email to customer\n- Recalculates Build-a-Box discounts\n- Updates product discount synchronization\n- Triggers shipping price recalculation\n- Creates detailed activity log\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "updateLineItemPricingPolicyV2",
        "parameters": [
          {
            "deprecated": true,
            "description": "API Key (Deprecated - Use X-API-Key header instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key for authentication",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Subscription contract ID",
            "example": 123456789,
            "in": "query",
            "name": "contractId",
            "required": true,
            "schema": {
              "format": "int64",
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "Line item ID to update. Must be full GraphQL ID format",
            "example": "gid://shopify/SubscriptionLine/111111",
            "in": "query",
            "name": "lineId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Base price for the product (before any discounts). This is the starting price",
            "example": 24.99,
            "in": "query",
            "name": "basePrice",
            "required": true,
            "schema": {
              "format": "double",
              "maximum": 999999.99,
              "minimum": 0.01,
              "type": "number"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "examples": {
                "Clear All Discounts": {
                  "description": "Clear All Discounts",
                  "value": []
                },
                "Fixed Amount Discounts": {
                  "description": "Fixed Amount Discounts",
                  "value": [
                    {
                      "afterCycle": 2,
                      "discountType": "FIXED",
                      "value": 5.0
                    },
                    {
                      "afterCycle": 5,
                      "discountType": "FIXED",
                      "value": 10.0
                    }
                  ]
                },
                "Special Pricing After Trial": {
                  "description": "Special Pricing After Trial",
                  "value": [
                    {
                      "afterCycle": 3,
                      "discountType": "PRICE",
                      "value": 19.99
                    }
                  ]
                },
                "Subscribe & Save (10% off after 3 orders)": {
                  "description": "Subscribe & Save (10% off after 3 orders)",
                  "value": [
                    {
                      "afterCycle": 3,
                      "discountType": "PERCENTAGE",
                      "value": 10.0
                    }
                  ]
                },
                "Tiered Loyalty Discounts": {
                  "description": "Tiered Loyalty Discounts",
                  "value": [
                    {
                      "afterCycle": 3,
                      "discountType": "PERCENTAGE",
                      "value": 5.0
                    },
                    {
                      "afterCycle": 6,
                      "discountType": "PERCENTAGE",
                      "value": 10.0
                    }
                  ]
                }
              },
              "schema": {
                "type": "string"
              }
            }
          },
          "description": "List of cycle-based pricing rules. Maximum 2 cycles, must have unique afterCycle values"
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "id": "gid://shopify/SubscriptionContract/123456789",
                      "lines": {
                        "edges": [
                          {
                            "node": {
                              "currentPrice": {
                                "amount": "24.99",
                                "currencyCode": "USD"
                              },
                              "id": "gid://shopify/SubscriptionLine/111111",
                              "pricingPolicy": {
                                "basePrice": {
                                  "amount": "24.99",
                                  "currencyCode": "USD"
                                },
                                "cycleDiscounts": [
                                  {
                                    "adjustmentType": "PERCENTAGE",
                                    "adjustmentValue": {
                                      "percentage": 10.0
                                    },
                                    "afterCycle": 3,
                                    "computedPrice": {
                                      "amount": "22.49",
                                      "currencyCode": "USD"
                                    }
                                  },
                                  {
                                    "adjustmentType": "PERCENTAGE",
                                    "adjustmentValue": {
                                      "percentage": 15.0
                                    },
                                    "afterCycle": 6,
                                    "computedPrice": {
                                      "amount": "21.24",
                                      "currencyCode": "USD"
                                    }
                                  }
                                ]
                              },
                              "quantity": 1,
                              "variantId": "gid://shopify/ProductVariant/42549172011164"
                            }
                          }
                        ]
                      },
                      "status": "ACTIVE"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Pricing policy successfully updated"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Invalid Base Price": {
                    "description": "Invalid Base Price",
                    "value": {
                      "detail": "Base price must be greater than 0",
                      "status": 400,
                      "title": "Invalid base price",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Cycle Configuration": {
                    "description": "Invalid Cycle Configuration",
                    "value": {
                      "detail": "Cycle discounts must have unique afterCycle values",
                      "status": 400,
                      "title": "Invalid cycle configuration",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Line Item Not Found": {
                    "description": "Line Item Not Found",
                    "value": {
                      "detail": "No line item found with ID: gid://shopify/SubscriptionLine/999999",
                      "status": 400,
                      "title": "Line item not found",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Too Many Cycles": {
                    "description": "Too Many Cycles",
                    "value": {
                      "detail": "Maximum 2 cycle discounts allowed per line item",
                      "status": 400,
                      "title": "Too many cycle discounts",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid request parameters"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header is required",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Insufficient permissions"
          },
          "404": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Subscription contract not found"
          },
          "422": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Shopify API error: Invalid discount configuration",
                  "status": 422,
                  "title": "UserGeneratedError:Unable to update pricing policy",
                  "type": "https://example.com/errors/unprocessable-entity"
                }
              }
            },
            "description": "Unable to apply pricing policy"
          }
        },
        "summary": "Update line item pricing policy with cycle-based discounts",
        "tags": [
          "Subscription Products",
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-contracts-update-line-item-quantity": {
      "put": {
        "description": "Updates the quantity of a specific product line item within a subscription contract. This comprehensive operation handles quantity validation, discount recalculation, and special Build-a-Box constraints.\n\n**Key Features:**\n- Updates quantity for future orders only\n- Validates minimum/maximum quantities for line items\n- Special handling for Build-a-Box subscriptions\n- Automatic discount recalculation\n- Shipping price updates\n- Activity log tracking with old/new values\n\n**Build-a-Box (BAB) Validation:**\nFor Build-a-Box subscriptions:\n- Enforces total minimum/maximum item counts\n- Only counts recurring products (excludes one-time and free items)\n- Validates across all BAB items in the subscription\n- Can be bypassed with 'allowToAddProductQuantityMinMaxReached' permission\n\n**Line Item Validation:**\nIndividual products may have:\n- Minimum quantity requirements (min_quantity attribute)\n- Maximum quantity limits (max_quantity attribute)\n- These are enforced separately from BAB constraints\n\n**Post-Update Actions:**\n1. **Activity Logging**: Records quantity change with old/new values\n2. **BAB Discount Sync**: Recalculates Build-a-Box volume discounts\n3. **Product Discount Sync**: Updates product-specific discounts\n4. **Shipping Price Update**: Recalculates shipping based on new quantity\n\n**Discount Recalculation:**\n- Build-a-Box discounts adjust based on total quantity tiers\n- May remove old discount codes and apply new ones\n- Handles 'subscription contract has changed' retry scenarios\n\n**Important Notes:**\n- Line ID must be the full GraphQL ID format\n- Quantity must be positive (minimum 1)\n- Changes apply to all future orders\n- Past or in-progress orders are not affected\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "updateLineItemQuantityV2",
        "parameters": [
          {
            "description": "Subscription contract ID to update. Provide the numeric ID without the gid:// prefix",
            "example": 123456789,
            "in": "query",
            "name": "contractId",
            "required": true,
            "schema": {
              "format": "int64",
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "deprecated": true,
            "description": "API Key (Deprecated - Use X-API-Key header instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key for authentication",
            "example": "apst_your-api-key-here",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "New quantity for the line item. Must be a positive integer",
            "example": 3,
            "in": "query",
            "name": "quantity",
            "required": true,
            "schema": {
              "maximum": 9999,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "Line item ID to update. Must be the full GraphQL ID including the gid:// prefix",
            "example": "gid://shopify/SubscriptionLine/111111",
            "in": "query",
            "name": "lineId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "customer": {
                        "email": "customer@example.com",
                        "id": "gid://shopify/Customer/987654321"
                      },
                      "discounts": {
                        "edges": [
                          {
                            "node": {
                              "id": "gid://shopify/SubscriptionManualDiscount/222222",
                              "targetType": "ALL_LINES",
                              "title": "BUILD_A_BOX_DISCOUNT_ABC123",
                              "value": {
                                "percentage": 15.0
                              }
                            }
                          }
                        ]
                      },
                      "id": "gid://shopify/SubscriptionContract/123456789",
                      "lines": {
                        "edges": [
                          {
                            "node": {
                              "currentPrice": {
                                "amount": "44.97",
                                "currencyCode": "USD"
                              },
                              "customAttributes": [
                                {
                                  "key": "_min_quantity",
                                  "value": "1"
                                },
                                {
                                  "key": "_max_quantity",
                                  "value": "5"
                                }
                              ],
                              "id": "gid://shopify/SubscriptionLine/111111",
                              "quantity": 3,
                              "title": "Premium Coffee - Dark Roast",
                              "variantId": "gid://shopify/ProductVariant/42549172011164"
                            }
                          }
                        ]
                      },
                      "nextBillingDate": "2024-04-01T12:00:00Z",
                      "status": "ACTIVE"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Product line item quantity updated successfully"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Build-a-Box Maximum Exceeded": {
                    "description": "Build-a-Box Maximum Exceeded",
                    "value": {
                      "code": "maxQuantityReached",
                      "detail": "Build-a-Box subscriptions have a maximum total quantity limit",
                      "status": 400,
                      "title": "UserGeneratedError:Maximum 12 quantity is required",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Build-a-Box Minimum Not Met": {
                    "description": "Build-a-Box Minimum Not Met",
                    "value": {
                      "code": "minQuantityNotReached",
                      "detail": "Build-a-Box subscriptions require a minimum total quantity",
                      "status": 400,
                      "title": "UserGeneratedError:Minimum 6 quantity is required",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Quantity Value": {
                    "description": "Invalid Quantity Value",
                    "value": {
                      "detail": "Quantity must be a positive integer",
                      "status": 400,
                      "title": "Invalid quantity",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Line Item Not Found": {
                    "description": "Line Item Not Found",
                    "value": {
                      "detail": "The specified line item does not exist in this subscription",
                      "status": 400,
                      "title": "No line item found for contract:123456789 and line id:gid://shopify/SubscriptionLine/999999",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Quantity Below Minimum": {
                    "description": "Quantity Below Minimum",
                    "value": {
                      "detail": "The product has a minimum quantity requirement",
                      "status": 400,
                      "title": "UserGeneratedError:Minimum quantity 2 is required for this product",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Quantity Exceeds Maximum": {
                    "description": "Quantity Exceeds Maximum",
                    "value": {
                      "detail": "The product has a maximum quantity limit",
                      "status": 400,
                      "title": "UserGeneratedError:Maximum quantity 5 is allowed for this product",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid request parameters or business rule violation"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid API key is required to access this endpoint",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required - missing or invalid API key"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to modify subscription contracts",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to update subscription"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Subscription contract with ID 123456789 not found",
                  "status": 404,
                  "title": "Resource not found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Subscription contract not found"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "Draft Commit Error": {
                    "description": "Draft Commit Error",
                    "value": {
                      "detail": "The subscription contract has changed. Please try again.",
                      "status": 422,
                      "title": "UserGeneratedError:Unable to commit subscription changes",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  },
                  "Shopify API Error": {
                    "description": "Shopify API Error",
                    "value": {
                      "detail": "Shopify API error: Cannot modify subscription during active billing attempt",
                      "status": 422,
                      "title": "UserGeneratedError:Unable to update line item quantity",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  }
                }
              }
            },
            "description": "Unable to process the quantity update due to Shopify API constraints"
          }
        },
        "summary": "Update product line item quantity in subscription",
        "tags": [
          "Subscription Products",
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-contracts-update-line-item-selling-plan": {
      "put": {
        "description": "Updates the selling plan associated with a specific product line item in a subscription contract. Selling plans define the delivery schedule, pricing rules, and billing policies for subscription products.\n\n**What are Selling Plans?**\nSelling plans are Shopify's way of defining subscription rules for products:\n- **Delivery Schedule**: How often the product is delivered (e.g., 'every 2 weeks', 'monthly')\n- **Pricing Policy**: Discounts and pricing tiers (e.g., '10% off', 'first order free')\n- **Billing Policy**: When and how often customer is charged\n- **Plan Name**: Customer-facing description like 'Deliver every month'\n\n**Key Features:**\n- Update by selling plan ID or name (name takes precedence if both provided)\n- Validates line item exists before attempting update\n- Only creates activity log if plan actually changes\n- Uses Shopify's draft system for safe updates\n- Preserves existing line item attributes and customizations\n\n**Common Use Cases:**\n- Change delivery frequency: Weekly \u2192 Monthly\n- Switch pricing tiers: Regular \u2192 VIP pricing\n- Update from old plan to new plan with better terms\n- Migrate products to new selling plan groups\n- Apply seasonal or promotional plans\n\n**Update Process:**\n1. Validates subscription contract and line item exist\n2. Creates a draft of the subscription contract\n3. Updates the line item's selling plan in the draft\n4. Commits the draft to apply changes\n5. Records activity log if plan changed\n\n**Impact of Selling Plan Changes:**\n- **Delivery Schedule**: Next and future orders follow new schedule\n- **Pricing**: New plan's pricing applies from next billing\n- **Discounts**: Plan-specific discounts are recalculated\n- **Billing**: Billing frequency may change with the plan\n\n**Finding Selling Plans:**\nTo find available selling plans:\n1. Check product's selling plan groups in Shopify admin\n2. Use Shopify's GraphQL API to query selling plans\n3. Plans must be active and associated with the product\n\n**Important Notes:**\n- Both sellingPlanId and sellingPlanName are optional, but at least one required\n- If both provided, both are updated (name doesn't override ID)\n- Plan must be valid for the product variant\n- Changes apply to future orders only\n- No customer notification sent (consider sending separately)\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "updateLineItemSellingPlan",
        "parameters": [
          {
            "description": "The unique identifier of the subscription contract",
            "example": 123456789,
            "in": "query",
            "name": "contractId",
            "required": true,
            "schema": {
              "format": "int64",
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "The unique identifier of the line item in the subscription contract. Must be in full GraphQL ID format",
            "example": "gid://shopify/SubscriptionLine/987654321",
            "in": "query",
            "name": "lineId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "The unique identifier of the new selling plan. Provide the numeric ID without gid:// prefix. Required if sellingPlanName is not provided. The plan must be:\n- Active in your Shopify store\n- Associated with the product variant\n- Part of an active selling plan group",
            "example": 56789,
            "in": "query",
            "name": "sellingPlanId",
            "required": false,
            "schema": {
              "format": "int64",
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "The customer-facing name of the new selling plan. Required if sellingPlanId is not provided. This is the name shown to customers like 'Deliver every 2 weeks' or 'Monthly subscription'. Must match exactly as configured in Shopify",
            "example": "Deliver every month",
            "in": "query",
            "name": "sellingPlanName",
            "required": false,
            "schema": {
              "maxLength": 255,
              "type": "string"
            }
          },
          {
            "description": "API Key for authentication",
            "example": "apst_your-api-key-here",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "customer": {
                        "email": "customer@example.com",
                        "id": "gid://shopify/Customer/987654321"
                      },
                      "deliveryPolicy": {
                        "interval": "MONTH",
                        "intervalCount": 1
                      },
                      "id": "gid://shopify/SubscriptionContract/123456789",
                      "lines": {
                        "edges": [
                          {
                            "node": {
                              "currentPrice": {
                                "amount": "27.99",
                                "currencyCode": "USD"
                              },
                              "id": "gid://shopify/SubscriptionLine/987654321",
                              "pricingPolicy": {
                                "basePrice": {
                                  "amount": "29.99",
                                  "currencyCode": "USD"
                                },
                                "cycleDiscounts": [
                                  {
                                    "adjustmentType": "PERCENTAGE",
                                    "adjustmentValue": {
                                      "percentage": 10.0
                                    },
                                    "afterCycle": 0
                                  }
                                ]
                              },
                              "quantity": 2,
                              "sellingPlanId": "gid://shopify/SellingPlan/56789",
                              "sellingPlanName": "Deliver every month",
                              "title": "Premium Coffee - Dark Roast",
                              "variantId": "gid://shopify/ProductVariant/42549172011164"
                            }
                          }
                        ]
                      },
                      "nextBillingDate": "2024-04-01T00:00:00Z",
                      "status": "ACTIVE"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Selling plan updated successfully"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Both Parameters Missing": {
                    "description": "Both Parameters Missing",
                    "value": {
                      "detail": "At least one of sellingPlanId or sellingPlanName must be provided",
                      "status": 400,
                      "title": "UserGeneratedError:Both Selling Plan Id and Selling Plan Name cannot be null",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Contract Not Found": {
                    "description": "Contract Not Found",
                    "value": {
                      "detail": "No subscription contract found with ID 123456789",
                      "status": 400,
                      "title": "Subscription contract not found",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Incompatible Selling Plan": {
                    "description": "Incompatible Selling Plan",
                    "value": {
                      "detail": "The selected selling plan cannot be applied to this product variant",
                      "status": 400,
                      "title": "UserGeneratedError:Selling plan is not compatible with variant",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Selling Plan": {
                    "description": "Invalid Selling Plan",
                    "value": {
                      "detail": "The specified selling plan does not exist or is not available for this product",
                      "status": 400,
                      "title": "UserGeneratedError:Selling plan not found",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Line Item Not Found": {
                    "description": "Line Item Not Found",
                    "value": {
                      "detail": "No line item found with ID gid://shopify/SubscriptionLine/987654321 in contract 123456789",
                      "status": 400,
                      "title": "Line item not found",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid contract ID, line ID, or selling plan details"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header is required",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to modify subscription contracts",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to modify the subscription"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Subscription contract with ID 123456789 not found in the system",
                  "status": 404,
                  "title": "Resource not found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Subscription contract or line item not found"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "Draft Commit Failed": {
                    "description": "Draft Commit Failed",
                    "value": {
                      "detail": "Cannot update subscription during active billing attempt",
                      "status": 422,
                      "title": "UserGeneratedError:Unable to commit changes",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  },
                  "Draft Creation Failed": {
                    "description": "Draft Creation Failed",
                    "value": {
                      "detail": "Shopify API error: Subscription is currently being modified",
                      "status": 422,
                      "title": "Unable to create subscription draft",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  }
                }
              }
            },
            "description": "Unable to update selling plan due to Shopify constraints"
          }
        },
        "summary": "Update selling plan for a subscription line item",
        "tags": [
          "Subscription Products",
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-contracts-update-max-cycles": {
      "put": {
        "description": "Updates the maximum number of billing cycles (orders) after which a subscription will automatically terminate. This creates a fixed-duration subscription that ends after a specific number of orders.\n\n**What are Maximum Cycles?**\nMaximum cycles define subscription duration limits where:\n- Subscription automatically cancels after the specified number of orders\n- No further orders are generated once maximum is reached\n- Useful for fixed-term offers, trials, or seasonal subscriptions\n- Customer is notified before final order (if configured)\n\n**Key Features:**\n- Cannot set below current cycle count (prevents immediate cancellation)\n- Setting to null creates an indefinite subscription\n- Automatically reschedules order queue based on new limit\n- Preserves all other subscription settings\n- Validates against current subscription progress\n\n**Current Cycle Calculation:**\n- Current cycle = Successful billing attempts + 1\n- Failed payments don't count toward maximum\n- First order is cycle 1, second is cycle 2, etc.\n- System prevents setting max below current position\n\n**Common Use Cases:**\n- **Trial Subscriptions**: '3-box trial' that auto-ends\n- **Seasonal Programs**: '6-month summer subscription'\n- **Limited Series**: '12-issue magazine subscription'\n- **Promotional Offers**: 'First 5 boxes at special price'\n- **Gift Subscriptions**: Fixed duration gifts that don't renew\n\n**What Happens at Maximum:**\nWhen a subscription reaches its maximum cycles:\n1. Final order is processed normally\n2. Subscription status changes to CANCELLED\n3. No future orders are scheduled\n4. Customer receives cancellation notification\n5. Cannot be reactivated (new subscription required)\n\n**Interaction with Min Cycles:**\n- Can have both min and max (e.g., 3 min, 12 max)\n- Min cycles enforces commitment period\n- Max cycles enforces termination\n- Common pattern: Commitment with defined end\n\n**Queue Management:**\nAfter updating max cycles:\n- System recalculates future order schedule\n- Removes orders beyond the new maximum\n- Adjusts upcoming order notifications\n- Updates subscription end date projections\n\n**Important Notes:**\n- Validation prevents accidental immediate cancellation\n- Changes apply to future billing cycles only\n- Activity log tracks old and new values\n- Consider customer communication for changes\n- Setting null removes any duration limit\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "updateMaxCyclesV2",
        "parameters": [
          {
            "description": "Contract ID",
            "in": "query",
            "name": "contractId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Maximum Cycles. The total number of orders after which the subscription will automatically terminate. Must be greater than or equal to the current cycle count and any configured minimum cycles. Common values:\n- 3: Three-order trial\n- 6: Six-month seasonal subscription\n- 12: Annual subscription\n- 24: Two-year commitment\n- null: Ongoing subscription with no end date",
            "example": 12,
            "in": "query",
            "name": "maxCycles",
            "required": true,
            "schema": {
              "maximum": 9999,
              "minimum": 1,
              "nullable": true,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "billingPolicy": {
                        "anchors": [
                          {
                            "day": 15,
                            "type": "MONTHDAY"
                          }
                        ],
                        "interval": "MONTH",
                        "intervalCount": 1,
                        "maxCycles": 12,
                        "minCycles": 3
                      },
                      "createdAt": "2024-01-01T00:00:00Z",
                      "customer": {
                        "displayName": "John Doe",
                        "email": "customer@example.com",
                        "id": "gid://shopify/Customer/987654321"
                      },
                      "deliveryPolicy": {
                        "interval": "MONTH",
                        "intervalCount": 1
                      },
                      "id": "gid://shopify/SubscriptionContract/123456789",
                      "lastBillingAttemptDate": "2024-03-01T00:00:00Z",
                      "lines": {
                        "edges": [
                          {
                            "node": {
                              "currentPrice": {
                                "amount": "39.99",
                                "currencyCode": "USD"
                              },
                              "id": "gid://shopify/SubscriptionLine/111111",
                              "quantity": 1,
                              "title": "12-Month Subscription Box",
                              "variantId": "gid://shopify/ProductVariant/42549172011164"
                            }
                          }
                        ]
                      },
                      "nextBillingDate": "2024-04-01T00:00:00Z",
                      "orders": {
                        "edges": [
                          {
                            "node": {
                              "createdAt": "2024-03-01T00:00:00Z",
                              "financialStatus": "PAID",
                              "fulfillmentStatus": "FULFILLED",
                              "id": "gid://shopify/Order/5678901234"
                            }
                          },
                          {
                            "node": {
                              "createdAt": "2024-02-01T00:00:00Z",
                              "financialStatus": "PAID",
                              "fulfillmentStatus": "FULFILLED",
                              "id": "gid://shopify/Order/5678901233"
                            }
                          },
                          {
                            "node": {
                              "createdAt": "2024-01-01T00:00:00Z",
                              "financialStatus": "PAID",
                              "fulfillmentStatus": "FULFILLED",
                              "id": "gid://shopify/Order/5678901232"
                            }
                          }
                        ]
                      },
                      "status": "ACTIVE"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Maximum cycles updated successfully"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Already Cancelled": {
                    "description": "Already Cancelled",
                    "value": {
                      "detail": "Cannot modify maximum cycles for cancelled subscriptions",
                      "status": 400,
                      "title": "UserGeneratedError:Cannot update cancelled subscription",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Contract Not Found": {
                    "description": "Contract Not Found",
                    "value": {
                      "detail": "No subscription contract found with ID 123456789",
                      "status": 400,
                      "title": "Subscription contract not found",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Max Cycles Value": {
                    "description": "Invalid Max Cycles Value",
                    "value": {
                      "detail": "Maximum cycles must be a positive integer",
                      "status": 400,
                      "title": "Invalid maximum cycles value",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Max Cycles Below Current Cycle": {
                    "description": "Max Cycles Below Current Cycle",
                    "value": {
                      "detail": "Cannot set maximum cycles to 3 when subscription has already completed 5 cycles",
                      "status": 400,
                      "title": "UserGeneratedError:Max cycles cannot be set to less than current cycle",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Max Less Than Min Cycles": {
                    "description": "Max Less Than Min Cycles",
                    "value": {
                      "detail": "Cannot set maximum cycles (6) to less than minimum cycles (12)",
                      "status": 400,
                      "title": "UserGeneratedError:Maximum cycles cannot be less than minimum cycles",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid request parameters or business rule violation"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header is required",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to modify subscription contracts",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to update maximum cycles"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Subscription contract with ID 123456789 not found in the system",
                  "status": 404,
                  "title": "Resource not found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Subscription contract not found"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "Queue Update Failed": {
                    "description": "Queue Update Failed",
                    "value": {
                      "detail": "Failed to reschedule upcoming orders based on new maximum cycles",
                      "status": 422,
                      "title": "Unable to update order queue",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  },
                  "Shopify API Error": {
                    "description": "Shopify API Error",
                    "value": {
                      "detail": "Shopify API error: Cannot modify subscription during active billing attempt",
                      "status": 422,
                      "title": "UserGeneratedError:Unable to update maximum cycles",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  }
                }
              }
            },
            "description": "Maximum cycles update failed due to Shopify constraints"
          }
        },
        "summary": "Update maximum cycles for a subscription contract",
        "tags": [
          "Subscription Management",
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-contracts-update-min-cycles": {
      "put": {
        "description": "Updates the minimum number of billing cycles (orders) that a customer must complete before they can cancel their subscription. This creates a commitment period that helps with customer retention and business predictability.\n\n**What are Minimum Cycles?**\nMinimum cycles represent a commitment period where:\n- Customers must complete a specified number of orders\n- Cancellation is blocked until the minimum is met\n- Often tied to special pricing or promotional offers\n- Counted from the subscription start date\n\n**Key Features:**\n- Updates commitment period for existing subscriptions\n- Can increase or decrease minimum cycles\n- Setting to null removes the minimum commitment\n- Preserves all other subscription settings\n- Automatically handles invalid discount codes\n- Updates future billing queue after change\n\n**Common Use Cases:**\n- **Promotional Offers**: '3-month minimum for 50% off'\n- **Hardware Subsidies**: '12-month commitment with free device'\n- **Loyalty Programs**: Reduce minimum after customer proves loyalty\n- **Seasonal Campaigns**: Temporary commitment requirements\n- **Contract Adjustments**: Customer service exceptions\n\n**Impact on Customers:**\n- Cannot cancel via portal until minimum cycles complete\n- Pause/resume typically still allowed (check settings)\n- Shows commitment status in customer portal\n- No automatic notification sent (consider sending separately)\n\n**Cycle Counting:**\n- Only successful billing attempts count toward minimum\n- Failed payments don't increment the cycle count\n- Skipped orders (if allowed) don't count\n- Current cycle = successful past orders + 1\n\n**Interaction with Max Cycles:**\n- Min cycles must be less than or equal to max cycles\n- If max cycles exist, subscription auto-cancels after maximum\n- Common pattern: 3 min cycles, 12 max cycles\n\n**Best Practices:**\n- Clearly communicate commitment terms upfront\n- Consider grandfathering existing customers\n- Use reasonable minimums (typically 3-12 cycles)\n- Document reason for changes in activity logs\n- Send customer notification for transparency\n\n**Important Notes:**\n- Changes apply immediately to cancellation logic\n- Doesn't affect past or in-progress orders\n- Customer portal respects this setting automatically\n- Activity log tracks old and new values\n- Consider legal requirements in your jurisdiction\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "updateMinCyclesV2",
        "parameters": [
          {
            "description": "Contract ID",
            "in": "query",
            "name": "contractId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Minimum Number of Orders. The minimum number of billing cycles a customer must complete before being allowed to cancel. Set to null to remove the minimum commitment. Common values:\n- 3: Three-month commitment\n- 6: Six-month commitment\n- 12: Annual commitment\n- null: No commitment",
            "example": 6,
            "in": "query",
            "name": "minCycles",
            "required": false,
            "schema": {
              "maximum": 9999,
              "minimum": 1,
              "nullable": true,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "billingPolicy": {
                        "anchors": [
                          {
                            "day": 1,
                            "type": "MONTHDAY"
                          }
                        ],
                        "interval": "MONTH",
                        "intervalCount": 1,
                        "maxCycles": null,
                        "minCycles": 6
                      },
                      "createdAt": "2024-01-01T00:00:00Z",
                      "customer": {
                        "displayName": "John Doe",
                        "email": "customer@example.com",
                        "id": "gid://shopify/Customer/987654321"
                      },
                      "customerPaymentMethod": {
                        "id": "gid://shopify/CustomerPaymentMethod/123456",
                        "instrument": {
                          "__typename": "CustomerCreditCard",
                          "brand": "VISA",
                          "expiryMonth": 12,
                          "expiryYear": 2025,
                          "lastDigits": "4242"
                        }
                      },
                      "deliveryPolicy": {
                        "interval": "MONTH",
                        "intervalCount": 1
                      },
                      "id": "gid://shopify/SubscriptionContract/123456789",
                      "lines": {
                        "edges": [
                          {
                            "node": {
                              "currentPrice": {
                                "amount": "49.99",
                                "currencyCode": "USD"
                              },
                              "id": "gid://shopify/SubscriptionLine/111111",
                              "quantity": 1,
                              "title": "Premium Subscription Box",
                              "variantId": "gid://shopify/ProductVariant/42549172011164"
                            }
                          }
                        ]
                      },
                      "nextBillingDate": "2024-04-01T00:00:00Z",
                      "status": "ACTIVE"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Minimum cycles updated successfully"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Contract Already Cancelled": {
                    "description": "Contract Already Cancelled",
                    "value": {
                      "detail": "Cannot modify minimum cycles for cancelled subscriptions",
                      "status": 400,
                      "title": "UserGeneratedError:Cannot update cancelled subscription",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Contract Not Found": {
                    "description": "Contract Not Found",
                    "value": {
                      "detail": "No subscription contract found with ID 123456789",
                      "status": 400,
                      "title": "Subscription contract not found",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Contract ID": {
                    "description": "Invalid Contract ID",
                    "value": {
                      "detail": "Contract ID must be a positive number",
                      "status": 400,
                      "title": "Invalid contract ID",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Min Cycles Value": {
                    "description": "Invalid Min Cycles Value",
                    "value": {
                      "detail": "Minimum cycles must be a positive integer or null",
                      "status": 400,
                      "title": "Invalid minimum cycles value",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Min Exceeds Max Cycles": {
                    "description": "Min Exceeds Max Cycles",
                    "value": {
                      "detail": "Minimum cycles (12) cannot be greater than maximum cycles (6)",
                      "status": 400,
                      "title": "UserGeneratedError:Minimum cycles cannot exceed maximum cycles",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid request parameters or business rule violation"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header is required",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to modify subscription contracts",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to update minimum cycles"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Subscription contract with ID 123456789 not found in the system",
                  "status": 404,
                  "title": "Resource not found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Subscription contract not found"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "Invalid Discount Code": {
                    "description": "Invalid Discount Code",
                    "value": {
                      "detail": "Invalid discount code detected. System will automatically remove and retry.",
                      "status": 422,
                      "title": "Contract draft discount with title COMMIT3 is invalid",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  },
                  "Shopify API Error": {
                    "description": "Shopify API Error",
                    "value": {
                      "detail": "Shopify API error: Cannot modify subscription during active billing attempt",
                      "status": 422,
                      "title": "UserGeneratedError:Unable to update minimum cycles",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  }
                }
              }
            },
            "description": "Minimum cycles update failed due to Shopify constraints"
          }
        },
        "summary": "Update minimum cycles for a subscription contract",
        "tags": [
          "Subscription Management",
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-contracts-update-multiple-line-item-attributes": {
      "put": {
        "description": "Updates custom attributes for multiple line items within a subscription contract. The request body must be a JSON object where each key is a line item identifier (as a String) and each value is a list of AttributeInfo objects containing attribute key/value pairs. For example: { \"gid://shopify/SubscriptionLineItem/987654321\": [ { \"key\": \"color\", \"value\": \"red\" }, { \"key\": \"size\", \"value\": \"M\" } ] }. The service validates that the contract exists and that each specified line item is eligible for update. Authentication is performed via the X-API-Key header (the 'api_key' parameter is deprecated).",
        "operationId": "updateMultipleLineItemAttributesV2",
        "parameters": [
          {
            "description": "The unique identifier of the subscription contract",
            "example": 123456789,
            "in": "query",
            "name": "contractId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "deprecated": true,
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key for authentication",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": {
                  "items": {
                    "$ref": "#/components/schemas/AttributeInfo"
                  },
                  "type": "array"
                },
                "type": "object"
              }
            }
          },
          "description": "A JSON object where each key is a line item ID (e.g., \"gid://shopify/SubscriptionLineItem/987654321\") and each value is a list of AttributeInfo objects containing the attribute key and value. Example: { \"gid://shopify/SubscriptionLineItem/987654321\": [ { \"key\": \"color\", \"value\": \"red\" }, { \"key\": \"size\", \"value\": \"M\" } ] }",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Multiple line item attributes updated successfully"
          },
          "400": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Invalid contract ID, line item IDs, or attribute values"
          },
          "401": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Insufficient permissions to update the subscription"
          },
          "404": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Subscription contract or one of the specified line items not found"
          },
          "422": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Unable to update one or more line item attributes due to subscription constraints"
          }
        },
        "summary": "Update multiple line item attributes for a subscription contract",
        "tags": [
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-contracts-update-order-note/{contractId}": {
      "put": {
        "description": "Updates the order note that will be added to all future orders generated by this subscription. Order notes help merchants track special instructions, customer preferences, or internal information about the subscription.\n\n**Key Features:**\n- Note is automatically added to all future recurring orders\n- Visible in both merchant portal and customer portal\n- Appears in Shopify order details for easy reference\n- Changes apply to future orders only (existing orders unchanged)\n**Common Use Cases:**\n- Customer preferences: \"No nuts - severe allergy\"\n- Delivery instructions: \"Leave package at side door\"\n- Gift messages: \"Happy Birthday from Mom!\"\n- Internal notes: \"VIP customer - priority handling\"\n- Processing instructions: \"Include sample with each order\"\n\n**Important Notes:**\n- Empty string clears the existing note\n- No character limit imposed by API (check Shopify limits)\n- HTML is not rendered - stored as plain text\n- Updates are logged in activity history\n- Note persists until explicitly changed\n\n**Order Generation:**\nWhen Appstle creates recurring orders:\n1. Retrieves current order note from subscription\n2. Adds note to new Shopify order\n3. Note appears in order details immediately\n4. Merchants can still edit individual order notes\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "updateOrderNoteV2",
        "parameters": [
          {
            "description": "Subscription contract ID to update",
            "example": 123456789,
            "in": "path",
            "name": "contractId",
            "required": true,
            "schema": {
              "format": "int64",
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "deprecated": true,
            "description": "API Key (Deprecated - Use X-API-Key header instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key for authentication",
            "example": "apst_your-api-key-here",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Note text to be added to all future orders. Can include special instructions, preferences, or internal notes. Pass empty string to clear existing note. HTML tags are not rendered - stored as plain text.",
            "examples": {
              "Allergy Note": {
                "description": "Allergy Note",
                "value": "No peanuts - severe allergy"
              },
              "Clear Note": {
                "description": "Clear Note"
              },
              "Delivery Instruction": {
                "description": "Delivery Instruction",
                "value": "Ring doorbell twice, leave at back door"
              },
              "Gift Message": {
                "description": "Gift Message",
                "value": "Happy Anniversary! Love, Sarah"
              },
              "Internal Note": {
                "description": "Internal Note",
                "value": "VIP Customer - Include free sample"
              }
            },
            "in": "query",
            "name": "orderNote",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": true,
                "schema": {
                  "type": "boolean"
                }
              }
            },
            "description": "Order note successfully updated",
            "headers": {
              "X-Application-Context": {
                "description": "Application context with success message",
                "schema": {
                  "example": "appname:Subscription Updated:",
                  "type": "string"
                },
                "style": "simple"
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Contract Not Found": {
                    "description": "Contract Not Found",
                    "value": {
                      "detail": "No subscription contract found with ID: 123456789",
                      "instance": "/api/external/v2/subscription-contracts-update-order-note/123456789",
                      "status": 400,
                      "title": "Contract not found",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Contract ID": {
                    "description": "Invalid Contract ID",
                    "value": {
                      "detail": "Contract does not belong to this shop",
                      "instance": "/api/external/v2/subscription-contracts-update-order-note/123456789",
                      "status": 400,
                      "title": "invalid id",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Missing Order Note": {
                    "description": "Missing Order Note",
                    "value": {
                      "detail": "Required request parameter 'orderNote' is not present",
                      "instance": "/api/external/v2/subscription-contracts-update-order-note/123456789",
                      "status": 400,
                      "title": "Missing required parameter",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid request or contract not found"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header is required",
                  "instance": "/api/external/v2/subscription-contracts-update-order-note/123456789",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to modify subscription contracts",
                  "instance": "/api/external/v2/subscription-contracts-update-order-note/123456789",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Subscription contract with ID 123456789 not found",
                  "instance": "/api/external/v2/subscription-contracts-update-order-note/123456789",
                  "status": 404,
                  "title": "Resource not found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Subscription contract not found"
          }
        },
        "summary": "Update order note for subscription",
        "tags": [
          "Subscription Management",
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-contracts-update-payment-method": {
      "put": {
        "description": "Triggers Shopify to send an email to the subscription customer with a secure link to update their payment method. This endpoint initiates Shopify's native payment update flow without requiring direct payment handling.\n\n**Key Features:**\n- Sends official Shopify payment update email to customer\n- Customer receives secure link to Shopify-hosted payment update page\n- No PCI compliance required - Shopify handles all payment data\n- Supports all Shopify-supported payment methods\n- Automatically updates subscription after customer completes the process\n\n**Process Flow:**\n1. API call triggers email send request to Shopify\n2. Shopify sends branded email to customer's registered email\n3. Customer clicks secure link in email\n4. Customer authenticates on Shopify-hosted page\n5. Customer adds/updates payment method\n6. Subscription automatically uses new payment method\n\n**Email Details:**\n- Sent from Shopify's email servers\n- Uses store's configured sender email\n- Subject line typically: \"Update your payment method\"\n- Contains secure, time-limited link\n- Shopify-branded with store information\n\n**Use Cases:**\n- Failed payment recovery\n- Expiring credit card updates\n- Customer-requested payment changes\n- Proactive payment method maintenance\n\n**Important Notes:**\n- Customer must have valid email address\n- Email cannot be customized (Shopify template)\n- Link expiration time set by Shopify\n- Multiple emails can be sent if needed\n- No webhook for completion - poll contract for updates\n\n**Rate Limiting:**\n- Subject to Shopify's email sending limits\n- Recommended: Wait 24 hours between sends to same customer\n- Excessive sends may be blocked by Shopify\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "updatePaymentMethodV2",
        "parameters": [
          {
            "description": "Subscription contract ID for payment method update. Must be a valid contract ID that belongs to the authenticated shop.",
            "example": 123456789,
            "in": "query",
            "name": "contractId",
            "required": true,
            "schema": {
              "format": "int64",
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "deprecated": true,
            "description": "API Key (Deprecated - Use X-API-Key header instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key for authentication",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "message": "Payment method update email sent successfully"
                }
              }
            },
            "description": "Payment update email sent successfully"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Cancelled Subscription": {
                    "description": "Cancelled Subscription",
                    "value": {
                      "detail": "Payment method cannot be updated for cancelled subscriptions",
                      "instance": "/api/external/v2/subscription-contracts-update-payment-method",
                      "status": 400,
                      "title": "UserGeneratedError:Cannot update cancelled subscription",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Contract Not Found": {
                    "description": "Contract Not Found",
                    "value": {
                      "detail": "No subscription contract found with ID: 123456789",
                      "instance": "/api/external/v2/subscription-contracts-update-payment-method",
                      "status": 400,
                      "title": "Contract not found",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Customer Not Found": {
                    "description": "Customer Not Found",
                    "value": {
                      "detail": "Customer associated with payment method not found",
                      "instance": "/api/external/v2/subscription-contracts-update-payment-method",
                      "status": 400,
                      "title": "UserGeneratedError:Customer not found",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Email Service Error": {
                    "description": "Email Service Error",
                    "value": {
                      "detail": "Shopify email service temporarily unavailable",
                      "instance": "/api/external/v2/subscription-contracts-update-payment-method",
                      "status": 400,
                      "title": "UserGeneratedError:Email could not be sent",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Email Address": {
                    "description": "Invalid Email Address",
                    "value": {
                      "detail": "Cannot send email to invalid email address",
                      "instance": "/api/external/v2/subscription-contracts-update-payment-method",
                      "status": 400,
                      "title": "UserGeneratedError:Customer email is invalid",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "No Payment Method": {
                    "description": "No Payment Method",
                    "value": {
                      "detail": "Subscription has no associated payment method",
                      "instance": "/api/external/v2/subscription-contracts-update-payment-method",
                      "status": 400,
                      "title": "Payment method not found",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid request or email send failed"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header is required",
                  "instance": "/api/external/v2/subscription-contracts-update-payment-method",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to update payment methods",
                  "instance": "/api/external/v2/subscription-contracts-update-payment-method",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions"
          },
          "404": {
            "description": "Subscription contract not found"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "Rate Limit Exceeded": {
                    "description": "Rate Limit Exceeded",
                    "value": {
                      "detail": "Payment update email was recently sent. Please wait before sending another.",
                      "instance": "/api/external/v2/subscription-contracts-update-payment-method",
                      "status": 422,
                      "title": "UserGeneratedError:Too many emails sent",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  },
                  "Shopify API Error": {
                    "description": "Shopify API Error",
                    "value": {
                      "detail": "Unable to send payment update email at this time",
                      "instance": "/api/external/v2/subscription-contracts-update-payment-method",
                      "status": 422,
                      "title": "Shopify API error",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  }
                }
              }
            },
            "description": "Email cannot be sent due to business rules"
          }
        },
        "summary": "Send payment method update email to customer",
        "tags": [
          "Subscription Payments",
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-contracts-update-shipping-address": {
      "put": {
        "description": "Updates the shipping address or delivery method for a subscription contract. Supports standard shipping, local delivery, and pickup options with comprehensive address validation.\n\n**Delivery Method Types:**\n- **SHIPPING**: Standard shipping to customer address (default)\n- **LOCAL**: Local delivery within specified zip codes\n- **PICK_UP**: Customer pickup at designated location\n\n**Key Features:**\n- Zip code restrictions for customer portal access\n- Optional ShipperHQ address validation\n- Automatic phone number handling for local delivery\n- Email notifications to customers\n- Shipping price recalculation\n- Activity log tracking with old/new addresses\n\n**Zip Code Validation (Customer Portal Only):**\nWhen called from customer portal:\n- Standard shipping: Validates against 'allowToSpecificZipCode' setting\n- Local delivery: Validates against 'allowToSpecificZipCodeForLocalDelivery' setting\n- External API calls bypass zip code restrictions\n\n**Address Validation:**\n- If ShipperHQ is configured, addresses are validated for deliverability\n- Invalid addresses will return appropriate error messages\n- Helps prevent failed deliveries and shipping issues\n\n**Special Handling:**\n- Local delivery addresses missing phone numbers are auto-populated\n- Uses customer's phone if available, otherwise defaults to placeholder\n- Handles missing address components gracefully\n\n**Post-Update Actions:**\n- Sends 'SHIPPING_ADDRESS_UPDATED' email to customer\n- Creates activity log with address change details\n- Triggers asynchronous shipping price recalculation\n- May remove invalid discount codes automatically\n\n**Important Notes:**\n- Province codes should use ISO 3166-2 format (e.g., 'NY' for New York)\n- Country codes should use ISO 3166-1 alpha-2 format (e.g., 'US')\n- Phone numbers should include country code for international addresses\n- Pickup locations must be pre-configured in Shopify\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "updateShippingAddressV2",
        "parameters": [
          {
            "description": "Subscription contract ID to update. Provide the numeric ID without the gid:// prefix",
            "example": 123456789,
            "in": "query",
            "name": "contractId",
            "required": true,
            "schema": {
              "format": "int64",
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "deprecated": true,
            "description": "API Key (Deprecated - Use X-API-Key header instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key for authentication",
            "example": "apst_your-api-key-here",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "examples": {
                "International Address": {
                  "description": "International Address",
                  "value": {
                    "address1": "123 Rue de la Paix",
                    "city": "Paris",
                    "countryCode": "FR",
                    "firstName": "Pierre",
                    "lastName": "Dubois",
                    "methodType": "SHIPPING",
                    "phone": "+33123456789",
                    "provinceCode": "75",
                    "zip": "75001"
                  }
                },
                "Local Delivery Address": {
                  "description": "Local Delivery Address",
                  "value": {
                    "address1": "789 Local Ave",
                    "city": "Brooklyn",
                    "countryCode": "US",
                    "firstName": "Jane",
                    "lastName": "Smith",
                    "methodType": "LOCAL",
                    "phone": "+17185551234",
                    "provinceCode": "NY",
                    "zip": "11201"
                  }
                },
                "Pickup Location": {
                  "description": "Pickup Location",
                  "value": {
                    "methodType": "PICK_UP",
                    "pickupLocationId": "gid://shopify/DeliveryLocationGroup/123456"
                  }
                },
                "Standard Shipping Address": {
                  "description": "Standard Shipping Address",
                  "value": {
                    "address1": "456 New Street",
                    "address2": "Suite 200",
                    "city": "Los Angeles",
                    "company": "Acme Corp",
                    "countryCode": "US",
                    "firstName": "John",
                    "lastName": "Doe",
                    "methodType": "SHIPPING",
                    "phone": "+12135551234",
                    "provinceCode": "CA",
                    "zip": "90001"
                  }
                }
              },
              "schema": {
                "$ref": "#/components/schemas/ChangeShippingAddressVM"
              }
            }
          },
          "description": "New shipping address and delivery method details",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "customer": {
                        "email": "customer@example.com",
                        "id": "gid://shopify/Customer/987654321"
                      },
                      "deliveryMethod": {
                        "__typename": "SubscriptionDeliveryMethodShipping",
                        "address": {
                          "address1": "456 New Street",
                          "address2": "Suite 200",
                          "city": "Los Angeles",
                          "company": "Acme Corp",
                          "countryCode": "US",
                          "firstName": "John",
                          "lastName": "Doe",
                          "phone": "+12135551234",
                          "provinceCode": "CA",
                          "zip": "90001"
                        }
                      },
                      "deliveryPrice": {
                        "amount": "7.99",
                        "currencyCode": "USD"
                      },
                      "id": "gid://shopify/SubscriptionContract/123456789",
                      "nextBillingDate": "2024-03-01T00:00:00Z",
                      "status": "ACTIVE"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Shipping address successfully updated"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Invalid Address (ShipperHQ)": {
                    "description": "Invalid Address (ShipperHQ)",
                    "value": {
                      "detail": "The provided address could not be validated. Please check the address details.",
                      "status": 400,
                      "title": "Address validation failed",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Method Type": {
                    "description": "Invalid Method Type",
                    "value": {
                      "detail": "Method type must be one of: SHIPPING, LOCAL, PICK_UP",
                      "status": 400,
                      "title": "Invalid delivery method",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Missing Required Fields": {
                    "description": "Missing Required Fields",
                    "value": {
                      "detail": "Required fields missing: address1, city, countryCode",
                      "status": 400,
                      "title": "Validation error",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Shop Settings Not Found": {
                    "description": "Shop Settings Not Found",
                    "value": {
                      "detail": "Store configuration is missing or incomplete",
                      "status": 400,
                      "title": "Shop settings not found for shop: example-store",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Zip Code Not Allowed": {
                    "description": "Zip Code Not Allowed",
                    "value": {
                      "detail": "Delivery to zip code 12345 is not available for this subscription",
                      "status": 400,
                      "title": "UserGeneratedError: That zip code is not allowed",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid request parameters or business rule violation"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid API key is required to access this endpoint",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required - missing or invalid API key"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to modify subscription contracts",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to modify subscription"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Subscription contract with ID 123456789 not found",
                  "status": 404,
                  "title": "Resource not found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Subscription contract not found"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "Invalid Pickup Location": {
                    "description": "Invalid Pickup Location",
                    "value": {
                      "detail": "The specified pickup location is not available",
                      "status": 422,
                      "title": "UserGeneratedError:Pickup location not configured",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  },
                  "Shopify API Error": {
                    "description": "Shopify API Error",
                    "value": {
                      "detail": "Shopify API error: Invalid province code for selected country",
                      "status": 422,
                      "title": "UserGeneratedError:Unable to update delivery address",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  }
                }
              }
            },
            "description": "Unable to process the address update due to Shopify API constraints"
          }
        },
        "summary": "Update subscription delivery address and method",
        "tags": [
          "Subscription Management",
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-contracts-update-status": {
      "put": {
        "description": "Updates the status of a subscription contract to ACTIVE, PAUSED, or CANCELLED. This endpoint manages the lifecycle of subscriptions with automatic state tracking and notifications.\n\n**Status Transitions:**\n- **ACTIVE**: Resumes a paused subscription, enabling future billing and deliveries\n- **PAUSED**: Temporarily suspends all billing and deliveries until manually resumed\n- **CANCELLED**: Permanently terminates the subscription (irreversible)\n\n**Key Features:**\n- Validates status transitions (prevents same-status updates)\n- Tracks status change timestamps for audit trails\n- Sends automated email notifications to customers\n- Creates detailed activity logs for each status change\n- Handles concurrent modifications with automatic retry\n- Adjusts next billing date when resuming subscriptions\n\n**Permission Requirements (Customer Portal):**\nWhen called from customer portal context:\n- PAUSED status requires 'pauseResumeSub' permission\n- ACTIVE status (resuming) requires 'resumeSub' permission  \n- CANCELLED status requires 'cancelSub' permission\n- External API calls bypass these permission checks\n\n**Status Change Side Effects:**\n- **Activating**: Recalculates next billing date, marks activation timestamp\n- **Pausing**: Stops all scheduled orders, marks pause timestamp\n- **Cancelling**: Terminates subscription permanently, marks cancellation timestamp\n\n**Error Recovery:**\nThe system automatically handles:\n- Invalid discount codes by removing them and retrying\n- Concurrent modifications by retrying the operation\n- This ensures reliable status updates in production environments\n\n**Important Notes:**\n- Status values are case-insensitive\n- Cancelled subscriptions cannot be reactivated\n- Paused subscriptions retain all settings and can be resumed\n- Email notifications are sent automatically unless internally suppressed\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "updateStatusV2",
        "parameters": [
          {
            "description": "Subscription contract ID to update. Provide the numeric ID without the gid:// prefix",
            "example": 123456789,
            "in": "query",
            "name": "contractId",
            "required": true,
            "schema": {
              "format": "int64",
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "New status for the subscription contract. Case-insensitive.",
            "examples": {
              "Cancel subscription": {
                "description": "Cancel subscription",
                "value": "CANCELLED"
              },
              "Pause subscription": {
                "description": "Pause subscription",
                "value": "PAUSED"
              },
              "Resume subscription": {
                "description": "Resume subscription",
                "value": "ACTIVE"
              }
            },
            "in": "query",
            "name": "status",
            "required": true,
            "schema": {
              "enum": [
                "ACTIVE",
                "PAUSED",
                "CANCELLED",
                "active",
                "paused",
                "cancelled"
              ],
              "type": "string"
            }
          },
          {
            "deprecated": true,
            "description": "API Key (Deprecated - Use X-API-Key header instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key for authentication",
            "example": "apst_your-api-key-here",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Status successfully updated - No content returned",
            "headers": {
              "X-Alert": {
                "description": "Success message",
                "schema": {
                  "example": "Subscription Updated",
                  "type": "string"
                },
                "style": "simple"
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Contract Not Found": {
                    "description": "Contract Not Found",
                    "value": {
                      "detail": "Subscription contract with ID 123456789 not found",
                      "status": 400,
                      "title": "No contract found for status update",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Contract ID": {
                    "description": "Invalid Contract ID",
                    "value": {
                      "detail": "Contract ID must be a positive number",
                      "status": 400,
                      "title": "Invalid contract ID",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Status Value": {
                    "description": "Invalid Status Value",
                    "value": {
                      "detail": "Status must be one of: ACTIVE, PAUSED, CANCELLED",
                      "status": 400,
                      "title": "UserGeneratedError:Invalid subscription status",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Reactivate Cancelled Subscription": {
                    "description": "Reactivate Cancelled Subscription",
                    "value": {
                      "detail": "Cancelled subscriptions cannot be reactivated. Please create a new subscription.",
                      "status": 400,
                      "title": "UserGeneratedError:Cannot reactivate cancelled subscription",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Same Status Update": {
                    "description": "Same Status Update",
                    "value": {
                      "detail": "Subscription is already ACTIVE. No update needed.",
                      "status": 400,
                      "title": "Contract already in same status",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid request parameters or business rule violation"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid API key is required to access this endpoint",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required - missing or invalid API key"
          },
          "403": {
            "content": {
              "application/json": {
                "examples": {
                  "API Key Permissions": {
                    "description": "API Key Permissions",
                    "value": {
                      "detail": "API key does not have permission to modify subscription contracts",
                      "status": 403,
                      "title": "Insufficient permissions",
                      "type": "https://example.com/errors/forbidden"
                    }
                  },
                  "Customer Portal - Pause Permission": {
                    "description": "Customer Portal - Pause Permission",
                    "value": {
                      "detail": "Customer does not have permission to pause subscriptions",
                      "status": 403,
                      "title": "Customer permission denied",
                      "type": "https://example.com/errors/forbidden"
                    }
                  }
                }
              }
            },
            "description": "Insufficient permissions to modify subscription status"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Subscription contract with ID 123456789 not found in the system",
                  "status": 404,
                  "title": "Resource not found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Subscription contract not found"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "Invalid Discount Code": {
                    "description": "Invalid Discount Code",
                    "value": {
                      "detail": "Invalid discount code detected. System will automatically remove and retry.",
                      "status": 422,
                      "title": "Contract draft discount with title SUMMER20 is invalid",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  },
                  "Shopify API Error": {
                    "description": "Shopify API Error",
                    "value": {
                      "detail": "Shopify API error: Cannot modify subscription during active billing attempt",
                      "status": 422,
                      "title": "UserGeneratedError:Unable to update subscription status",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  }
                }
              }
            },
            "description": "Unable to process the status update due to Shopify API constraints"
          }
        },
        "summary": "Update subscription contract status",
        "tags": [
          "Subscription Management",
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-contracts/contract-external/{contractId}": {
      "get": {
        "description": "Retrieves the complete, unprocessed subscription contract data directly from Shopify's GraphQL API. This endpoint returns the full Shopify subscription contract object exactly as Shopify provides it, including all nested fields, relationships, and GraphQL metadata.\n\n**What This Endpoint Returns:**\nUnlike processed/transformed endpoints, this returns Shopify's raw SubscriptionContract GraphQL object with all available fields. This is the same data structure you would receive if querying Shopify's GraphQL API directly, making it ideal for:\n- Debugging Shopify data synchronization issues\n- Accessing fields not exposed in other endpoints\n- Understanding complete Shopify contract structure\n- Building custom integrations requiring full data\n- Comparing Shopify source data with processed data\n\n**Data Included:**\n\n**Contract Core:**\n- Full subscription contract object from Shopify\n- All GraphQL __typename fields preserved\n- Complete nested object structures\n- All available Shopify contract fields\n\n**Customer Information:**\n- Complete customer object with all fields\n- Default address details\n- Customer tags and metadata\n- Marketing preferences\n\n**Line Items:**\n- Full line item details with edges/nodes structure\n- Product and variant complete objects\n- Pricing policies with all cycle discounts\n- Line item custom attributes\n- Current and original prices\n\n**Billing & Delivery:**\n- Complete billing policy object\n- Full delivery policy details\n- Delivery method with all fields\n- Delivery price breakdown\n- Billing anchor details\n\n**Payment Information:**\n- Payment method details (if available)\n- Customer payment instrument\n- Payment gateway information\n\n**Orders & History:**\n- Origin order details\n- Last payment status\n- Historical billing attempts (in Appstle)\n\n**Use Cases:**\n\n**1. Debugging & Troubleshooting:**\n- Investigate data sync discrepancies\n- Verify what Shopify actually stores\n- Debug webhook payload issues\n- Compare expected vs actual data\n\n**2. Advanced Integrations:**\n- Access Shopify-specific fields not in standard APIs\n- Build custom analytics using raw data\n- Integrate with Shopify GraphQL directly\n- Extract fields for custom processing\n\n**3. Data Analysis:**\n- Analyze complete contract structure\n- Extract all available metadata\n- Build comprehensive data exports\n- Perform deep data audits\n\n**4. Development & Testing:**\n- Understand Shopify's data model\n- Test new feature development\n- Verify API responses\n- Documentation and examples\n\n**Response Structure:**\n\nReturns SubscriptionContractQuery.SubscriptionContract object:\n```json\n{\n  \"id\": \"gid://shopify/SubscriptionContract/123456789\",\n  \"status\": \"ACTIVE\",\n  \"nextBillingDate\": \"2024-03-15T00:00:00Z\",\n  \"customer\": {\n    \"id\": \"gid://shopify/Customer/987654321\",\n    \"email\": \"customer@example.com\",\n    \"displayName\": \"John Doe\",\n    \"__typename\": \"Customer\"\n  },\n  \"lines\": {\n    \"edges\": [\n      {\n        \"node\": {\n          \"id\": \"gid://shopify/SubscriptionLine/111111\",\n          \"quantity\": 2,\n          \"variantId\": \"gid://shopify/ProductVariant/222222\",\n          \"title\": \"Monthly Coffee Box\",\n          \"variantTitle\": \"Medium Roast\",\n          \"currentPrice\": {\n            \"amount\": \"29.99\",\n            \"currencyCode\": \"USD\"\n          },\n          \"pricingPolicy\": {...},\n          \"__typename\": \"SubscriptionLine\"\n        }\n      }\n    ]\n  },\n  \"billingPolicy\": {\n    \"interval\": \"MONTH\",\n    \"intervalCount\": 1,\n    \"minCycles\": 3,\n    \"maxCycles\": 12\n  },\n  \"deliveryPolicy\": {...},\n  \"deliveryMethod\": {...},\n  \"__typename\": \"SubscriptionContract\"\n}\n```\n\n**Important Considerations:**\n\n**Data Source:**\n- Queries Shopify GraphQL API in real-time\n- NOT cached in Appstle database\n- Always returns current Shopify state\n- Subject to Shopify API rate limits\n\n**Performance:**\n- Slower than database queries (500-1500ms typical)\n- Makes real-time call to Shopify\n- Response size can be large (10-50 KB)\n- Use sparingly to avoid rate limits\n\n**GraphQL Structure:**\n- Includes __typename fields throughout\n- Uses GraphQL ID format (gid://shopify/...)\n- Nested edges/nodes structure for lists\n- All fields as defined in Shopify's schema\n\n**Best Practices:**\n\n1. **Use for Debugging**: Perfect for troubleshooting data issues\n2. **Avoid Polling**: Don't call repeatedly - use cached/processed endpoints instead\n3. **Cache Response**: Cache the response if using for display\n4. **Parse Carefully**: Handle GraphQL structure (edges/nodes)\n5. **Monitor Rate Limits**: Each call counts against Shopify API limits\n\n**When to Use vs Other Endpoints:**\n\n**Use this endpoint when:**\n- Need complete Shopify contract data\n- Debugging synchronization issues\n- Accessing Shopify-specific fields\n- Building Shopify GraphQL integrations\n\n**Use /api/external/v2/subscription-contract-details when:**\n- Need processed, filtered contract data\n- Want faster response times\n- Querying multiple contracts\n- Building customer-facing UIs\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "getSubscriptionContractRawExternalV2",
        "parameters": [
          {
            "description": "Contract ID",
            "in": "path",
            "name": "contractId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionContract"
                }
              }
            },
            "description": "Successfully retrieved raw Shopify contract data"
          },
          "400": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Contract ID must be a valid positive integer",
                  "status": 400,
                  "title": "Invalid contract ID",
                  "type": "https://example.com/errors/bad-request"
                }
              }
            },
            "description": "Bad request - Invalid contract ID"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header is required",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Subscription contract does not belong to your shop",
                  "status": 403,
                  "title": "Access denied",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Forbidden - Contract does not belong to authenticated shop"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "No subscription contract found with ID 12345 in Shopify",
                  "status": 404,
                  "title": "Contract not found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Contract not found in Shopify"
          },
          "429": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Shopify API rate limit exceeded. Please retry after 60 seconds.",
                  "retryAfter": 60,
                  "status": 429,
                  "title": "Rate limit exceeded",
                  "type": "https://example.com/errors/rate-limit"
                }
              }
            },
            "description": "Rate limit exceeded - Shopify API rate limit hit"
          },
          "502": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Failed to retrieve contract from Shopify. Please try again later.",
                  "status": 502,
                  "title": "Shopify API error",
                  "type": "https://example.com/errors/bad-gateway"
                }
              }
            },
            "description": "Bad gateway - Shopify API error"
          }
        },
        "summary": "Get raw Shopify GraphQL contract response",
        "tags": [
          "Subscription Management",
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-contracts/{id}": {
      "delete": {
        "description": "Cancels an existing subscription contract. This operation terminates all future billing and delivery cycles for the subscription. The cancellation takes effect immediately.\n\n**Important Notes:**\n- Any pending/scheduled orders will be cancelled\n- The customer will receive a cancellation confirmation email if SUBSCRIPTION_CANCELLED email template is enabled\n- Cancellation feedback and notes are stored for analytics and reporting\n- Minimum cycle requirements ARE enforced via API (unlike internal cancellations)\n- If the subscription is under a free trial period, minimum cycles are not enforced\n\n**Validation Rules:**\n- Contract must exist and belong to the authenticated shop\n- Contract must not already be cancelled\n- Must have completed minimum required billing cycles (unless in trial)\n\n**Post-Cancellation:**\n- Status changes to 'cancelled' (lowercase)\n- Any pause settings are cleared\n- Cancellation feedback and notes are saved\n- Activity log entry is created\n- Cancellation email is sent (if enabled)\n- Any invalid discount codes are automatically removed\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "deleteSubscriptionContractV2",
        "parameters": [
          {
            "description": "The unique identifier of the subscription contract to cancel. Must be a valid contract ID that belongs to the authenticated shop.",
            "example": 123456789,
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "int64",
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "Optional feedback from the customer about why they are cancelling. This information is valuable for understanding cancellation reasons and improving retention. Common values include: 'Too expensive', 'No longer needed', 'Found alternative', 'Quality issues', 'Delivery issues', 'Customer service', 'Product not as expected', etc. This field is stored permanently with the contract for analytics.",
            "example": "Too expensive",
            "in": "query",
            "name": "cancellationFeedback",
            "required": false,
            "schema": {
              "maxLength": 500,
              "type": "string"
            }
          },
          {
            "description": "Optional internal note for recording additional cancellation context. This field is for internal use and not visible to customers. Can be used to track special circumstances, support ticket references, competitor information, or other relevant details about why the customer cancelled. This note is stored permanently with the contract.",
            "example": "Customer switching to competitor X due to pricing. Support ticket #12345",
            "in": "query",
            "name": "cancellationNote",
            "required": false,
            "schema": {
              "maxLength": 1000,
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Subscription successfully cancelled. No content returned.",
            "headers": {
              "X-Application-Context": {
                "description": "Application context",
                "schema": {
                  "type": "string"
                },
                "style": "simple"
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Contract Not Found": {
                    "description": "Contract Not Found",
                    "value": {
                      "detail": "No subscription contract found with the specified ID",
                      "instance": "/api/external/v2/subscription-contracts/999999999",
                      "status": 400,
                      "title": "Contract does not exist",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Contract ID": {
                    "description": "Invalid Contract ID",
                    "value": {
                      "detail": "Contract does not belong to this shop",
                      "instance": "/api/external/v2/subscription-contracts/123456789",
                      "status": 400,
                      "title": "Invalid id",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Minimum Cycles Not Met": {
                    "description": "Minimum Cycles Not Met",
                    "value": {
                      "detail": "Subscription has a minimum commitment that has not been fulfilled",
                      "instance": "/api/external/v2/subscription-contracts/123456789",
                      "status": 400,
                      "title": "UserGeneratedError:You need to complete at least 3 orders before you can cancel this subscription.",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Shopify API Error": {
                    "description": "Shopify API Error",
                    "value": {
                      "detail": "Shopify API returned an error when attempting to cancel",
                      "instance": "/api/external/v2/subscription-contracts/123456789",
                      "status": 400,
                      "title": "UserGeneratedError:Unable to cancel subscription at this time",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid request or business rule violation"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header is required",
                  "instance": "/api/external/v2/subscription-contracts/123456789",
                  "status": 401,
                  "title": "Shop does not exist",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to cancel subscriptions",
                  "instance": "/api/external/v2/subscription-contracts/123456789",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to cancel the subscription"
          }
        },
        "summary": "Cancel a subscription contract",
        "tags": [
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-custom-csses/{id}": {
      "get": {
        "description": "Retrieves the custom CSS styling configuration for the customer portal. This endpoint returns all custom CSS rules that have been configured to customize the appearance, layout, and branding of the subscription customer portal.\n\n**What is Custom CSS?**\nCustom CSS allows merchants to fully customize the visual appearance of their customer portal beyond the basic theme settings. This enables complete brand alignment and creates a seamless experience that matches the merchant's main store design.\n\n**Custom CSS Capabilities:**\n- **Layout Customization**:\n  - Modify page layouts and spacing\n  - Adjust grid and flexbox configurations\n  - Control responsive breakpoints\n  - Customize navigation and sidebars\n\n- **Typography**:\n  - Custom fonts and font families\n  - Font sizes, weights, and line heights\n  - Letter spacing and text transforms\n  - Heading and paragraph styles\n\n- **Colors and Branding**:\n  - Brand color palette application\n  - Custom background colors and gradients\n  - Button and link styling\n  - Hover and focus states\n  - Border colors and shadows\n\n- **Component Styling**:\n  - Subscription card appearances\n  - Form input styling\n  - Button designs and interactions\n  - Modal and dialog boxes\n  - Navigation menus\n  - Product images and thumbnails\n\n- **Advanced Features**:\n  - CSS animations and transitions\n  - Media queries for responsive design\n  - Pseudo-elements and pseudo-classes\n  - Custom icons using CSS\n  - Transform and filter effects\n\n**CSS Structure:**\nThe returned CSS includes:\n- Global styles for portal-wide consistency\n- Component-specific styles\n- Responsive design rules\n- Theme overrides\n- Custom animations\n- Print styles (optional)\n\n**Common CSS Selectors Available:**\n```css\n/* Portal container */\n.subscription-portal { }\n\n/* Subscription cards */\n.subscription-card { }\n.subscription-card-header { }\n.subscription-card-body { }\n\n/* Buttons */\n.btn-primary { }\n.btn-secondary { }\n.btn-cancel { }\n\n/* Forms */\n.form-control { }\n.form-group { }\n.form-label { }\n\n/* Navigation */\n.portal-nav { }\n.nav-item { }\n\n/* Product displays */\n.product-item { }\n.product-image { }\n.product-title { }\n```\n\n**Use Cases:**\n- Apply custom branding to match main store design\n- Create unique visual experiences for different customer segments\n- Implement seasonal or promotional themes\n- Enhance mobile responsiveness\n- Add accessibility improvements (high contrast, larger fonts)\n- A/B test different portal designs\n- Integrate with design systems\n- Implement dark mode or theme switching\n\n**Important Notes:**\n- CSS is sanitized for security (XSS prevention)\n- Certain properties may be restricted for security reasons\n- External resources (fonts, images) must use HTTPS\n- CSS is cached for performance - changes may take a few minutes to propagate\n- Invalid CSS syntax is automatically filtered out\n- Some core portal elements have !important styles that cannot be overridden\n\n**Best Practices:**\n- Use specific selectors to avoid conflicts\n- Test across different browsers and devices\n- Keep CSS organized with comments\n- Use CSS variables for maintainability\n- Minify CSS for production performance\n- Consider accessibility in color choices (WCAG compliance)\n- Provide fallbacks for advanced CSS features\n\n**Security Considerations:**\n- CSS is sanitized to prevent code injection\n- External URLs are validated\n- JavaScript in CSS is blocked (e.g., expression(), behavior())\n- Data URIs are validated for malicious content\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "getSubscriptionCustomCssV2",
        "parameters": [
          {
            "description": "Id",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": "{\n  \"id\": 12345,\n  \"shop\": \"example-shop.myshopify.com\",\n  \"customCss\": \"/* Global Portal Styles */\\n\" +\n    \".subscription-portal {\\n\" +\n    \"  font-family: 'Helvetica Neue', Arial, sans-serif;\\n\" +\n    \"  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);\\n\" +\n    \"  min-height: 100vh;\\n\" +\n    \"}\\n\\n\" +\n    \"/* Subscription Cards */\\n\" +\n    \".subscription-card {\\n\" +\n    \"  border-radius: 12px;\\n\" +\n    \"  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);\\n\" +\n    \"  background: white;\\n\" +\n    \"  padding: 24px;\\n\" +\n    \"  margin-bottom: 16px;\\n\" +\n    \"  transition: transform 0.2s ease, box-shadow 0.2s ease;\\n\" +\n    \"}\\n\\n\" +\n    \".subscription-card:hover {\\n\" +\n    \"  transform: translateY(-2px);\\n\" +\n    \"  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);\\n\" +\n    \"}\\n\\n\" +\n    \"/* Primary Button Styling */\\n\" +\n    \".btn-primary {\\n\" +\n    \"  background-color: #4A90E2;\\n\" +\n    \"  border-color: #4A90E2;\\n\" +\n    \"  color: white;\\n\" +\n    \"  font-weight: 600;\\n\" +\n    \"  padding: 12px 24px;\\n\" +\n    \"  border-radius: 6px;\\n\" +\n    \"  transition: all 0.3s ease;\\n\" +\n    \"}\\n\\n\" +\n    \".btn-primary:hover {\\n\" +\n    \"  background-color: #357ABD;\\n\" +\n    \"  border-color: #357ABD;\\n\" +\n    \"  transform: scale(1.02);\\n\" +\n    \"}\\n\\n\" +\n    \"/* Form Inputs */\\n\" +\n    \".form-control {\\n\" +\n    \"  border: 2px solid #E0E0E0;\\n\" +\n    \"  border-radius: 6px;\\n\" +\n    \"  padding: 10px 14px;\\n\" +\n    \"  font-size: 14px;\\n\" +\n    \"}\\n\\n\" +\n    \".form-control:focus {\\n\" +\n    \"  border-color: #4A90E2;\\n\" +\n    \"  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);\\n\" +\n    \"  outline: none;\\n\" +\n    \"}\\n\\n\" +\n    \"/* Responsive Design */\\n\" +\n    \"@media (max-width: 768px) {\\n\" +\n    \"  .subscription-card {\\n\" +\n    \"    padding: 16px;\\n\" +\n    \"  }\\n\" +\n    \"  .btn-primary {\\n\" +\n    \"    width: 100%;\\n\" +\n    \"  }\\n\" +\n    \"}\",\n  \"enabled\": true,\n  \"version\": 2,\n  \"lastModified\": \"2024-02-20T14:45:00Z\",\n  \"createdAt\": \"2024-01-15T10:30:00Z\",\n  \"updatedAt\": \"2024-02-20T14:45:00Z\"\n}"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionCustomCssDTO"
                }
              }
            },
            "description": "Custom CSS successfully retrieved"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header is required",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to view custom CSS settings",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to view custom CSS"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "No custom CSS has been configured for this shop",
                  "status": 404,
                  "title": "CSS not found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Custom CSS not found - No custom CSS has been configured"
          }
        },
        "summary": "Get custom CSS for customer portal",
        "tags": [
          "Customization",
          "Customer Portal"
        ]
      }
    },
    "/api/external/v2/subscription-customers-detail/valid/{customerId}": {
      "get": {
        "description": "Retrieves comprehensive subscription contract details for a specific customer, including subscription status, products, billing information, delivery schedules, and more. This endpoint returns full subscription objects with all associated data, making it ideal for displaying subscription management interfaces and detailed analytics.\n\n**What This Endpoint Returns:**\nUnlike the contract IDs endpoint which returns only numeric IDs, this endpoint provides complete SubscriptionContractDetailsDTO objects for each of the customer's subscriptions. Each object contains all information needed to display and manage a subscription.\n\n**Data Included in Response:**\n\n**Subscription Identity:**\n- Subscription contract ID (Shopify numeric ID)\n- Subscription GraphQL ID (Shopify GID format)\n- Internal Appstle database ID\n- Contract creation date\n\n**Subscription Status & Lifecycle:**\n- Current status (ACTIVE, PAUSED, CANCELLED, EXPIRED, FAILED)\n- Status reason (why paused/cancelled)\n- Next billing date and time\n- Contract anchor date\n- Cancellation date (if applicable)\n- Current billing cycle number\n- Min/max cycle limits\n\n**Billing Configuration:**\n- Billing interval (WEEK, MONTH, YEAR)\n- Billing interval count (e.g., every 2 weeks)\n- Billing policy (pricing details)\n- Currency code\n- Recurring total price\n- Applied discounts and pricing policies\n\n**Delivery Configuration:**\n- Delivery interval (WEEK, MONTH, YEAR)\n- Delivery interval count\n- Delivery method (SHIPPING, PICK_UP, LOCAL_DELIVERY)\n- Delivery policy details\n- Delivery price\n\n**Products & Line Items:**\n- All subscribed products and variants\n- Product titles, SKUs, and images\n- Quantities per product\n- Individual line item prices\n- Product-specific discounts\n- Line item attributes and custom fields\n\n**Customer Information:**\n- Customer ID and GraphQL ID\n- Customer name and email\n- Customer acceptance status\n\n**Address Details:**\n- Billing address (full address object)\n- Shipping address (full address object)\n- Address validation status\n\n**Payment Information:**\n- Payment instrument type\n- Payment method details (card last 4, etc.)\n- Payment gateway used\n\n**Order & Fulfillment:**\n- Last order ID and details\n- Last order date\n- Order note\n- Fulfillment status\n\n**Additional Metadata:**\n- Custom note attributes\n- Tags and labels\n- Internal flags and settings\n- Selling plan ID and group ID\n- Shop domain\n\n**Use Cases:**\n\n**1. Customer Portal:**\n- Display all subscriptions on customer dashboard\n- Show subscription details page\n- Enable subscription management actions\n- Display upcoming order information\n\n**2. Admin Dashboard:**\n- View customer's complete subscription portfolio\n- Analyze subscription health and status\n- Identify at-risk or high-value subscriptions\n- Generate customer subscription reports\n\n**3. Customer Support:**\n- Quick access to all customer subscription details\n- Troubleshoot billing or delivery issues\n- Verify subscription configurations\n- Assist with subscription modifications\n\n**4. Analytics & Reporting:**\n- Calculate customer lifetime value\n- Analyze subscription mix per customer\n- Track subscription frequency distribution\n- Identify cross-sell/upsell opportunities\n\n**5. Integration & Automation:**\n- Sync subscription data to CRM/analytics platforms\n- Trigger workflows based on subscription details\n- Build custom reporting dashboards\n- Export subscription data for analysis\n\n**Response Format:**\n\nReturns an array of SubscriptionContractDetailsDTO objects:\n```json\n[\n  {\n    \"id\": 789,\n    \"subscriptionContractId\": 5234567890,\n    \"status\": \"ACTIVE\",\n    \"nextBillingDate\": \"2024-03-15T00:00:00Z\",\n    \"billingInterval\": \"MONTH\",\n    \"billingIntervalCount\": 1,\n    \"deliveryInterval\": \"MONTH\",\n    \"deliveryIntervalCount\": 1,\n    \"currencyCode\": \"USD\",\n    \"currentTotalPrice\": \"49.99\",\n    \"customerId\": 12345,\n    \"customerEmail\": \"customer@example.com\",\n    \"lineItems\": [...],\n    \"billingAddress\": {...},\n    \"shippingAddress\": {...}\n  },\n  {...}\n]\n```\n\n**Response Scenarios:**\n\n**Customer with no subscriptions:**\n```json\n[]\n```\nReturns empty array with 200 OK status (not an error).\n\n**Customer with multiple subscriptions:**\nArray contains multiple subscription objects, each representing a separate subscription contract.\n\n**Performance Considerations:**\n\n**Response Size:**\n- Each subscription object can be 5-50 KB depending on line items\n- Customer with 10 subscriptions: ~100-500 KB response\n- Consider pagination or filtering for customers with 20+ subscriptions\n\n**Query Performance:**\n- Typical response time: 200-500ms\n- Slower for customers with many subscriptions or complex products\n- Database query is optimized with indexed lookups\n\n**Best Practices:**\n\n1. **Cache Results**: Cache response data to minimize API calls\n2. **Filter Client-Side**: Filter/sort subscriptions on client after retrieval\n3. **Selective Display**: Don't display all fields if not needed\n4. **Handle Empty Array**: Always gracefully handle case with no subscriptions\n5. **Optimize Images**: Product images can be large - lazy load if displaying\n\n**Data Freshness:**\n- Data is retrieved from Appstle database (not real-time Shopify query)\n- Updated via webhooks with < 1 second lag typically\n- Use sync endpoint if data appears stale\n\n**Security Notes:**\n- Customer ID is validated against authenticated shop\n- Returns only subscriptions belonging to specified customer\n- Cannot access customers from other shops\n- Sensitive payment details (full card numbers) are never returned\n\n**Comparison with Other Endpoints:**\n\n**vs. GET /subscription-customers/valid/{customerId}:**\n- This endpoint: Returns complete subscription details\n- Valid contracts endpoint: Returns only contract IDs\n- Use this when you need full subscription information\n\n**vs. GET /subscription-contract-details:**\n- This endpoint: Filtered by single customer\n- Contract details endpoint: Query across all customers with filters\n- Use this for customer-specific views\n\n**vs. GET /subscription-contracts/contract-external/{contractId}:**\n- This endpoint: All contracts for a customer\n- Contract external endpoint: Single contract with Shopify raw data\n- Use this for customer overview, other for detailed single contract\n\n**Authentication:** Requires valid X-API-Key header or api_key parameter (deprecated)",
        "operationId": "getValidSubscriptionCustomerDetailsV2",
        "parameters": [
          {
            "description": "Customer Id",
            "in": "path",
            "name": "customerId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Customer with active subscriptions": {
                    "description": "Customer with active subscriptions",
                    "value": [
                      {
                        "billingInterval": "MONTH",
                        "billingIntervalCount": 1,
                        "currencyCode": "USD",
                        "currentCycle": 3,
                        "currentTotalPrice": "49.99",
                        "customerEmail": "customer@example.com",
                        "customerId": 12345,
                        "deliveryInterval": "MONTH",
                        "deliveryIntervalCount": 1,
                        "deliveryMethod": "SHIPPING",
                        "id": 789,
                        "nextBillingDate": "2024-03-15T00:00:00Z",
                        "shop": "example-shop.myshopify.com",
                        "status": "ACTIVE",
                        "subscriptionContractId": 5234567890
                      },
                      {
                        "billingInterval": "WEEK",
                        "billingIntervalCount": 2,
                        "currencyCode": "USD",
                        "currentTotalPrice": "24.99",
                        "customerEmail": "customer@example.com",
                        "customerId": 12345,
                        "id": 790,
                        "status": "PAUSED",
                        "subscriptionContractId": 5234567891
                      }
                    ]
                  },
                  "Customer with no subscriptions": {
                    "description": "Customer with no subscriptions",
                    "value": []
                  }
                },
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/SubscriptionContractDetailsDTO"
                  },
                  "type": "array"
                }
              }
            },
            "description": "Successfully retrieved customer subscription details. Returns array of subscription objects (may be empty)."
          },
          "400": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Customer ID must be a valid positive integer",
                  "status": 400,
                  "title": "Invalid customer ID",
                  "type": "https://example.com/errors/bad-request"
                }
              }
            },
            "description": "Bad request - Invalid customer ID"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header is required",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required - Missing or invalid API key"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Customer 12345 does not belong to your shop",
                  "status": 403,
                  "title": "Access denied",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Forbidden - Customer does not belong to authenticated shop"
          },
          "429": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Too many requests. Please retry after 60 seconds.",
                  "retryAfter": 60,
                  "status": 429,
                  "title": "Rate limit exceeded",
                  "type": "https://example.com/errors/rate-limit"
                }
              }
            },
            "description": "Rate limit exceeded"
          },
          "500": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "An unexpected error occurred while retrieving subscription details",
                  "status": 500,
                  "title": "Server error",
                  "type": "https://example.com/errors/internal-error"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Get detailed subscription information for a customer",
        "tags": [
          "Customers",
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-customers/sync-info/{customerId}": {
      "get": {
        "description": "Synchronizes customer subscription information from Shopify to the Appstle subscription system. This endpoint fetches the latest customer data from Shopify and updates the local database to ensure data consistency across platforms.\n\n**What Does This Endpoint Do?**\nThis endpoint triggers a synchronization process that pulls customer subscription data from Shopify's GraphQL API and updates the Appstle subscription database with the latest information. It ensures that customer details, subscription statuses, and associated metadata are current and accurate.\n\n**Sync Process:**\n\n1. **Data Retrieval**: Fetches customer subscription data from Shopify using their GraphQL API\n2. **Validation**: Validates the retrieved data against existing records\n3. **Update**: Updates customer subscription details in Appstle database\n4. **Reconciliation**: Reconciles any discrepancies between Shopify and Appstle data\n5. **Logging**: Logs all sync activities for audit trail\n\n**What Gets Synchronized:**\n\n**Customer Information:**\n- Customer ID and Shopify GraphQL ID\n- Customer name and email address\n- Customer tags and metadata\n- Customer acceptance status\n- Marketing preferences\n\n**Subscription Details:**\n- Active subscription contracts\n- Subscription statuses (ACTIVE, PAUSED, CANCELLED, EXPIRED)\n- Next billing dates\n- Billing interval and delivery interval\n- Subscription line items (products and variants)\n- Pricing and discounts\n\n**Payment Information:**\n- Associated payment methods\n- Payment instrument status\n- Billing address details\n\n**Delivery Information:**\n- Shipping address details\n- Delivery method and profile\n- Delivery preferences\n\n**Use Cases:**\n\n**1. Data Consistency:**\n- Resolve data discrepancies between Shopify and Appstle\n- Update customer information after changes in Shopify admin\n- Sync subscription modifications made directly in Shopify\n\n**2. Troubleshooting:**\n- Fix sync issues for specific customers\n- Recover from webhook delivery failures\n- Debug customer portal display issues\n\n**3. Migration & Integration:**\n- Initial data sync after app installation\n- Re-sync after system maintenance or updates\n- Integration testing and validation\n\n**4. Customer Support:**\n- Refresh customer data when assisting with support tickets\n- Verify latest subscription status during customer inquiries\n- Update data after manual changes in Shopify\n\n**When to Use This Endpoint:**\n\n**Recommended Scenarios:**\n- Customer reports incorrect subscription data in portal\n- After making manual changes to subscriptions in Shopify admin\n- When troubleshooting webhook sync failures\n- Before running bulk operations on customer subscriptions\n- During migration or data reconciliation processes\n\n**Avoid Using For:**\n- Real-time data refresh (webhooks handle this automatically)\n- Frequent polling (use webhooks instead to avoid rate limits)\n- Bulk syncs of many customers (use batch endpoints or scheduled jobs)\n\n**Sync Behavior:**\n\n**Synchronous Operation:**\n- Endpoint blocks until sync completes\n- Returns void on success\n- Throws exception on failure\n\n**Data Precedence:**\n- Shopify data is always treated as source of truth\n- Local Appstle data is overwritten with Shopify values\n- Custom Appstle-specific fields are preserved\n\n**Error Handling:**\n- Invalid customer ID: Returns 400 Bad Request\n- Customer not found in Shopify: Returns 404 Not Found\n- Shopify API errors: Returns 502 Bad Gateway\n- Rate limit exceeded: Returns 429 Too Many Requests\n\n**Important Considerations:**\n\n**Performance:**\n- Sync duration depends on number of subscriptions (typically 1-5 seconds)\n- May timeout for customers with 100+ active subscriptions\n- Consider using asynchronous sync for high-volume customers\n\n**Rate Limiting:**\n- Subject to Shopify GraphQL API rate limits\n- Frequent calls may exhaust rate limit budget\n- Use webhooks for real-time sync instead of polling this endpoint\n\n**Data Integrity:**\n- Always creates audit log entries for tracking\n- Preserves historical data and activity logs\n- Does not delete local-only data (e.g., custom notes)\n\n**Best Practices:**\n\n1. **Use Sparingly**: Rely on webhooks for automatic sync; use this only when needed\n2. **Check Logs**: Review activity logs after sync to verify changes\n3. **Validate Results**: Query customer data after sync to confirm updates\n4. **Handle Errors**: Implement retry logic with exponential backoff\n5. **Monitor Rate Limits**: Track Shopify API usage to avoid hitting limits\n\n**Security Notes:**\n- Requires valid API key authentication via X-API-Key header\n- Customer ID is validated against shop ownership\n- Cannot sync customers from other shops\n- All sync operations are logged for audit compliance\n\n**Response:**\n- Returns HTTP 204 No Content on successful sync\n- No response body returned\n- Check activity logs for detailed sync results\n\n**Alternative Approaches:**\n\nIf you need to:\n- **Sync multiple customers**: Use bulk sync endpoint or scheduled job\n- **Real-time updates**: Rely on webhook subscriptions\n- **Verify data without modifying**: Use GET endpoints to retrieve current data\n\n**Integration Workflow Example:**\n\n```\n1. Customer contacts support about incorrect billing date\n2. Support agent checks subscription in Appstle admin\n3. Agent makes correction in Shopify admin\n4. Agent calls sync endpoint for this customer\n5. Sync retrieves latest data from Shopify\n6. Appstle database is updated with corrected billing date\n7. Customer portal now shows correct date\n8. Support ticket resolved\n```\n\n**Authentication:** Requires valid X-API-Key header or api_key parameter (deprecated)",
        "operationId": "syncCustomerInfo",
        "parameters": [
          {
            "description": "Customer Id",
            "in": "path",
            "name": "customerId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "content": {
              "application/json": {}
            },
            "description": "Customer subscription data successfully synchronized from Shopify. No response body returned. Check activity logs to verify sync completion and review changes made."
          },
          "400": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Customer ID must be a valid positive integer",
                  "status": 400,
                  "title": "Invalid request",
                  "type": "https://example.com/errors/bad-request"
                }
              }
            },
            "description": "Bad request - Invalid customer ID or malformed request parameters"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header is required",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required - Missing or invalid API key"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Customer does not belong to your shop or API key lacks required permissions",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions or customer does not belong to authenticated shop"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "No customer found with ID 12345 in Shopify",
                  "status": 404,
                  "title": "Customer not found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Customer not found in Shopify or has no subscriptions"
          },
          "429": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Shopify API rate limit exceeded. Please retry after 60 seconds.",
                  "retryAfter": 60,
                  "status": 429,
                  "title": "Rate limit exceeded",
                  "type": "https://example.com/errors/rate-limit"
                }
              }
            },
            "description": "Rate limit exceeded - Too many sync requests or Shopify API rate limit hit"
          },
          "502": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Failed to connect to Shopify API. Please try again later.",
                  "status": 502,
                  "title": "Shopify API error",
                  "type": "https://example.com/errors/bad-gateway"
                }
              }
            },
            "description": "Bad gateway - Shopify API error or connection failure"
          },
          "504": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Sync operation timed out. Customer may have too many subscriptions. Please contact support for manual sync.",
                  "status": 504,
                  "title": "Sync timeout",
                  "type": "https://example.com/errors/timeout"
                }
              }
            },
            "description": "Gateway timeout - Sync operation took too long (customer has too many subscriptions)"
          }
        },
        "summary": "Sync customer subscription details from Shopify",
        "tags": [
          "Customers",
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-customers/valid/{customerId}": {
      "get": {
        "description": "Retrieves a set of all valid (active, paused, or otherwise non-deleted) subscription contract IDs for a specific customer. This endpoint returns only the contract IDs without detailed subscription information, making it ideal for quick lookups and validation checks.\n\n**What Are Valid Subscription Contracts?**\nValid contracts are subscriptions that exist in the system and haven't been permanently deleted. This includes subscriptions in all states except those that have been hard-deleted or hidden from the system. The contract IDs returned represent subscriptions that can be queried, modified, or managed through other API endpoints.\n\n**Contract States Included:**\n\n**Active States:**\n- `ACTIVE` - Currently active and billing recurring subscriptions\n- `PAUSED` - Temporarily paused subscriptions (customer can resume)\n\n**Inactive States:**\n- `CANCELLED` - Cancelled subscriptions (retained for historical data)\n- `EXPIRED` - Subscriptions that reached their max cycle limit\n- `FAILED` - Subscriptions with payment failures (may be in dunning)\n\n**Excluded:**\n- Hard-deleted subscription records\n- Hidden subscriptions (marked for cleanup)\n- Subscriptions from test/development that were purged\n\n**Use Cases:**\n\n**1. Customer Portal:**\n- Check if customer has any subscriptions before showing portal\n- Display subscription count in dashboard\n- Validate customer access to subscription management\n\n**2. Integration & Automation:**\n- Pre-flight check before bulk operations\n- Verify customer has subscriptions before sending emails\n- Filter customers for targeted campaigns (has active subscriptions)\n\n**3. Validation & Security:**\n- Verify a specific contract ID belongs to a customer\n- Validate user permissions before showing subscription details\n- Check authorization for subscription modification requests\n\n**4. Analytics & Reporting:**\n- Count total subscriptions per customer\n- Identify customers with multiple subscriptions\n- Build customer segmentation based on subscription count\n\n**Response Format:**\n\nReturns a `Set<Long>` containing Shopify subscription contract IDs.\n\n```json\n[123456789, 123456790, 123456791]\n```\n\n**Set Properties:**\n- **Unique values**: No duplicate contract IDs\n- **Unordered**: IDs are not in any specific order\n- **Numeric**: IDs are Long integers (not GraphQL GIDs)\n\n**Common Response Scenarios:**\n\n**Customer with multiple subscriptions:**\n```json\n[5234567890, 5234567891, 5234567892, 5234567893]\n```\n\n**Customer with single subscription:**\n```json\n[5234567890]\n```\n\n**Customer with no subscriptions:**\n```json\n[]\n```\n\n**Integration Examples:**\n\n**Example 1: Check if customer has subscriptions**\n```javascript\nconst contractIds = await fetch('/api/external/v2/subscription-customers/valid/12345', {\n  headers: { 'X-API-Key': 'your-api-key' }\n}).then(r => r.json());\n\nif (contractIds.length > 0) {\n  console.log(`Customer has ${contractIds.length} subscriptions`);\n  // Show customer portal\n} else {\n  console.log('Customer has no subscriptions');\n  // Redirect to create subscription page\n}\n```\n\n**Example 2: Validate contract ownership**\n```javascript\nconst customerId = 12345;\nconst contractIdToVerify = 5234567890;\n\nconst validContracts = await fetch(`/api/external/v2/subscription-customers/valid/${customerId}`, {\n  headers: { 'X-API-Key': 'your-api-key' }\n}).then(r => r.json());\n\nif (validContracts.includes(contractIdToVerify)) {\n  console.log('Customer owns this contract - allowing access');\n  // Proceed with subscription modification\n} else {\n  console.log('Unauthorized - contract does not belong to customer');\n  // Return 403 Forbidden\n}\n```\n\n**Performance Characteristics:**\n\n**Fast Response:**\n- Lightweight query (returns only IDs, not full subscription data)\n- Typical response time: 50-200ms\n- Suitable for real-time validation checks\n\n**Scalability:**\n- Efficient even for customers with 100+ subscriptions\n- Database query uses indexed customer ID field\n- Minimal network payload (just array of numbers)\n\n**Important Notes:**\n\n**Contract ID Format:**\n- Returns numeric Shopify contract IDs (e.g., `5234567890`)\n- NOT Shopify GraphQL GIDs (e.g., `gid://shopify/SubscriptionContract/...`)\n- Use these IDs with other Appstle API endpoints\n\n**Data Freshness:**\n- Returns data from Appstle database (not real-time Shopify query)\n- Data is updated via webhooks (typically < 1 second lag)\n- If data seems stale, use sync endpoint to refresh\n\n**Empty Response:**\n- Empty array `[]` means customer has no valid subscriptions\n- This is NOT an error - it's a valid response\n- Returns 200 OK with empty array (not 404)\n\n**Security & Authorization:**\n- Customer ID is validated against authenticated shop\n- Cannot query customers from other shops\n- API key must have customer read permissions\n\n**Best Practices:**\n\n1. **Use for Validation**: Perfect for quick ownership/existence checks\n2. **Cache Locally**: Cache results briefly to reduce API calls\n3. **Check Empty Array**: Always handle empty array case gracefully\n4. **Combine with Details**: Use this for initial check, then fetch full details if needed\n5. **Avoid Polling**: Don't poll this endpoint repeatedly - use webhooks for updates\n\n**When to Use vs. Other Endpoints:**\n\n**Use this endpoint when you:**\n- Need just the contract IDs (not full subscription details)\n- Want to validate a customer has subscriptions\n- Need to verify contract ownership for authorization\n- Want fast, lightweight responses\n\n**Use subscription-customers-detail endpoint when you:**\n- Need full subscription details (status, products, billing dates, etc.)\n- Want to display subscription information to users\n- Need to make decisions based on subscription state\n\n**Related Endpoints:**\n- `GET /api/external/v2/subscription-customers-detail/valid/{customerId}` - Get full subscription details\n- `GET /api/external/v2/subscription-contract-details` - Query subscriptions with filters\n- `GET /api/external/v2/subscription-contracts/contract-external/{contractId}` - Get single contract details\n\n**Authentication:** Requires valid X-API-Key header or api_key parameter (deprecated)",
        "operationId": "getValidSubscriptionCustomerV2",
        "parameters": [
          {
            "description": "Id",
            "in": "path",
            "name": "customerId",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Customer with multiple subscriptions": {
                    "description": "Customer with multiple subscriptions",
                    "value": [
                      5234567890,
                      5234567891,
                      5234567892,
                      5234567893
                    ]
                  },
                  "Customer with no subscriptions": {
                    "description": "Customer with no subscriptions",
                    "value": []
                  },
                  "Customer with single subscription": {
                    "description": "Customer with single subscription",
                    "value": [
                      5234567890
                    ]
                  }
                },
                "schema": {
                  "items": {
                    "format": "int64",
                    "type": "integer"
                  },
                  "type": "array"
                }
              }
            },
            "description": "Successfully retrieved valid subscription contract IDs. Returns a set of contract IDs (may be empty if customer has no subscriptions)."
          },
          "400": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Customer ID must be a valid positive integer",
                  "status": 400,
                  "title": "Invalid customer ID",
                  "type": "https://example.com/errors/bad-request"
                }
              }
            },
            "description": "Bad request - Invalid customer ID format"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid X-API-Key header is required",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required - Missing or invalid API key"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Customer 12345 does not belong to your shop",
                  "status": 403,
                  "title": "Access denied",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Forbidden - Customer does not belong to authenticated shop"
          },
          "429": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Too many requests. Please retry after 60 seconds.",
                  "retryAfter": 60,
                  "status": 429,
                  "title": "Rate limit exceeded",
                  "type": "https://example.com/errors/rate-limit"
                }
              }
            },
            "description": "Rate limit exceeded"
          }
        },
        "summary": "Get valid subscription contract IDs for a customer",
        "tags": [
          "Customers",
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-customers/{id}": {
      "get": {
        "description": "Retrieves comprehensive customer information including their subscription contracts. This endpoint provides customer profile data along with a paginated list of their active and historical subscriptions.\n\n**Key Features:**\n- Customer profile information (name, email, phone, addresses)\n- Complete subscription history with pagination\n- Payment method details\n- Customer account state and metadata\n- Order history related to subscriptions\n- Customer tags and notes\n\n**Subscription Data Included:**\n- All subscription contracts (active, paused, cancelled)\n- Contract details with line items\n- Billing and delivery policies\n- Next billing dates and amounts\n- Applied discounts\n\n**Pagination:**\n- Subscription contracts are paginated\n- Default page size varies by Shopify plan\n- Use cursor for subsequent pages\n- Cursor-based pagination ensures consistency\n\n**Use Cases:**\n- Customer service representatives viewing customer details\n- Integration with CRM systems\n- Customer analytics and reporting\n- Subscription management interfaces\n- Billing reconciliation\n\n**Important Notes:**\n- Customer ID is numeric (without gid:// prefix)\n- Returns null if customer not found\n- Includes both active and inactive subscriptions\n- Payment methods may be masked for security\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "getSubscriptionCustomerV2",
        "parameters": [
          {
            "description": "Customer ID to retrieve. Provide the numeric ID without the gid:// prefix",
            "example": 987654321,
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "int64",
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "deprecated": true,
            "description": "API Key (Deprecated - Use X-API-Key header instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key for authentication",
            "example": "apst_your-api-key-here",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Pagination cursor for subscription contracts. Use the cursor from previous response's pageInfo.endCursor to get the next page",
            "example": "eyJsYXN0X2lkIjoxMjM0NTY3ODksImxhc3RfdmFsdWUiOiIyMDI0LTAxLTE1IDEwOjAwOjAwIn0=",
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "__typename": "Customer",
                      "id": "gid://shopify/Customer/10053873467694",
                      "productSubscriberStatus": "ACTIVE",
                      "subscriptionContracts": {
                        "__typename": "SubscriptionContractConnection",
                        "nodes": [
                          {
                            "__typename": "SubscriptionContract",
                            "billingPolicy": {
                              "__typename": "SubscriptionBillingPolicy",
                              "interval": "MONTH",
                              "intervalCount": 1
                            },
                            "createdAt": "2026-06-02T22:22:01Z",
                            "deliveryPrice": {
                              "__typename": "MoneyV2",
                              "amount": "4.9"
                            },
                            "id": "gid://shopify/SubscriptionContract/34053357870",
                            "lastPaymentStatus": null,
                            "lines": {
                              "__typename": "SubscriptionLineConnection",
                              "nodes": [
                                {
                                  "__typename": "SubscriptionLine",
                                  "currentPrice": {
                                    "__typename": "MoneyV2",
                                    "amount": "22.5",
                                    "currencyCode": "USD"
                                  },
                                  "customAttributes": [
                                    {
                                      "__typename": "Attribute",
                                      "key": "products",
                                      "value": "1x Apple Macbook Air M3 13, 1x Bottle - 10ml, 9x Bottle - 20ml, 10x Bottle - 30ml"
                                    },
                                    {
                                      "__typename": "Attribute",
                                      "key": "_appstle-bb-id",
                                      "value": "tvksrgmrfd"
                                    },
                                    {
                                      "__typename": "Attribute",
                                      "key": "__appstle-bb-name",
                                      "value": "New Fixed one"
                                    },
                                    {
                                      "__typename": "Attribute",
                                      "key": "__appstle-bb-variants",
                                      "value": "51533106970926:1,51652244832558:1,51652244865326:9,51652244898094:10"
                                    },
                                    {
                                      "__typename": "Attribute",
                                      "key": "_appstle-bb-product-sku",
                                      "value": ""
                                    },
                                    {
                                      "__typename": "Attribute",
                                      "key": "_appstle_bundles_type",
                                      "value": "SINGLE_PRODUCT_BUILD_A_BOX"
                                    }
                                  ],
                                  "discountAllocations": [],
                                  "id": "gid://shopify/SubscriptionLine/5d22da79-2b9e-49ae-9af6-f010d791c09a",
                                  "lineDiscountedPrice": {
                                    "__typename": "MoneyV2",
                                    "amount": "22.5",
                                    "currencyCode": "USD"
                                  },
                                  "pricingPolicy": {
                                    "__typename": "SubscriptionPricingPolicy",
                                    "basePrice": {
                                      "__typename": "MoneyV2",
                                      "amount": "25.0",
                                      "currencyCode": "USD"
                                    },
                                    "cycleDiscounts": [
                                      {
                                        "__typename": "SubscriptionCyclePriceAdjustment",
                                        "adjustmentType": "PERCENTAGE",
                                        "adjustmentValue": {
                                          "__typename": "SellingPlanPricingPolicyPercentageValue",
                                          "percentage": 10.0
                                        },
                                        "afterCycle": 0,
                                        "computedPrice": {
                                          "__typename": "MoneyV2",
                                          "amount": "22.5",
                                          "currencyCode": "USD"
                                        }
                                      }
                                    ]
                                  },
                                  "productId": "gid://shopify/Product/10295267918126",
                                  "quantity": 1,
                                  "sellingPlanId": "gid://shopify/SellingPlan/692806091054",
                                  "sellingPlanName": "Monthly Subscription",
                                  "sku": null,
                                  "taxable": true,
                                  "title": "Custom 7-Day Meal Plan",
                                  "variantId": "gid://shopify/ProductVariant/51533108379950",
                                  "variantImage": {
                                    "__typename": "Image",
                                    "url": "https://cdn.shopify.com/s/files/1/0874/3157/7902/files/vegan-lunch-chocolate-smoothie-bowl-buddha-bowl-with-tofu-chickpeas-and-quinoa-lentil-soup_fe298f9d-152b-4d0b-85bd-11611d20701d.jpg?v=1766604366"
                                  },
                                  "variantTitle": null
                                }
                              ],
                              "pageInfo": {
                                "__typename": "PageInfo",
                                "endCursor": "eyJsYXN0X2lkIjoiNWQyMmRhNzktMmI5ZS00OWFlLTlhZjYtZjAxMGQ3OTFjMDlhIiwibGFzdF92YWx1ZSI6IjVkMjJkYTc5LTJiOWUtNDlhZS05YWY2LWYwMTBkNzkxYzA5YSJ9",
                                "hasNextPage": false,
                                "hasPreviousPage": false,
                                "startCursor": "eyJsYXN0X2lkIjoiNWQyMmRhNzktMmI5ZS00OWFlLTlhZjYtZjAxMGQ3OTFjMDlhIiwibGFzdF92YWx1ZSI6IjVkMjJkYTc5LTJiOWUtNDlhZS05YWY2LWYwMTBkNzkxYzA5YSJ9"
                              }
                            },
                            "nextBillingDate": "2026-07-02T22:00:00Z",
                            "status": "ACTIVE"
                          }
                        ],
                        "pageInfo": {
                          "__typename": "PageInfo",
                          "endCursor": "eyJsYXN0X2lkIjo1NDQxMDA1ODE2NzgsImxhc3RfdmFsdWUiOiIyMDI2LTA2LTAyIDIyOjIyOjAxLjc3Njg1NiJ9",
                          "hasNextPage": false,
                          "hasPreviousPage": false,
                          "startCursor": "eyJsYXN0X2lkIjo1NDQxMDA1ODE2NzgsImxhc3RfdmFsdWUiOiIyMDI2LTA2LTAyIDIyOjIyOjAxLjc3Njg1NiJ9"
                        }
                      },
                      "tags": [
                        "Angel",
                        "APPSTLE_ONE_TIME278044475564",
                        "appstle_subscription_active_customer",
                        "Silver",
                        "source: appstle\u2120 subscriptions"
                      ]
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Customer"
                }
              }
            },
            "description": "Customer details successfully retrieved"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Invalid Cursor": {
                    "description": "Invalid Cursor",
                    "value": {
                      "detail": "The provided cursor is malformed or expired",
                      "status": 400,
                      "title": "Invalid pagination cursor",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Customer ID": {
                    "description": "Invalid Customer ID",
                    "value": {
                      "detail": "Customer ID must be a positive number",
                      "status": 400,
                      "title": "Invalid customer ID",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid request parameters"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid API key is required to access this endpoint",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required - missing or invalid API key"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to read customer data",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to access customer data"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "No customer found with ID 987654321",
                  "status": 404,
                  "title": "Customer not found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Customer not found"
          },
          "500": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "An unexpected error occurred while retrieving customer data",
                  "status": 500,
                  "title": "Internal server error",
                  "type": "https://example.com/errors/internal-error"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Get customer details with subscriptions",
        "tags": [
          "Customers",
          "Subscription Contracts"
        ]
      }
    },
    "/api/external/v2/subscription-groups": {
      "get": {
        "description": "Retrieves a list of all subscription groups (selling plan groups) configured in the store. This endpoint provides a complete overview of all subscription offerings available.\n\n**Response includes:**\n- All subscription groups with their configurations\n- Complete selling plan details for each group\n- Product and variant assignments (as JSON strings)\n- Discount configurations and tiers\n- Member restrictions and settings\n\n**Use Cases:**\n- Display all subscription options in a custom interface\n- Audit subscription configurations\n- Export subscription data for analysis\n- Synchronize with external systems\n\n**Performance Notes:**\n- Returns all groups in a single response (no pagination)\n- Response size grows with number of groups and plans\n- Product/variant lists are JSON-encoded strings within the response\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "getAllSubscriptionGroupsV2External",
        "parameters": [
          {
            "deprecated": true,
            "description": "API Key (Deprecated - Use X-API-Key header instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key for authentication",
            "example": "apst_your-api-key-here",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": [
                      {
                        "groupName": "Monthly Coffee Subscription",
                        "id": 123456789,
                        "productCount": 10,
                        "productIds": "[{\"id\":987654321,\"title\":\"Premium Coffee Blend\",\"status\":\"ACTIVE\"}]",
                        "productVariantCount": 35,
                        "subscriptionPlans": [
                          {
                            "afterCycle1": 0,
                            "billingFrequencyCount": 1,
                            "billingFrequencyInterval": "MONTH",
                            "discountEnabled": true,
                            "discountOffer": 10.0,
                            "discountType": "PERCENTAGE",
                            "frequencyCount": 1,
                            "frequencyDescription": "Save 10% on monthly deliveries",
                            "frequencyInterval": "MONTH",
                            "frequencyName": "Delivered Monthly",
                            "id": "gid://shopify/SellingPlan/111111",
                            "inventoryPolicyReserve": "ON_SALE",
                            "minCycles": 3,
                            "planType": "PAY_AS_YOU_GO"
                          }
                        ],
                        "variantIds": "[]"
                      },
                      {
                        "groupName": "Premium Tea Collection",
                        "id": 123456790,
                        "productCount": 15,
                        "productIds": "[{\"id\":987654324,\"title\":\"Organic Green Tea\"},{\"id\":987654325,\"title\":\"Earl Grey Premium\"}]",
                        "productVariantCount": 45,
                        "subscriptionPlans": [
                          {
                            "afterCycle1": 0,
                            "discountEnabled": true,
                            "discountOffer": 15.0,
                            "discountType": "PERCENTAGE",
                            "frequencyCount": 1,
                            "frequencyDescription": "Fresh tea every week with 15% savings",
                            "frequencyInterval": "WEEK",
                            "frequencyName": "Weekly Tea Box",
                            "id": "gid://shopify/SellingPlan/222222",
                            "planType": "PAY_AS_YOU_GO"
                          },
                          {
                            "afterCycle1": 0,
                            "discountEnabled": true,
                            "discountOffer": 10.0,
                            "discountType": "PERCENTAGE",
                            "frequencyCount": 1,
                            "frequencyDescription": "Monthly delivery with 10% discount",
                            "frequencyInterval": "MONTH",
                            "frequencyName": "Monthly Tea Box",
                            "id": "gid://shopify/SellingPlan/333333",
                            "planType": "PAY_AS_YOU_GO"
                          }
                        ],
                        "variantIds": "[]"
                      }
                    ]
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionGroupV2DTO"
                }
              }
            },
            "description": "Successfully retrieved all subscription groups"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Invalid or missing API key",
                  "status": 401,
                  "title": "Unauthorized",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required - missing or invalid API key"
          },
          "403": {
            "content": {
              "*/*": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/SubscriptionGroupV2DTO"
                  },
                  "type": "array"
                }
              }
            },
            "description": "Insufficient permissions to view subscription groups"
          },
          "500": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Error retrieving subscription groups from Shopify",
                  "status": 500,
                  "title": "Internal Server Error",
                  "type": "https://example.com/errors/internal-server-error"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Get all subscription groups",
        "tags": [
          "Subscription Plans"
        ]
      },
      "post": {
        "description": "Creates a new subscription group with one or more selling plans in Shopify. A subscription group is a container for selling plans that can be applied to products and variants. Each group can contain multiple plans with different frequencies, discounts, and delivery schedules.\n\n**Key Features:**\n- Create multiple subscription plans within a single group\n- Configure complex discount tiers (up to 2 levels + custom cycles)\n- Set up free trials with automatic discount transitions\n- Define prepaid plans (PAY_AS_YOU_GO_PREPAID) with custom billing cycles\n- Configure member-only plans with tag-based access control\n- Set specific delivery dates (e.g., 15th of every month)\n- Add all products from store or specific collection automatically\n\n**Discount Configuration:**\n- First discount tier: Applied from a specific cycle (afterCycle1)\n- Second discount tier: Applied from another cycle (afterCycle2)\n- Additional cycles: Configure via appstleCycles for complex scenarios\n- Free trials: Automatically configure 100% discount for trial period\n\n**Product Assignment:**\n- Assign specific products via productIds field in request body\n- Assign specific variants via variantIds field in request body\n- Use isAddAllProduct=true to add all store products\n- Use collectionId with isAddAllProduct=true to add all products from a collection\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "createSubscriptionGroupV2External",
        "parameters": [
          {
            "deprecated": true,
            "description": "API Key (Deprecated - Use X-API-Key header instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key for authentication",
            "example": "apst_your-api-key-here",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Add all products from the store or collection to this subscription group. When true without collectionId: adds all active products in the store. When true with collectionId: adds all products from the specified collection. This operation runs asynchronously and may take time for large catalogs.",
            "example": false,
            "in": "query",
            "name": "isAddAllProduct",
            "required": false,
            "schema": {
              "default": false,
              "type": "boolean"
            }
          },
          {
            "description": "Shopify collection ID to limit product addition when isAddAllProduct is true. Format: numeric ID without gid prefix (e.g., '123456789' not 'gid://shopify/Collection/123456789')",
            "example": 123456789,
            "in": "query",
            "name": "collectionId",
            "required": false,
            "schema": {
              "default": "",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "examples": {
                "Complex Discount with Free Product": {
                  "description": "Complex Discount with Free Product",
                  "value": {
                    "groupName": "Loyalty Rewards Subscription",
                    "productIds": "[{\"id\":987654321}]",
                    "subscriptionPlans": [
                      {
                        "afterCycle1": 0,
                        "appstleCycles": [
                          {
                            "afterCycle": 6,
                            "discountType": "FREE_PRODUCT",
                            "freeVariantId": 42549172011164,
                            "preventDuplicationFreeProduct": true
                          },
                          {
                            "afterCycle": 12,
                            "discountType": "SHIPPING",
                            "repeatingCycle": true,
                            "repeatingNumberOfCycle": 3,
                            "value": 100.0
                          }
                        ],
                        "discountEnabled": true,
                        "discountOffer": 10.0,
                        "discountType": "PERCENTAGE",
                        "frequencyCount": 1,
                        "frequencyDescription": "Earn rewards with every order",
                        "frequencyInterval": "MONTH",
                        "frequencyName": "Monthly with Rewards",
                        "planType": "PAY_AS_YOU_GO"
                      }
                    ]
                  }
                },
                "Free Trial Subscription": {
                  "description": "Free Trial Subscription",
                  "value": {
                    "groupName": "Try Before You Subscribe",
                    "productIds": "[{\"id\":987654321}]",
                    "subscriptionPlans": [
                      {
                        "discountOffer": 100.0,
                        "discountOffer2": 15.0,
                        "freeTrialCount": 14,
                        "freeTrialEnabled": true,
                        "freeTrialInterval": "DAY",
                        "frequencyCount": 1,
                        "frequencyDescription": "Try free for 14 days, then save 15%",
                        "frequencyInterval": "MONTH",
                        "frequencyName": "Monthly with 14-Day Trial",
                        "inventoryPolicyReserve": "ON_FULFILLMENT",
                        "minCycles": 3,
                        "planType": "PAY_AS_YOU_GO"
                      }
                    ]
                  }
                },
                "Member-Only Subscription": {
                  "description": "Member-Only Subscription",
                  "value": {
                    "groupName": "VIP Member Subscriptions",
                    "productIds": "[{\"id\":987654321}]",
                    "subscriptionPlans": [
                      {
                        "afterCycle1": 0,
                        "discountEnabled": true,
                        "discountOffer": 25.0,
                        "discountType": "PERCENTAGE",
                        "frequencyCount": 1,
                        "frequencyDescription": "Exclusive pricing for VIP members",
                        "frequencyInterval": "MONTH",
                        "frequencyName": "VIP Monthly Plan",
                        "memberExclusiveTags": "blocked,suspended",
                        "memberInclusiveTags": "vip,gold-member,platinum-member",
                        "memberOnly": true,
                        "planType": "PAY_AS_YOU_GO"
                      }
                    ]
                  }
                },
                "Multi-tier Discount Plan": {
                  "description": "Multi-tier Discount Plan",
                  "value": {
                    "groupName": "Premium Subscription Plans",
                    "productIds": "[{\"id\":987654321},{\"id\":987654322}]",
                    "subscriptionPlans": [
                      {
                        "afterCycle1": 0,
                        "afterCycle2": 4,
                        "discountEnabled": true,
                        "discountEnabled2": true,
                        "discountOffer": 5.0,
                        "discountOffer2": 10.0,
                        "discountType": "PERCENTAGE",
                        "discountType2": "PERCENTAGE",
                        "frequencyCount": 1,
                        "frequencyDescription": "Save more with weekly deliveries",
                        "frequencyInterval": "WEEK",
                        "frequencyName": "Weekly Delivery",
                        "maxCycles": 52,
                        "minCycles": 4,
                        "planType": "PAY_AS_YOU_GO",
                        "upcomingOrderEmailBuffer": 3
                      },
                      {
                        "afterCycle1": 0,
                        "afterCycle2": 6,
                        "appstleCycles": [
                          {
                            "afterCycle": 12,
                            "discountType": "PERCENTAGE",
                            "repeatingCycle": true,
                            "value": 20.0
                          }
                        ],
                        "discountEnabled": true,
                        "discountEnabled2": true,
                        "discountOffer": 10.0,
                        "discountOffer2": 15.0,
                        "discountType": "PERCENTAGE",
                        "discountType2": "PERCENTAGE",
                        "frequencyCount": 1,
                        "frequencyDescription": "Convenient monthly shipments",
                        "frequencyInterval": "MONTH",
                        "frequencyName": "Monthly Delivery",
                        "planType": "PAY_AS_YOU_GO"
                      }
                    ],
                    "variantIds": "[{\"id\":123456789}]"
                  }
                },
                "Prepaid Quarterly Plan": {
                  "description": "Prepaid Quarterly Plan",
                  "value": {
                    "groupName": "Prepaid Quarterly Plans",
                    "productIds": "[{\"id\":987654321}]",
                    "subscriptionPlans": [
                      {
                        "discountEnabled": true,
                        "discountOffer": 20.0,
                        "discountType": "PERCENTAGE",
                        "frequencyCount": 1,
                        "frequencyDescription": "Pay for 3 months upfront and save 20%",
                        "frequencyInterval": "MONTH",
                        "frequencyName": "3-Month Prepaid",
                        "maxCycles": 12,
                        "payAsYouGoPrepaidBillingFrequencyCount": 3,
                        "planType": "PAY_AS_YOU_GO_PREPAID"
                      }
                    ]
                  }
                },
                "Simple Monthly Subscription": {
                  "description": "Simple Monthly Subscription",
                  "value": {
                    "groupName": "Monthly Coffee Subscription",
                    "productIds": "[{\"id\":987654321}]",
                    "subscriptionPlans": [
                      {
                        "afterCycle1": 0,
                        "discountEnabled": true,
                        "discountOffer": 10.0,
                        "discountType": "PERCENTAGE",
                        "frequencyCount": 1,
                        "frequencyDescription": "Fresh coffee delivered every month",
                        "frequencyInterval": "MONTH",
                        "frequencyName": "Delivered Monthly",
                        "minCycles": 3,
                        "planType": "PAY_AS_YOU_GO"
                      }
                    ]
                  }
                },
                "Specific Day Delivery": {
                  "description": "Specific Day Delivery",
                  "value": {
                    "groupName": "15th of Month Delivery",
                    "productIds": "[{\"id\":987654321}]",
                    "subscriptionPlans": [
                      {
                        "afterCycle1": 0,
                        "cutOff": 5,
                        "discountEnabled": true,
                        "discountOffer": 10.0,
                        "discountType": "PERCENTAGE",
                        "frequencyCount": 1,
                        "frequencyDescription": "Delivered on the 15th of every month",
                        "frequencyInterval": "MONTH",
                        "frequencyName": "Monthly on the 15th",
                        "frequencyType": "ON_SPECIFIC_DAY",
                        "planType": "PAY_AS_YOU_GO",
                        "specificDayEnabled": true,
                        "specificDayValue": 15
                      }
                    ]
                  }
                }
              },
              "schema": {
                "$ref": "#/components/schemas/SubscriptionGroupV2DTO"
              }
            }
          },
          "description": "Complete subscription group configuration including name, plans, and product assignments",
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "groupName": "Monthly Coffee Subscription",
                      "id": 123456789,
                      "productCount": 5,
                      "productIds": "[{\"id\":987654321,\"title\":\"Premium Coffee Blend\",\"status\":\"ACTIVE\"}]",
                      "productVariantCount": 15,
                      "subscriptionPlans": [
                        {
                          "afterCycle1": 0,
                          "afterCycle2": 3,
                          "billingFrequencyCount": 1,
                          "billingFrequencyInterval": "MONTH",
                          "discountEnabled": true,
                          "discountEnabled2": true,
                          "discountOffer": 10.0,
                          "discountOffer2": 15.0,
                          "discountType": "PERCENTAGE",
                          "discountType2": "PERCENTAGE",
                          "frequencyCount": 1,
                          "frequencyDescription": "Get fresh coffee delivered to your door every month",
                          "frequencyInterval": "MONTH",
                          "frequencyName": "Delivered Monthly",
                          "frequencySequence": 0,
                          "id": "gid://shopify/SellingPlan/111111",
                          "maxCycles": null,
                          "minCycles": 3,
                          "planType": "PAY_AS_YOU_GO"
                        }
                      ],
                      "variantIds": "[]"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionGroupV2DTO"
                }
              }
            },
            "description": "Subscription group successfully created"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "ID Already Exists": {
                    "description": "ID Already Exists",
                    "value": {
                      "detail": "A new subscriptionGroup cannot already have an ID",
                      "errorKey": "idexists",
                      "status": 400,
                      "title": "Bad Request",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Frequency Configuration": {
                    "description": "Invalid Frequency Configuration",
                    "value": {
                      "detail": "Frequency count must be greater than 0",
                      "status": 400,
                      "title": "Bad Request",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Missing Required Fields": {
                    "description": "Missing Required Fields",
                    "value": {
                      "detail": "Group name is required",
                      "status": 400,
                      "title": "Bad Request",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid request parameters or validation error"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Invalid or missing API key",
                  "status": 401,
                  "title": "Unauthorized",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required - missing or invalid API key"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "You do not have permission to create subscription groups",
                  "status": 403,
                  "title": "Forbidden",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to create subscription groups"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "Duplicate Plan Name": {
                    "description": "Duplicate Plan Name",
                    "value": {
                      "detail": "A selling plan group with this name already exists",
                      "status": 422,
                      "title": "Unprocessable Entity",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  },
                  "Shopify API Error": {
                    "description": "Shopify API Error",
                    "value": {
                      "detail": "Shopify API error: Product not found",
                      "status": 422,
                      "title": "Unprocessable Entity",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  }
                }
              }
            },
            "description": "Shopify API error or business rule violation"
          }
        },
        "summary": "Create a new subscription group (selling plan group)",
        "tags": [
          "Subscription Plans"
        ]
      },
      "put": {
        "description": "Updates an existing subscription group (selling plan group) including its name, selling plans configuration, and optionally manages product/variant assignments. This endpoint provides comprehensive update capabilities for both the subscription group structure and its product associations.\n\n**Key Capabilities:**\n- Update subscription group name\n- Modify existing selling plan configurations (discounts, frequencies, trials, etc.)\n- Add or remove products/variants through updateProducts and deleteProducts fields\n- Cannot add or remove selling plans - only modify existing ones\n- Automatically handles complex discount transitions for free trials and prepaid plans\n- Updates delivery profile associations if changed\n- Triggers asynchronous operations for metafield updates and free product checks\n\n**Important Notes:**\n- The 'id' field is required and must match an existing subscription group\n- For each selling plan in subscriptionPlans array, provide 'idNew' with the existing selling plan ID\n- Plan modifications maintain the same selling plan ID in Shopify\n- Product/variant updates are processed after group details are updated\n- Large product updates (allProduct=true) run asynchronously\n\n**Selling Plan Updates:**\n- Can change discount amounts, types, and cycles\n- Can modify billing/delivery frequencies\n- Can add/remove free trials\n- Can change member restrictions and tags\n- Can update specific day delivery settings\n- Can modify min/max cycles\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "updateSubscriptionGroupDetailsV2",
        "parameters": [
          {
            "description": "API Key for authentication",
            "example": "apst_your-api-key-here",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "examples": {
                "Add All Products from Collection": {
                  "description": "Add All Products from Collection",
                  "value": {
                    "groupName": "Coffee Collection Subscription",
                    "id": 123456789,
                    "subscriptionPlans": [
                      {
                        "afterCycle1": 0,
                        "discountEnabled": true,
                        "discountOffer": 15.0,
                        "discountType": "PERCENTAGE",
                        "frequencyCount": 1,
                        "frequencyDescription": "All coffee products eligible",
                        "frequencyInterval": "MONTH",
                        "frequencyName": "Monthly Coffee Box",
                        "idNew": "gid://shopify/SellingPlan/111111",
                        "planType": "PAY_AS_YOU_GO"
                      }
                    ],
                    "updateProducts": {
                      "allProduct": true,
                      "collectionId": "987654321"
                    }
                  }
                },
                "Add Free Trial to Existing Plan": {
                  "description": "Add Free Trial to Existing Plan",
                  "value": {
                    "groupName": "Try Before You Subscribe",
                    "id": 123456789,
                    "subscriptionPlans": [
                      {
                        "discountOffer": 100.0,
                        "discountOffer2": 10.0,
                        "freeTrialCount": 7,
                        "freeTrialEnabled": true,
                        "freeTrialInterval": "DAY",
                        "frequencyCount": 1,
                        "frequencyDescription": "Try free for 7 days",
                        "frequencyInterval": "MONTH",
                        "frequencyName": "Monthly with Trial",
                        "idNew": "gid://shopify/SellingPlan/111111",
                        "minCycles": 3,
                        "planType": "PAY_AS_YOU_GO"
                      }
                    ]
                  }
                },
                "Convert to Prepaid Plan": {
                  "description": "Convert to Prepaid Plan",
                  "value": {
                    "groupName": "Quarterly Prepaid Savings",
                    "id": 123456789,
                    "subscriptionPlans": [
                      {
                        "discountEnabled": true,
                        "discountOffer": 25.0,
                        "discountType": "PERCENTAGE",
                        "frequencyCount": 1,
                        "frequencyDescription": "Pay upfront for 3 months and save 25%",
                        "frequencyInterval": "MONTH",
                        "frequencyName": "3-Month Prepaid Plan",
                        "idNew": "gid://shopify/SellingPlan/111111",
                        "maxCycles": 12,
                        "payAsYouGoPrepaidBillingFrequencyCount": 3,
                        "planType": "PAY_AS_YOU_GO_PREPAID"
                      }
                    ]
                  }
                },
                "Update Group Name and Discount": {
                  "description": "Update Group Name and Discount",
                  "value": {
                    "groupName": "Premium Coffee Club - Updated",
                    "id": 123456789,
                    "subscriptionPlans": [
                      {
                        "afterCycle1": 0,
                        "discountEnabled": true,
                        "discountOffer": 15.0,
                        "discountType": "PERCENTAGE",
                        "frequencyCount": 1,
                        "frequencyDescription": "Updated description with better savings",
                        "frequencyInterval": "MONTH",
                        "frequencyName": "Monthly Delivery",
                        "idNew": "gid://shopify/SellingPlan/111111",
                        "minCycles": 3,
                        "planType": "PAY_AS_YOU_GO"
                      }
                    ]
                  }
                },
                "Update Member-Only Settings": {
                  "description": "Update Member-Only Settings",
                  "value": {
                    "groupName": "VIP Member Exclusive",
                    "id": 123456789,
                    "subscriptionPlans": [
                      {
                        "afterCycle1": 0,
                        "discountEnabled": true,
                        "discountOffer": 30.0,
                        "discountType": "PERCENTAGE",
                        "frequencyCount": 1,
                        "frequencyDescription": "Exclusive access for VIP members",
                        "frequencyInterval": "MONTH",
                        "frequencyName": "VIP Monthly Plan",
                        "idNew": "gid://shopify/SellingPlan/111111",
                        "memberExclusiveTags": "blocked,trial",
                        "memberInclusiveTags": "vip,platinum,gold,silver",
                        "memberOnly": true,
                        "planType": "PAY_AS_YOU_GO"
                      }
                    ]
                  }
                },
                "Update Multiple Plans with Product Changes": {
                  "description": "Update Multiple Plans with Product Changes",
                  "value": {
                    "deleteProducts": {
                      "productIds": [
                        987654321
                      ],
                      "variantIds": [
                        123456789
                      ]
                    },
                    "groupName": "Flexible Subscription Options",
                    "id": 123456789,
                    "subscriptionPlans": [
                      {
                        "afterCycle1": 0,
                        "discountEnabled": true,
                        "discountOffer": 20.0,
                        "discountType": "PERCENTAGE",
                        "frequencyCount": 1,
                        "frequencyDescription": "Maximum savings for frequent deliveries",
                        "frequencyInterval": "WEEK",
                        "frequencyName": "Weekly - Best Value",
                        "idNew": "gid://shopify/SellingPlan/111111",
                        "planType": "PAY_AS_YOU_GO"
                      },
                      {
                        "afterCycle1": 0,
                        "discountEnabled": true,
                        "discountOffer": 15.0,
                        "discountType": "PERCENTAGE",
                        "frequencyCount": 1,
                        "frequencyDescription": "Our most popular option",
                        "frequencyInterval": "MONTH",
                        "frequencyName": "Monthly - Popular",
                        "idNew": "gid://shopify/SellingPlan/222222",
                        "planType": "PAY_AS_YOU_GO"
                      }
                    ],
                    "updateProducts": {
                      "productDetails": "[{\"id\":987654323},{\"id\":987654324}]",
                      "variantDetails": "[{\"id\":123456790}]"
                    }
                  }
                },
                "Update with Complex Discount Cycles": {
                  "description": "Update with Complex Discount Cycles",
                  "value": {
                    "groupName": "Loyalty Rewards Program",
                    "id": 123456789,
                    "subscriptionPlans": [
                      {
                        "afterCycle1": 0,
                        "afterCycle2": 3,
                        "appstleCycles": [
                          {
                            "afterCycle": 6,
                            "discountType": "PERCENTAGE",
                            "value": 20.0
                          },
                          {
                            "afterCycle": 12,
                            "discountType": "FREE_PRODUCT",
                            "freeVariantId": 42549172011164,
                            "repeatingCycle": true,
                            "repeatingNumberOfCycle": 6
                          }
                        ],
                        "discountEnabled": true,
                        "discountEnabled2": true,
                        "discountOffer": 10.0,
                        "discountOffer2": 15.0,
                        "discountType": "PERCENTAGE",
                        "discountType2": "PERCENTAGE",
                        "frequencyCount": 1,
                        "frequencyDescription": "Increasing rewards for loyal customers",
                        "frequencyInterval": "MONTH",
                        "frequencyName": "Monthly Loyalty Plan",
                        "idNew": "gid://shopify/SellingPlan/111111",
                        "minCycles": 6,
                        "planType": "PAY_AS_YOU_GO"
                      }
                    ]
                  }
                }
              },
              "schema": {
                "$ref": "#/components/schemas/SubscriptionGroupV2DTO"
              }
            }
          },
          "description": "Complete subscription group update request including group details, selling plans, and optional product management",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "groupName": "Updated Monthly Coffee Subscription",
                      "id": 123456789,
                      "productCount": 8,
                      "productIds": "[{\"id\":987654321,\"title\":\"Premium Coffee Blend\",\"status\":\"ACTIVE\"}]",
                      "productVariantCount": 24,
                      "subscriptionPlans": [
                        {
                          "afterCycle1": 0,
                          "afterCycle2": 6,
                          "billingFrequencyCount": 1,
                          "billingFrequencyInterval": "MONTH",
                          "discountEnabled": true,
                          "discountEnabled2": true,
                          "discountOffer": 15.0,
                          "discountOffer2": 20.0,
                          "discountType": "PERCENTAGE",
                          "discountType2": "PERCENTAGE",
                          "frequencyCount": 1,
                          "frequencyDescription": "Fresh coffee delivered monthly with new pricing",
                          "frequencyInterval": "MONTH",
                          "frequencyName": "Updated Monthly Delivery",
                          "id": "gid://shopify/SellingPlan/111111",
                          "idNew": "gid://shopify/SellingPlan/111111",
                          "maxCycles": 24,
                          "minCycles": 3,
                          "planType": "PAY_AS_YOU_GO"
                        }
                      ],
                      "variantIds": "[{\"id\":123456789,\"title\":\"250g Bag\",\"status\":\"ACTIVE\"}]"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionGroupV2DTO"
                }
              }
            },
            "description": "Subscription group successfully updated"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Duplicate Group Name": {
                    "description": "Duplicate Group Name",
                    "value": {
                      "detail": "UserGeneratedError: A selling plan group with this name already exists",
                      "status": 400,
                      "title": "Bad Request",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Product Update": {
                    "description": "Invalid Product Update",
                    "value": {
                      "detail": "At least one of the Product Id(s) or Variant Id(s) is required",
                      "status": 400,
                      "title": "Bad Request",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Selling Plan": {
                    "description": "Invalid Selling Plan",
                    "value": {
                      "detail": "UserGeneratedError: Selling plan not found",
                      "status": 400,
                      "title": "Bad Request",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Missing ID": {
                    "description": "Missing ID",
                    "value": {
                      "detail": "Invalid id",
                      "errorKey": "idnull",
                      "status": 400,
                      "title": "Bad Request",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid request parameters or validation error"
          },
          "401": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionGroupV2DTO"
                }
              }
            },
            "description": "Authentication required - missing or invalid API key"
          },
          "403": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionGroupV2DTO"
                }
              }
            },
            "description": "Insufficient permissions to update subscription groups"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Subscription group with ID 999999 not found",
                  "status": 404,
                  "title": "Not Found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Subscription group not found"
          },
          "422": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "UserGeneratedError: Cannot update selling plan with active subscriptions",
                  "status": 422,
                  "title": "Unprocessable Entity",
                  "type": "https://example.com/errors/unprocessable-entity"
                }
              }
            },
            "description": "Shopify API error or business rule violation"
          }
        },
        "summary": "Update subscription group details and product assignments",
        "tags": [
          "Subscription Plans"
        ]
      }
    },
    "/api/external/v2/subscription-groups/all-selling-plans": {
      "get": {
        "description": "Retrieves a flattened list of all selling plans from all subscription groups in the store. This endpoint provides a consolidated view of every subscription plan available, regardless of which group it belongs to.\n\n**Response includes:**\n- All selling plans with their configurations\n- Group information for each plan (groupId and groupName)\n- Complete discount and pricing details\n- Delivery and billing frequencies\n- Member restrictions and settings\n- Free trial configurations\n\n**Use Cases:**\n- Build a unified subscription selector\n- Compare all available subscription options\n- Analyze pricing across all plans\n- Find specific plan configurations\n- Generate reports on subscription offerings\n\n**Differences from /subscription-groups endpoint:**\n- Returns plans as a flat list, not grouped\n- Each plan includes its parent group information\n- Easier to search/filter across all plans\n- Does not include product/variant assignments\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "getAllSellingPlansV2External",
        "parameters": [
          {
            "deprecated": true,
            "description": "API Key (Deprecated - Use X-API-Key header instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key for authentication",
            "example": "apst_your-api-key-here",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": [
                      {
                        "afterCycle1": 0,
                        "billingFrequencyCount": 1,
                        "billingFrequencyInterval": "MONTH",
                        "discountEnabled": true,
                        "discountOffer": 10.0,
                        "discountType": "PERCENTAGE",
                        "frequencyCount": 1,
                        "frequencyDescription": "Save 10% on monthly deliveries",
                        "frequencyInterval": "MONTH",
                        "frequencyName": "Delivered Monthly",
                        "frequencyType": "ON_PURCHASE_DAY",
                        "groupId": 123456789,
                        "groupName": "Monthly Coffee Subscription",
                        "id": "gid://shopify/SellingPlan/111111",
                        "inventoryPolicyReserve": "ON_SALE",
                        "maxCycles": null,
                        "memberOnly": false,
                        "minCycles": 3,
                        "planType": "PAY_AS_YOU_GO",
                        "upcomingOrderEmailBuffer": 3
                      },
                      {
                        "afterCycle1": 0,
                        "billingFrequencyCount": 1,
                        "billingFrequencyInterval": "WEEK",
                        "discountEnabled": true,
                        "discountOffer": 15.0,
                        "discountType": "PERCENTAGE",
                        "frequencyCount": 1,
                        "frequencyDescription": "Fresh tea every week with 15% savings",
                        "frequencyInterval": "WEEK",
                        "frequencyName": "Weekly Tea Box",
                        "groupId": 123456790,
                        "groupName": "Premium Tea Collection",
                        "id": "gid://shopify/SellingPlan/222222",
                        "planType": "PAY_AS_YOU_GO"
                      },
                      {
                        "afterCycle1": 0,
                        "billingFrequencyCount": 3,
                        "billingFrequencyInterval": "MONTH",
                        "discountEnabled": true,
                        "discountOffer": 25.0,
                        "discountType": "PERCENTAGE",
                        "frequencyCount": 1,
                        "frequencyDescription": "Pay upfront for 3 months and save 25%",
                        "frequencyInterval": "MONTH",
                        "frequencyName": "3-Month Prepaid Coffee",
                        "groupId": 123456789,
                        "groupName": "Monthly Coffee Subscription",
                        "id": "gid://shopify/SellingPlan/333333",
                        "maxCycles": 12,
                        "payAsYouGoPrepaidBillingFrequencyCount": 3,
                        "planType": "PAY_AS_YOU_GO_PREPAID",
                        "repeatingCycle": true,
                        "repeatingNumberOfCycle": 12
                      }
                    ]
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/FrequencyInfoDTO"
                }
              }
            },
            "description": "Successfully retrieved all selling plans"
          },
          "401": {
            "content": {
              "*/*": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/FrequencyInfoDTO"
                  },
                  "type": "array"
                }
              }
            },
            "description": "Authentication required - missing or invalid API key"
          },
          "403": {
            "content": {
              "*/*": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/FrequencyInfoDTO"
                  },
                  "type": "array"
                }
              }
            },
            "description": "Insufficient permissions to view selling plans"
          },
          "500": {
            "content": {
              "*/*": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/FrequencyInfoDTO"
                  },
                  "type": "array"
                }
              }
            },
            "description": "Internal server error"
          }
        },
        "summary": "Get all selling plans across all subscription groups",
        "tags": [
          "Subscription Plans"
        ]
      }
    },
    "/api/external/v2/subscription-groups/remove-products": {
      "put": {
        "description": "Removes specified products and/or variants from ALL subscription groups in the store. This is a powerful bulk operation that affects every subscription group simultaneously.\n\n**\u26a0\ufe0f WARNING:** This operation:\n- Affects ALL subscription groups in your store\n- Cannot be easily undone\n- Processes synchronously (may timeout for stores with many groups)\n- Does NOT affect existing active subscriptions\n\n**Use Cases:**\n- Discontinuing products from all subscription offerings\n- Removing seasonal items from all groups\n- Cleaning up deleted products from subscription groups\n- Compliance-driven product removals\n\n**Important Considerations:**\n- Each group is updated individually\n- If any group update fails, previous groups remain updated\n- Large operations may take significant time\n- Consider using individual group removal for better control\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "deleteProductsOrVariantsInAllSubscriptionGroupPlan",
        "parameters": [
          {
            "description": "Comma-separated list of product IDs to remove from all groups. Use numeric IDs without gid:// prefix.",
            "example": "987654321,987654322",
            "in": "query",
            "name": "productIds",
            "required": false,
            "schema": {
              "pattern": "^\\d+(,\\d+)*$",
              "type": "string"
            }
          },
          {
            "description": "Comma-separated list of variant IDs to remove from all groups. Use numeric IDs without gid:// prefix.",
            "example": "123456789,123456790",
            "in": "query",
            "name": "variantIds",
            "required": false,
            "schema": {
              "pattern": "^\\d+(,\\d+)*$",
              "type": "string"
            }
          },
          {
            "deprecated": true,
            "description": "API Key (Deprecated - Use X-API-Key header instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key for authentication",
            "example": "apst_your-api-key-here",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": "Product Deleted Successfully",
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Products/variants successfully removed from all subscription groups"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "No Products or Variants Provided": {
                    "description": "No Products or Variants Provided",
                    "value": {
                      "detail": "At least one of the Product Id(s) or Variant Id(s) is required",
                      "status": 400,
                      "title": "Bad Request",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid request parameters"
          },
          "401": {
            "content": {
              "*/*": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Authentication required - missing or invalid API key"
          },
          "403": {
            "content": {
              "*/*": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Insufficient permissions to modify subscription groups"
          },
          "500": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Error processing some subscription groups. Partial updates may have occurred.",
                  "status": 500,
                  "title": "Internal Server Error",
                  "type": "https://example.com/errors/internal-server-error"
                }
              }
            },
            "description": "Internal server error - some groups may have been updated"
          }
        },
        "summary": "Remove products or variants from ALL subscription groups",
        "tags": [
          "Subscription Plans"
        ]
      }
    },
    "/api/external/v2/subscription-groups/v3/{id}/add-products": {
      "post": {
        "description": "Same JSON body as the v2 bulk-add-products endpoint, but returns immediately with a 202 and processes the update in the background via an AWS Step Function worker instead of within the HTTP request. Use this for large batches (hundreds to thousands of IDs) that would otherwise risk hitting request/gateway timeouts. Poll GET /api/external/v2/subscription-groups/v3/{id}/add-products/status to check progress.\n\nOnly one such job may run per shop at a time; a second request while one is in progress is rejected with a 400.\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "addProductsOrVariantsAsync",
        "parameters": [
          {
            "description": "Subscription group ID (numeric ID)",
            "example": 123456789,
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "deprecated": true,
            "description": "API Key (Deprecated - Use X-API-Key header instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key for authentication",
            "example": "apst_your-api-key-here",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkAddProductsRequest"
              }
            }
          },
          "description": "Product and variant IDs to add to the subscription group",
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "*/*": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Job accepted and started in the background"
          },
          "400": {
            "content": {
              "*/*": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Invalid request, or a job for this shop is already in progress"
          },
          "401": {
            "content": {
              "*/*": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Authentication required - missing or invalid API key"
          },
          "404": {
            "content": {
              "*/*": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Subscription group not found"
          }
        },
        "summary": "Add products or variants to an existing subscription group (async)",
        "tags": [
          "Subscription Plans"
        ]
      }
    },
    "/api/external/v2/subscription-groups/v3/{id}/add-products/status": {
      "get": {
        "description": "Polls the status of a bulk add-products job started via POST .../add-products (v3 async endpoint). Only one such job runs per shop at a time; check 'subscriptionGroupId' and 'matchesRequestedGroup' in the response to confirm it's reporting on the group you submitted, in case a newer job for a different group has since started.\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "getAddProductsAsyncStatus",
        "parameters": [
          {
            "description": "Subscription group ID (numeric ID)",
            "example": 123456789,
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "deprecated": true,
            "description": "API Key (Deprecated - Use X-API-Key header instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key for authentication",
            "example": "apst_your-api-key-here",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "*/*": {
                "schema": {
                  "additionalProperties": {
                    "type": "object"
                  },
                  "type": "object"
                }
              }
            },
            "description": "OK"
          }
        },
        "summary": "Check status of an async add-products job",
        "tags": [
          "Subscription Plans"
        ]
      }
    },
    "/api/external/v2/subscription-groups/{id}": {
      "get": {
        "description": "Retrieves detailed information about a specific subscription group (selling plan group) by its ID. This endpoint provides complete configuration details for a single subscription group.\n\n**Response includes:**\n- Group name and configuration\n- All selling plans with complete details\n- Product and variant assignments\n- Discount tiers and configurations\n- Free trial settings\n- Member restrictions\n- Delivery and billing frequencies\n\n**Use Cases:**\n- Display detailed subscription options for editing\n- Verify configuration before updates\n- Debug subscription issues\n- Integration with external systems\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "getSubscriptionGroupV2External",
        "parameters": [
          {
            "description": "Subscription group ID (numeric ID)",
            "example": 123456789,
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "deprecated": true,
            "description": "API Key (Deprecated - Use X-API-Key header instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key for authentication",
            "example": "apst_your-api-key-here",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "groupName": "Monthly Coffee Subscription",
                      "id": 123456789,
                      "productCount": 10,
                      "productIds": "[{\"id\":987654321,\"title\":\"Premium Coffee Blend\",\"status\":\"ACTIVE\",\"handle\":\"premium-coffee-blend\",\"imageSrc\":\"https://cdn.shopify.com/...\",\"vendor\":\"Coffee Co\",\"tags\":\"coffee,subscription\",\"productType\":\"Coffee\",\"price\":\"19.99\"}]",
                      "productVariantCount": 35,
                      "subscriptionPlans": [
                        {
                          "afterCycle1": 0,
                          "afterCycle2": 6,
                          "appstleCycles": [],
                          "billingFrequencyCount": 1,
                          "billingFrequencyInterval": "MONTH",
                          "deliveryPolicyPreAnchorBehavior": "ASAP",
                          "discountEnabled": true,
                          "discountEnabled2": true,
                          "discountOffer": 10.0,
                          "discountOffer2": 15.0,
                          "discountType": "PERCENTAGE",
                          "discountType2": "PERCENTAGE",
                          "freeTrialEnabled": false,
                          "frequencyCount": 1,
                          "frequencyDescription": "Get fresh coffee delivered to your door every month",
                          "frequencyInterval": "MONTH",
                          "frequencyName": "Delivered Monthly",
                          "frequencySequence": 0,
                          "frequencyType": "ON_PURCHASE_DAY",
                          "groupId": 123456789,
                          "groupName": "Monthly Coffee Subscription",
                          "id": "gid://shopify/SellingPlan/111111",
                          "idNew": "gid://shopify/SellingPlan/111111",
                          "inventoryPolicyReserve": "ON_SALE",
                          "maxCycles": null,
                          "memberOnly": false,
                          "minCycles": 3,
                          "planType": "PAY_AS_YOU_GO",
                          "specificDayEnabled": false,
                          "upcomingOrderEmailBuffer": 3
                        }
                      ],
                      "variantIds": "[{\"id\":123456789,\"title\":\"250g Bag\",\"status\":\"ACTIVE\"}]"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionGroupV2DTO"
                }
              }
            },
            "description": "Successfully retrieved subscription group"
          },
          "401": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionGroupV2DTO"
                }
              }
            },
            "description": "Authentication required - missing or invalid API key"
          },
          "403": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionGroupV2DTO"
                }
              }
            },
            "description": "Insufficient permissions to view subscription groups"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Subscription group with ID 999999 not found",
                  "status": 404,
                  "title": "Not Found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Subscription group not found"
          }
        },
        "summary": "Get subscription group by ID",
        "tags": [
          "Subscription Plans"
        ]
      }
    },
    "/api/external/v2/subscription-groups/{id}/add-products": {
      "put": {
        "description": "Adds one or more products and/or product variants to an existing subscription group (selling plan group). This endpoint provides a simple way to expand the product catalog eligible for subscription without modifying the group's configuration or existing product assignments.\n\n**Key Features:**\n- Add multiple products and variants in a single request\n- Preserves existing product and variant assignments\n- Maintains the order of products as provided\n- Updates delivery profiles automatically if needed\n- Synchronously updates Shopify and returns the updated group\n- Optional response enhancement with added products information\n\n**Important Notes:**\n- Product IDs should be numeric Shopify product IDs without the gid:// prefix\n- Variant IDs should be numeric Shopify variant IDs without the gid:// prefix\n- Adding products also makes all their variants eligible for subscription\n- Adding specific variants limits subscription eligibility to those variants only\n- Duplicate products/variants are handled gracefully by Shopify\n- URL length limits apply to the comma-separated lists (use bulk endpoint for large additions)\n- Include 'x-return-short-response: true' header to get only added products/variants information in response\n\n**Use Cases:**\n- Launch new products with subscription options\n- Add seasonal items to existing subscription groups\n- Enable subscription for specific product variants\n- Expand subscription eligibility without changing plan configurations\n- Track which products were added in the current request\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "addProductsOrVariants",
        "parameters": [
          {
            "description": "Subscription group ID (numeric ID)",
            "example": 123456789,
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "deprecated": true,
            "description": "API Key (Deprecated - Use X-API-Key header instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key for authentication",
            "example": "apst_your-api-key-here",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Comma-separated list of Shopify product IDs to add. Adding a product makes all its variants eligible for subscription. Use numeric IDs only (e.g., '987654321,987654322,987654323')",
            "example": "987654321,987654322,987654323",
            "in": "query",
            "name": "productIds",
            "required": false,
            "schema": {
              "pattern": "^\\d+(,\\d+)*$",
              "type": "string"
            }
          },
          {
            "description": "Comma-separated list of Shopify variant IDs to add. Use this to enable subscription for specific variants only. Use numeric IDs only (e.g., '123456789,123456790,123456791')",
            "example": "123456789,123456790",
            "in": "query",
            "name": "variantIds",
            "required": false,
            "schema": {
              "pattern": "^\\d+(,\\d+)*$",
              "type": "string"
            }
          },
          {
            "description": "Header to indicate if response should return only added products ID information. Set to 'true' for minimal response, any other value or omitted for full response.",
            "example": false,
            "in": "header",
            "name": "x-return-short-response",
            "required": false,
            "schema": {
              "default": false,
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response (Standard)": {
                    "description": "Success Response (Standard)",
                    "value": {
                      "groupName": "Monthly Coffee Subscription",
                      "id": 123456789,
                      "productCount": 10,
                      "productIds": "[{\"id\":987654321,\"title\":\"Premium Coffee Blend\"},{\"id\":987654322,\"title\":\"Organic Dark Roast\"},{\"id\":987654323,\"title\":\"Colombian Single Origin\"}]",
                      "productVariantCount": 35,
                      "subscriptionPlans": [
                        {
                          "discountEnabled": true,
                          "discountOffer": 10.0,
                          "discountType": "PERCENTAGE",
                          "frequencyCount": 1,
                          "frequencyDescription": "Get fresh coffee delivered to your door every month",
                          "frequencyInterval": "MONTH",
                          "frequencyName": "Delivered Monthly",
                          "id": "gid://shopify/SellingPlan/111111",
                          "planType": "PAY_AS_YOU_GO"
                        }
                      ],
                      "variantIds": "[{\"id\":123456789,\"title\":\"250g Bag\"},{\"id\":123456790,\"title\":\"500g Bag\"}]"
                    }
                  },
                  "Success Response (with x-return-short-response header)": {
                    "description": "Success Response (with x-return-short-response header)",
                    "value": {
                      "addedProductIds": [
                        987654321,
                        987654322
                      ],
                      "addedVariantIds": [
                        123456789
                      ]
                    }
                  }
                },
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/SubscriptionGroupV2DTO"
                    },
                    {
                      "$ref": "#/components/schemas/AddedProductsResponseDTO"
                    }
                  ]
                }
              }
            },
            "description": "Products/variants successfully added to subscription group"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Invalid Product Format": {
                    "description": "Invalid Product Format",
                    "value": {
                      "detail": "Invalid product ID format. Use numeric IDs only.",
                      "status": 400,
                      "title": "Bad Request",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Invalid Subscription Group ID": {
                    "description": "Invalid Subscription Group ID",
                    "value": {
                      "detail": "Invalid id",
                      "errorKey": "idnull",
                      "status": 400,
                      "title": "Bad Request",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "No Products or Variants Provided": {
                    "description": "No Products or Variants Provided",
                    "value": {
                      "detail": "At least one of the Product Id(s) or Variant Id(s) is required",
                      "status": 400,
                      "title": "Bad Request",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid request parameters"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Invalid or missing API key",
                  "status": 401,
                  "title": "Unauthorized",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required - missing or invalid API key"
          },
          "403": {
            "content": {
              "*/*": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Insufficient permissions to modify subscription groups"
          },
          "404": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Subscription group with ID 999999 not found",
                  "status": 404,
                  "title": "Not Found",
                  "type": "https://example.com/errors/not-found"
                }
              }
            },
            "description": "Subscription group not found"
          },
          "422": {
            "content": {
              "application/json": {
                "examples": {
                  "Product Not Found": {
                    "description": "Product Not Found",
                    "value": {
                      "detail": "Product with ID 987654321 not found in Shopify",
                      "status": 422,
                      "title": "Unprocessable Entity",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  },
                  "Variant Not Found": {
                    "description": "Variant Not Found",
                    "value": {
                      "detail": "Product variant with ID 123456789 not found",
                      "status": 422,
                      "title": "Unprocessable Entity",
                      "type": "https://example.com/errors/unprocessable-entity"
                    }
                  }
                }
              }
            },
            "description": "Shopify API error"
          }
        },
        "summary": "Add products or variants to an existing subscription group",
        "tags": [
          "Subscription Plans"
        ]
      }
    },
    "/api/external/v2/subscription-groups/{id}/bulk-add-products": {
      "post": {
        "description": "Adds multiple products and/or product variants to an existing subscription group (selling plan group) using a JSON request body. This endpoint is ideal for adding large numbers of products/variants that would exceed URL length limits in the query parameter version.\n\n**Advantages over query parameter endpoint:**\n- No URL length restrictions\n- Cleaner syntax for large lists\n- Better for programmatic integrations\n- Supports the same functionality with improved scalability\n\n**Behavior:**\n- Identical to the query parameter endpoint in functionality\n- Adds products/variants to existing assignments\n- Preserves product order\n- Updates synchronously and returns the updated group \u2014 for very large batches (thousands of IDs) that risk request/gateway timeouts, use the async v3 endpoint (POST /api/external/v2/subscription-groups/v3/{id}/add-products) instead\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "bulkAddProductsOrVariants",
        "parameters": [
          {
            "description": "Subscription group ID (numeric ID)",
            "example": 123456789,
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "deprecated": true,
            "description": "API Key (Deprecated - Use X-API-Key header instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key for authentication",
            "example": "apst_your-api-key-here",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "examples": {
                "Add Both Products and Variants": {
                  "description": "Add Both Products and Variants",
                  "value": {
                    "productIds": [
                      987654321,
                      987654322,
                      987654323
                    ],
                    "variantIds": [
                      123456789,
                      123456790,
                      123456791
                    ]
                  }
                },
                "Add Multiple Products": {
                  "description": "Add Multiple Products",
                  "value": {
                    "productIds": [
                      987654321,
                      987654322,
                      987654323,
                      987654324,
                      987654325
                    ],
                    "variantIds": []
                  }
                },
                "Add Specific Variants": {
                  "description": "Add Specific Variants",
                  "value": {
                    "productIds": [],
                    "variantIds": [
                      123456789,
                      123456790,
                      123456791,
                      123456792
                    ]
                  }
                },
                "Large Bulk Addition": {
                  "description": "Large Bulk Addition",
                  "value": {
                    "productIds": [
                      987654321,
                      987654322,
                      987654323,
                      987654324,
                      987654325,
                      987654326,
                      987654327,
                      987654328,
                      987654329,
                      987654330,
                      987654331,
                      987654332,
                      987654333,
                      987654334,
                      987654335,
                      987654336,
                      987654337,
                      987654338,
                      987654339,
                      987654340
                    ],
                    "variantIds": [
                      123456789,
                      123456790,
                      123456791,
                      123456792,
                      123456793,
                      123456794,
                      123456795,
                      123456796,
                      123456797,
                      123456798
                    ]
                  }
                }
              },
              "schema": {
                "$ref": "#/components/schemas/BulkAddProductsRequest"
              }
            }
          },
          "description": "Product and variant IDs to add to the subscription group",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "*/*": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Products/variants successfully added"
          },
          "400": {
            "content": {
              "*/*": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Invalid request"
          },
          "401": {
            "content": {
              "*/*": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "*/*": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Insufficient permissions"
          },
          "404": {
            "content": {
              "*/*": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Subscription group not found"
          },
          "422": {
            "content": {
              "*/*": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Shopify API error"
          }
        },
        "summary": "Bulk add products or variants to an existing subscription group",
        "tags": [
          "Subscription Plans"
        ]
      }
    },
    "/api/external/v2/subscription-groups/{id}/remove-products": {
      "put": {
        "description": "Removes specified products and/or variants from an existing subscription group (selling plan group). This endpoint allows selective removal of products without affecting the group's configuration or other product assignments.\n\n**Key Features:**\n- Remove multiple products and variants in a single request\n- Remove all products from a specific collection\n- Silently ignores products/variants not currently in the group\n- Preserves subscription group configuration and settings\n- Updates synchronously and returns the modified group\n\n**Collection Removal:**\n- When collectionId is provided, fetches and removes all products from that collection\n- Collection processing is limited to 5000 products maximum\n- Collection removal is additive to any explicitly specified productIds/variantIds\n\n**Important Notes:**\n- Removing products does NOT affect existing active subscriptions\n- Can remove all products, leaving an empty subscription group\n- Products/variants not in the group are silently ignored\n- Use numeric IDs without gid:// prefix for products and variants\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "deleteProductsOrVariantsV2",
        "parameters": [
          {
            "description": "Subscription group ID (numeric ID)",
            "example": 123456789,
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "Comma-separated list of product IDs to remove. Use numeric IDs without gid:// prefix.",
            "example": "987654321,987654322",
            "in": "query",
            "name": "productIds",
            "required": false,
            "schema": {
              "pattern": "^\\d+(,\\d+)*$",
              "type": "string"
            }
          },
          {
            "description": "Comma-separated list of variant IDs to remove. Use numeric IDs without gid:// prefix.",
            "example": "123456789,123456790",
            "in": "query",
            "name": "variantIds",
            "required": false,
            "schema": {
              "pattern": "^\\d+(,\\d+)*$",
              "type": "string"
            }
          },
          {
            "description": "Shopify collection ID. When provided, removes all products from this collection (up to 5000 products). This is in addition to any explicitly specified productIds/variantIds.",
            "example": 287654321,
            "in": "query",
            "name": "collectionId",
            "required": false,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "Set to true to delete all products and their variants. Defaults to false.",
            "example": false,
            "in": "query",
            "name": "deleteAllProductsAndVariants",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "deprecated": true,
            "description": "API Key (Deprecated - Use X-API-Key header instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key for authentication",
            "example": "apst_your-api-key-here",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "groupName": "Monthly Coffee Subscription",
                      "id": 123456789,
                      "productCount": 5,
                      "productIds": "[{\"id\":987654322,\"title\":\"Organic Dark Roast\"},{\"id\":987654323,\"title\":\"Colombian Single Origin\"}]",
                      "productVariantCount": 15,
                      "subscriptionPlans": [
                        {
                          "discountEnabled": true,
                          "discountOffer": 10.0,
                          "discountType": "PERCENTAGE",
                          "frequencyCount": 1,
                          "frequencyDescription": "Get fresh coffee delivered to your door every month",
                          "frequencyInterval": "MONTH",
                          "frequencyName": "Delivered Monthly",
                          "id": "gid://shopify/SellingPlan/111111"
                        }
                      ],
                      "variantIds": "[{\"id\":123456790,\"title\":\"500g Bag\"}]"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionGroupV2DTO"
                }
              }
            },
            "description": "Products/variants successfully removed from subscription group"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Invalid Subscription Group ID": {
                    "description": "Invalid Subscription Group ID",
                    "value": {
                      "detail": "Invalid id",
                      "errorKey": "idnull",
                      "status": 400,
                      "title": "Bad Request",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "No Products or Variants Provided": {
                    "description": "No Products or Variants Provided",
                    "value": {
                      "detail": "At least one of the Product Id(s) or Variant Id(s) is required",
                      "status": 400,
                      "title": "Bad Request",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid request parameters"
          },
          "401": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionGroupV2DTO"
                }
              }
            },
            "description": "Authentication required - missing or invalid API key"
          },
          "403": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionGroupV2DTO"
                }
              }
            },
            "description": "Insufficient permissions to modify subscription groups"
          },
          "404": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionGroupV2DTO"
                }
              }
            },
            "description": "Subscription group not found"
          }
        },
        "summary": "Remove products or variants from a subscription group",
        "tags": [
          "Subscription Plans"
        ]
      }
    },
    "/api/external/v2/theme-settings/regenerate-scripts-for-shop": {
      "get": {
        "description": "Triggers regeneration and deployment of subscription widget JavaScript files for the authenticated shop. This endpoint rebuilds the widget scripts that power subscription functionality on your storefront and deploys them to CDN.\n\n**What Does This Endpoint Do?**\nThis endpoint initiates an asynchronous process to regenerate and update the JavaScript files that enable subscription widgets on your store's theme. The widget scripts handle:\n- Subscription product selection and display\n- Subscription plan offerings on product pages\n- Frequency and delivery interval selectors\n- Subscription pricing display\n- Add-to-cart subscription functionality\n- Widget styling and customization\n\n**When to Use This Endpoint:**\n\n**1. After Widget Settings Changes:**\n- Modified widget appearance or styling\n- Changed subscription plan display options\n- Updated widget text or labels\n- Altered widget positioning or layout\n- Changed frequency options display\n\n**2. After Theme Customization:**\n- Installed a new theme\n- Updated existing theme\n- Made CSS customizations affecting widgets\n- Changed theme structure requiring widget updates\n\n**3. After Plan Configuration Changes:**\n- Added new subscription plans\n- Modified existing plan details\n- Changed plan pricing or discounts\n- Updated plan availability rules\n\n**4. Troubleshooting:**\n- Widget not displaying correctly on storefront\n- Subscription options showing outdated information\n- Widget functionality broken after theme changes\n- Script conflicts or errors on product pages\n- Cache issues preventing updates from showing\n\n**5. After App Updates:**\n- Appstle subscription app has been upgraded\n- New widget features have been released\n- Bug fixes requiring script updates\n\n**How It Works:**\n\n1. **Initiation**: API call triggers the script regeneration process\n2. **Compilation**: System compiles widget configuration, theme settings, and subscription plans into optimized JavaScript\n3. **Deployment**: Generated scripts are uploaded to CDN for fast global delivery\n4. **Cache Invalidation**: Old cached versions are invalidated\n5. **Completion**: Updated scripts become available to your storefront (typically within 1-2 minutes)\n\n**What Gets Regenerated:**\n- **Widget JavaScript**: Core widget functionality and UI components\n- **Configuration Data**: Embedded shop-specific settings and plan information\n- **Styling Rules**: Custom CSS and theme-specific styles\n- **Initialization Code**: Auto-load and widget mounting logic\n- **Event Handlers**: Customer interaction and analytics tracking\n\n**Process Details:**\n- **Asynchronous**: The regeneration happens in the background\n- **Non-blocking**: Endpoint returns immediately (true on success)\n- **No downtime**: Existing widgets continue working during regeneration\n- **Automatic deployment**: Scripts are automatically deployed to CDN\n- **Versioning**: New script versions don't break existing functionality\n\n**Expected Behavior:**\n- Endpoint returns `true` immediately to confirm process started\n- Script regeneration completes in background (typically 30-90 seconds)\n- Updated scripts propagate to CDN (1-2 minutes)\n- Browser cache may need clearing to see changes immediately\n- Changes visible to customers after cache expiration (varies by browser)\n\n**Use Cases:**\n- **Automated Deployments**: Include in CI/CD pipeline after theme updates\n- **Widget Troubleshooting**: Force refresh when widget issues occur\n- **Configuration Sync**: Ensure widgets reflect latest settings after bulk changes\n- **Theme Migration**: Update scripts after moving to new theme\n- **Testing**: Regenerate scripts after making configuration changes in staging\n- **Maintenance**: Periodic regeneration to ensure optimal performance\n\n**Important Notes:**\n- Safe to call multiple times (idempotent operation)\n- No negative impact on existing subscriptions\n- Does not modify theme files directly\n- Scripts are hosted on CDN, not in your theme\n- Changes apply to all store pages using subscription widgets\n- Browser caching may delay visibility of changes to end users\n\n**Best Practices:**\n- Call this endpoint after making widget setting changes\n- Wait 2-3 minutes before testing changes on storefront\n- Clear browser cache when testing to see latest version\n- Use in test/staging environment before production\n- Avoid calling excessively (once per configuration change is sufficient)\n- Monitor widget functionality after regeneration\n\n**Troubleshooting:**\nIf widgets still don't reflect changes after regeneration:\n1. Wait 5 minutes for full CDN propagation\n2. Clear browser cache and hard refresh (Ctrl+Shift+R / Cmd+Shift+R)\n3. Check browser console for JavaScript errors\n4. Verify theme has widget embed code installed\n5. Confirm subscription plans are properly configured\n6. Test in incognito/private browsing mode\n\n**Integration Workflows:**\n\n**Theme Update Workflow:**\n1. Make theme changes\n2. Update widget settings if needed\n3. Call regenerate-scripts endpoint\n4. Wait 2-3 minutes\n5. Test widgets on storefront\n6. Deploy to production\n\n**Bulk Configuration Update:**\n1. Update multiple subscription plans\n2. Modify widget appearance settings\n3. Call regenerate-scripts once (not after each change)\n4. Verify changes propagated correctly\n\n**Authentication:** Requires valid API key via api_key parameter or X-API-Key header",
        "operationId": "regenerateScriptForShop",
        "parameters": [
          {
            "description": "API Key (Deprecated - Use Header X-API-Key instead)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": true
                  }
                },
                "schema": {
                  "type": "boolean"
                }
              }
            },
            "description": "Script regeneration initiated successfully. Returns true to confirm the process has started. Scripts will be regenerated asynchronously in the background and deployed to CDN within 1-2 minutes."
          },
          "400": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Shop theme settings are not properly configured",
                  "status": 400,
                  "title": "Invalid configuration",
                  "type": "https://example.com/errors/bad-request"
                }
              }
            },
            "description": "Bad request - Invalid shop configuration or missing required settings"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Valid API key is required. Provide via api_key parameter or X-API-Key header.",
                  "status": 401,
                  "title": "Authentication required",
                  "type": "https://example.com/errors/unauthorized"
                }
              }
            },
            "description": "Authentication required - Missing or invalid API key"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "API key does not have permission to regenerate theme scripts",
                  "status": 403,
                  "title": "Insufficient permissions",
                  "type": "https://example.com/errors/forbidden"
                }
              }
            },
            "description": "Insufficient permissions to regenerate scripts"
          },
          "429": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Too many script regeneration requests. Please wait before trying again.",
                  "retryAfter": 60,
                  "status": 429,
                  "title": "Rate limit exceeded",
                  "type": "https://example.com/errors/rate-limit"
                }
              }
            },
            "description": "Rate limit exceeded - Too many regeneration requests"
          },
          "500": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Unable to initiate script regeneration process. Please try again or contact support.",
                  "status": 500,
                  "title": "Script regeneration failed",
                  "type": "https://example.com/errors/internal-error"
                }
              }
            },
            "description": "Internal server error - Script regeneration failed to initiate"
          }
        },
        "summary": "Regenerate subscription widget scripts",
        "tags": [
          "Customization",
          "Customer Portal"
        ]
      }
    },
    "/api/external/v2/upcoming-subscription-contract-one-offs-by-contractId": {
      "get": {
        "description": "Retrieves one-time products that will be included in the next scheduled order for a subscription contract. This endpoint specifically returns products associated with the earliest queued billing attempt, making it ideal for showing customers what additional items will be in their next delivery.\n\n**Key Differences from /subscription-contract-one-offs-by-contractId:**\n- Returns ONLY products for the next upcoming order (not all future orders)\n- Finds the earliest QUEUED billing attempt by date\n- Returns empty array if no queued billing attempts exist\n- Useful for \"Your Next Order\" previews in customer portals\n\n**Use Cases:**\n- Display a preview of the next order including one-time add-ons\n- Calculate the total cost of the upcoming delivery\n- Show customers their next delivery date with associated one-time items\n- Allow last-minute modifications before order processing\n\n**Business Logic:**\n1. Searches for billing attempts with status = QUEUED\n2. Selects the one with the earliest billing date\n3. Returns all one-time products for that specific billing attempt\n4. Returns empty array if no queued orders exist (e.g., subscription paused/cancelled)\n\n**Authentication:** Requires valid X-API-Key header that identifies the shop",
        "operationId": "getOneOffForContractNextOrderExternal",
        "parameters": [
          {
            "deprecated": true,
            "description": "API Key (Deprecated - Use X-API-Key header instead)",
            "example": "apst_your-api-key-here",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key for authentication. This key identifies your shop and must be included in the X-API-Key header.",
            "example": "apst_your-api-key-here",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "The unique identifier of the subscription contract to retrieve upcoming one-time products for",
            "example": 98765,
            "in": "query",
            "name": "contractId",
            "required": true,
            "schema": {
              "description": "Must be a valid contract ID that belongs to the authenticated shop",
              "format": "int64",
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Next Order Has Multiple One-Time Products": {
                    "description": "The next order (billing attempt 54321) has two one-time products added",
                    "value": [
                      {
                        "billingAttemptId": 54321,
                        "id": 12345,
                        "price": 19.99,
                        "quantity": 2,
                        "shop": "example-store.myshopify.com",
                        "subscriptionContractId": 98765,
                        "variantHandle": "premium-coffee-blend-500g",
                        "variantId": 42549172011164
                      },
                      {
                        "billingAttemptId": 54321,
                        "id": 12346,
                        "price": 8.99,
                        "quantity": 1,
                        "shop": "example-store.myshopify.com",
                        "subscriptionContractId": 98765,
                        "variantHandle": "coffee-filters-pack-100",
                        "variantId": 42549172011165
                      }
                    ]
                  },
                  "Next Order Has No One-Time Products": {
                    "description": "The next order exists but has no one-time products added",
                    "value": []
                  },
                  "No Upcoming Orders": {
                    "description": "No queued billing attempts exist - subscription may be paused, cancelled, or all orders processed",
                    "value": []
                  },
                  "Single One-Time Product": {
                    "description": "Customer added a limited edition item to their next delivery",
                    "value": [
                      {
                        "billingAttemptId": 54323,
                        "id": 12347,
                        "price": 24.99,
                        "quantity": 1,
                        "shop": "example-store.myshopify.com",
                        "subscriptionContractId": 98765,
                        "variantHandle": "limited-edition-seasonal-blend",
                        "variantId": 42549172011166
                      }
                    ]
                  }
                },
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/SubscriptionContractOneOffDTO"
                  },
                  "type": "array"
                }
              }
            },
            "description": "Successfully retrieved one-time products for the next order"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Invalid Contract ID Format": {
                    "description": "Invalid Contract ID Format",
                    "value": {
                      "detail": "Failed to convert value of type 'java.lang.String' to required type 'java.lang.Long'; For input string: 'invalid'",
                      "instance": "/api/external/v2/upcoming-subscription-contract-one-offs-by-contractId",
                      "status": 400,
                      "title": "Bad Request",
                      "type": "https://example.com/probs/bad-request"
                    }
                  },
                  "Missing Contract ID": {
                    "description": "Missing Contract ID",
                    "value": {
                      "detail": "Required request parameter 'contractId' for method parameter type Long is not present",
                      "instance": "/api/external/v2/upcoming-subscription-contract-one-offs-by-contractId",
                      "status": 400,
                      "title": "Bad Request",
                      "type": "https://example.com/probs/bad-request"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request parameters"
          },
          "401": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Full authentication is required to access this resource",
                  "instance": "/api/external/v2/upcoming-subscription-contract-one-offs-by-contractId",
                  "status": 401,
                  "title": "Unauthorized",
                  "type": "https://example.com/probs/unauthorized"
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Authentication required - missing or invalid API key"
          },
          "403": {
            "content": {
              "application/json": {
                "example": {
                  "detail": "Access is denied - contract does not belong to authenticated shop",
                  "instance": "/api/external/v2/upcoming-subscription-contract-one-offs-by-contractId",
                  "status": 403,
                  "title": "Forbidden",
                  "type": "https://example.com/probs/forbidden"
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Forbidden - API key doesn't have permission to access this contract"
          }
        },
        "summary": "Get one-time products for next upcoming order",
        "tags": [
          "Subscription One-Time Products"
        ]
      }
    },
    "/api/external/v2/update-custom-note-attributes": {
      "post": {
        "description": "Updates or replaces custom key-value attributes on a subscription contract. These attributes are stored with the subscription and can be used to track custom data, preferences, or metadata that's important for your business processes.\n\n**Custom Attributes Overview:**\nCustom attributes are key-value pairs that allow you to store additional information on subscriptions. They are:\n- Visible in the Shopify admin and accessible via API\n- Included in order data when subscription orders are created\n- Preserved across subscription lifecycle events\n- Useful for integrations and custom workflows\n\n**Update Modes:**\n- **Merge Mode (overwriteExistingAttributes=false)**: Adds new attributes and updates existing ones with matching keys. Other attributes remain unchanged.\n- **Replace Mode (overwriteExistingAttributes=true)**: Completely replaces all existing attributes with the provided list.\n\n**Common Use Cases:**\n- Store gift messages or special instructions\n- Track referral sources or marketing campaigns\n- Add internal reference numbers or tracking codes\n- Store customer preferences or customization options\n- Integration data for third-party systems\n\n**Important Notes:**\n- Attribute keys should not conflict with Shopify's reserved attributes\n- Both keys and values are stored as strings\n- Changes are logged in the activity history\n- Invalid discount codes may be automatically removed during update\n\n**Authentication:** Requires valid X-API-Key header",
        "operationId": "updateOrderNoteAttributes",
        "parameters": [
          {
            "deprecated": true,
            "description": "API Key (Deprecated)",
            "in": "query",
            "name": "api_key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "API Key",
            "in": "header",
            "name": "X-API-Key",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Merge or replace mode",
            "in": "query",
            "name": "overwriteExistingAttributes",
            "required": false,
            "schema": {
              "default": true,
              "type": "boolean"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateAttributesRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "examples": {
                  "Success Response": {
                    "description": "Success Response",
                    "value": {
                      "message": "Attributes updated successfully"
                    }
                  }
                }
              }
            },
            "description": "Attributes successfully updated"
          },
          "400": {
            "content": {
              "application/json": {
                "examples": {
                  "Contract Not Found": {
                    "description": "Contract Not Found",
                    "value": {
                      "detail": "No subscription contract found with the specified ID",
                      "status": 400,
                      "title": "UserGeneratedError:Subscription contract not found",
                      "type": "https://example.com/errors/bad-request"
                    }
                  },
                  "Missing Contract ID": {
                    "description": "Missing Contract ID",
                    "value": {
                      "detail": "Subscription contract ID is required",
                      "status": 400,
                      "title": "Validation Error",
                      "type": "https://example.com/errors/bad-request"
                    }
                  }
                }
              }
            },
            "description": "Invalid request parameters"
          },
          "401": {
            "description": "Authentication required - missing or invalid API key"
          },
          "403": {
            "description": "Insufficient permissions to update subscription contracts"
          }
        },
        "summary": "Update custom attributes on a subscription contract",
        "tags": [
          "Subscription Management",
          "Subscription Contracts"
        ]
      }
    }
  },
  "servers": [
    {
      "url": "https://subscription-admin.appstle.com"
    }
  ],
  "tags": [
    {
      "description": "Core APIs for managing the complete subscription lifecycle including creation, updates, pausing, resuming, and cancellation of subscriptions.",
      "name": "Subscription Management"
    },
    {
      "description": "APIs for managing subscription payment methods, processing payments, handling payment retries, and updating billing information.",
      "name": "Subscription Payments"
    },
    {
      "description": "APIs for managing subscription contracts including delivery schedules, pricing, order notes, billing cycles, and shipping addresses.",
      "name": "Subscription Contracts"
    },
    {
      "description": "APIs for managing products within subscriptions including adding, removing, updating quantities, and swapping products.",
      "name": "Subscription Products"
    },
    {
      "description": "APIs for handling billing operations, payment processing, and financial transactions related to subscriptions.",
      "name": "Billing & Payments"
    },
    {
      "description": "APIs for managing discounts and promotional codes applied to subscriptions.",
      "name": "Subscription Discounts"
    },
    {
      "description": "APIs for managing one-time add-on products that can be purchased alongside recurring subscription items.",
      "name": "Subscription One-Time Products"
    },
    {
      "description": "APIs for managing subscription plans, pricing tiers, and plan configurations.",
      "name": "Subscription Plans"
    },
    {
      "description": "APIs for managing customizable product boxes and bundles where customers can select multiple items.",
      "name": "Build-a-Box & Bundles"
    },
    {
      "description": "APIs for managing the product catalog including product information, variants, and inventory.",
      "name": "Product Catalog"
    },
    {
      "description": "APIs for managing operational settings, configurations, and administrative functions.",
      "name": "Operations & Settings"
    },
    {
      "description": "APIs powering the customer-facing portal where subscribers can manage their own subscriptions.",
      "name": "Customer Portal"
    },
    {
      "description": "APIs for managing customer information, profiles, and account details.",
      "name": "Customers"
    },
    {
      "description": "APIs for retrieving aggregated subscription data, customer subscription history, and account-level subscription information.",
      "name": "Subscription Data"
    },
    {
      "description": "APIs for managing delivery profiles, shipping rates, free shipping configuration, and delivery method options on subscriptions.",
      "name": "Delivery & Shipping"
    },
    {
      "description": "APIs for managing storefront customization including custom CSS, theme settings, label translations, and merchant-defined widget configuration.",
      "name": "Customization"
    },
    {
      "description": "APIs for configuring cancellation flows, retention offers, cancellation reason management, and win-back automation.",
      "name": "Customer Retention"
    }
  ],
  "x-tagGroups": [
    {
      "name": "Subscription Management",
      "tags": [
        "Subscription Management",
        "Subscription Payments",
        "Subscription Contracts",
        "Subscription Products",
        "Billing & Payments",
        "Subscription Discounts",
        "Subscription One-Time Products"
      ]
    },
    {
      "name": "Other APIs",
      "tags": [
        "Subscription Plans",
        "Build-a-Box & Bundles",
        "Product Catalog",
        "Operations & Settings",
        "Customization",
        "Customer Retention",
        "Customer Portal",
        "Customers"
      ]
    }
  ]
}