openapi: 3.0.0
info:
  title: Subscriptions (SMT API)
  description: >-
    fabric's Subscriptions API lets your customers set recurring purchases of
    their desired products or services for a scheduled period (weekly, monthly,
    etc.). In addition, Subscriptions helps you retrieve and update subscription
    details, and lets your customers skip one or more subscription schedules, or
    remove a subscription. This API also lets you create and updates customers
    cancellation reasons, and subscription discounts.
  version: 2.0.0
  contact:
    email: support@fabric.inc
  license:
    name: fabric API License
    url: https://fabric.inc/api-license
tags:
  - name: Subscribers
    description: >-
      These endpoints let you create, update, or get one or all of your
      subscribers (customers who have subscriptions). If you request all
      subscribers, you will receive a paginated response; you can specify the
      page size, and which page you want.
  - name: Subscriptions
    description: >-
      These endpoints let your customers set recurring purchases of their
      desired products or services for a scheduled period (weekly, monthly,
      etc.). In addition, these endpoints let you get and update subscription
      details, and let your customers skip one or more subscription schedules,
      or remove a subscription.
  - name: Orders
    description: >-
      These endpoints let your customers purchase products and services from
      your store.
  - name: Cancellation Reasons
    description: These endpoints let you create and get cancellation reasons.
  - name: Subscription Discounts
    description: >-
      These endpoints let you create, update, deactivate, and get discount
      offers for the orders placed by your customers.
servers:
  - url: https://prod01.copilot.fabric.inc/data-subscription
    description: Production
paths:
  /v1/customers:
    post:
      tags:
        - Subscribers
      summary: Create subscriber
      description: Create new subscriber with specified details
      operationId: createSubscriber
      requestBody:
        description: Details of customer being created
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomerBody'
      responses:
        '200':
          description: Request processed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/badRequestError'
  /v1/customers/{id}:
    get:
      tags:
        - Subscribers
      summary: Get single subscriber's account
      description: Get details of single customer, specified by customer ID
      operationId: getSubscriber
      parameters:
        - in: path
          name: id
          required: true
          schema:
            description: Customer ID
            type: string
            example: 62cffd65e8d7eb868c6a29d6
      responses:
        '200':
          description: Request processed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerResponse'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/notFoundError'
    put:
      tags:
        - Subscribers
      summary: Update single subscriber
      description: Update a single subscriber, specified by customer ID
      operationId: updateSubscriber
      parameters:
        - in: path
          name: id
          required: true
          schema:
            description: Customer ID
            type: string
            example: 62cffd65e8d7eb868c6a29d6
      requestBody:
        description: Details of customer being updated
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomerBody'
      responses:
        '200':
          description: Request processed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/badRequestError'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/notFoundError'
  /v1/customers/{id}/subscriptions:
    patch:
      tags:
        - Subscribers
      summary: Update single subscriber's shipping and billing information
      description: >-
        Update single subscriber's shipping and billing information (subscriber
        specified by customer ID)
      operationId: updateShippingBilling
      parameters:
        - in: path
          name: id
          required: true
          schema:
            description: Customer ID
            type: string
            example: 62cffd65e8d7eb868c6a29d6
      requestBody:
        description: Details for updating customer billing and shipping information
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateShippingBillingRequestBody'
      responses:
        '200':
          description: Request processed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateShippingBillingSuccessResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/badRequestError'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/notFoundError'
  /v1/subscriptions:
    get:
      tags:
        - Subscriptions
      summary: Get all subscriptions
      description: Get all subscriptions (response is paginated)
      operationId: getSubscriptions
      parameters:
        - in: query
          name: limit
          description: Maximum number of subscriptions to return per page
          schema:
            type: number
            example: 10
        - in: query
          name: offset
          description: Page number
          schema:
            type: number
            example: 0
        - in: query
          name: status
          description: Subscription status
          schema:
            type: string
            example: ACTIVE
      responses:
        '200':
          description: Request processed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetAllSubscriptionsSuccessResponse'
        '404':
          description: Subscription not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/notFoundSubscriptionError'
  /v1/subscriptions/{id}:
    get:
      tags:
        - Subscriptions
      summary: Get single subscription
      description: Get single subscription by subscription ID
      operationId: getSubscription
      parameters:
        - in: path
          name: id
          required: true
          schema:
            description: Subscription ID
            type: string
            example: 6169b2d892a5f30009d76480
      responses:
        '200':
          description: Request processed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetSubscriptionByIdSuccessResponse'
        '404':
          description: Subscription not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/notFoundSubscriptionError'
    patch:
      tags:
        - Subscriptions
      summary: Update single subscription
      description: Update single subscription by subscription ID
      operationId: updateSubscription
      parameters:
        - in: path
          name: id
          required: true
          schema:
            description: Subscription ID
            type: string
            example: 6169b2d892a5f30009d76480
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateSubscriptionRequestBody'
      responses:
        '200':
          description: Request processed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetSubscriptionByIdSuccessResponse'
        '404':
          description: Subscription not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/notFoundSubscriptionError'
  /v1/subscriptions/bulk:
    post:
      tags:
        - Subscriptions
      summary: Create bulk subscriptions
      description: Create bulk subscriptions
      operationId: createBulk
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateBulkRequestBody'
      responses:
        '200':
          description: Request processed successfully
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/createSubscriptionBulkSuccessResponse'
                  - $ref: '#/components/schemas/createSubscriptionBulkPartialResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/createSubscriptionBulkBadRequestError'
  /v1/subscriptions/{id}/inactive:
    put:
      tags:
        - Subscriptions
      summary: Deactivate single subscription
      description: Deactivate single subscription by subscription ID
      operationId: inactivateSubscription
      parameters:
        - in: path
          name: id
          required: true
          schema:
            description: Subscription ID
            type: string
            example: 6169b2d892a5f30009d76480
      responses:
        '200':
          description: Request processed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InactivateSubscriptionSuccessResponse'
  /v1/subscriptions/{id}/reactivate:
    put:
      tags:
        - Subscriptions
      summary: Reactivate single subscription
      description: Reactivate single subscription by subscription ID
      operationId: reactivateSubscription
      parameters:
        - in: path
          name: id
          required: true
          schema:
            description: Subscription ID
            type: string
            example: 6169b2d892a5f30009d76480
      responses:
        '200':
          description: Request processed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReactivateSubscriptionSuccessResponse'
  /v1/subscriptions/replace-items:
    post:
      tags:
        - Subscriptions
      summary: Replace a subscription item
      description: Replace a subscription item (with details) by specifying item SKU
      operationId: replaceItem
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ReplaceItem'
      responses:
        '200':
          description: Request processed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReplaceItemSuccessResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/subscriptionBadRequestError'
  /v1/subscriptions/discontinued-items:
    post:
      tags:
        - Subscriptions
      summary: Discontinue items in subscription
      description: Discontinue items in subscription by specifying item SKUs
      operationId: discontinueItems
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DiscontinuedItemRequestBody'
      responses:
        '200':
          description: Request processed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReplaceItemSuccessResponse'
  /v1/orders/{orderId}:
    get:
      tags:
        - Orders
      summary: Get single order
      description: Get single order, specified by order ID
      operationId: getSingleOrderById
      parameters:
        - in: path
          name: orderId
          required: true
          description: Order ID
          schema:
            $ref: '#/components/schemas/Id'
      responses:
        '200':
          description: Request processed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/getSingleOrderById'
        '403':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/unAuthError'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/notFoundError'
    patch:
      tags:
        - Orders
      summary: Update single order
      description: Update single order, specified by order ID
      operationId: updateOrder
      parameters:
        - in: path
          name: orderId
          description: Order ID
          required: true
          schema:
            $ref: '#/components/schemas/Id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/updateOrderRequest'
      responses:
        '200':
          description: Request processed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/updateOrderResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/badRequestError'
        '403':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/unAuthError'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/notFoundError'
  /v1/customers/{customerId}/orders:
    get:
      tags:
        - Orders
      summary: Get all orders for a specific customer
      description: Get all orders for a specified customer, specified by customer ID
      operationId: getOrdersByCustomerReferenceId
      parameters:
        - in: path
          name: customerId
          description: Customer reference ID
          required: true
          schema:
            $ref: '#/components/schemas/Id'
      responses:
        '200':
          description: Request processed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/getOrdersbyCustomerReferenceId'
        '403':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/unAuthError'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/notFoundError'
  /v1/orders/{orderId}/trigger-now:
    get:
      tags:
        - Orders
      summary: Trigger single order
      description: Trigger order specified by order ID
      operationId: triggerOrderNow
      parameters:
        - in: path
          name: orderId
          description: Order ID
          required: true
          schema:
            $ref: '#/components/schemas/Id'
      responses:
        '200':
          description: Request processed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/triggerOrderNowResponse'
        '403':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/unAuthError'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/notFoundError'
  /v1/orders/{orderId}/skip:
    put:
      tags:
        - Orders
      summary: Skip single order
      description: Skip order specified by order ID
      operationId: skipOrder
      parameters:
        - in: path
          name: orderId
          description: Order ID
          required: true
          schema:
            $ref: '#/components/schemas/Id'
      responses:
        '200':
          description: Request processed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/skippedOrderResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/badRequestError'
        '403':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/unAuthError'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/notFoundError'
  /v1/orders/{id}/remove-items:
    post:
      tags:
        - Orders
      summary: Remove items from single order
      description: Remove items from order specified by order ID
      operationId: removeItemsFromOrder
      parameters:
        - in: path
          name: id
          description: Order ID
          required: true
          schema:
            $ref: '#/components/schemas/Id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/removeItemsFromOrderRequest'
      responses:
        '200':
          description: Request processed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RemoveItemsFromOrderResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/badRequestError'
        '403':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/unAuthError'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/notFoundError'
  /v1/orders/{id}/add-items:
    post:
      tags:
        - Orders
      summary: Add items to single order
      description: Add items to order specified by order ID
      operationId: addItemsToOrder
      parameters:
        - in: path
          name: id
          description: Order ID
          required: true
          schema:
            $ref: '#/components/schemas/Id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddItemsToOrderRequest'
      responses:
        '200':
          description: Request processed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddItemsToOrderResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/badRequestError'
        '403':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/unAuthError'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/notFoundError'
  /v1/cancellation-reasons:
    get:
      tags:
        - Cancellation Reasons
      summary: Get all cancellation reasons
      description: Get all cancellation reasons
      operationId: getCancellationReasons
      responses:
        '200':
          description: Request processed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetCancellationReasonsResponse'
        '403':
          description: Unauthorized access
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/unAuthError'
    post:
      tags:
        - Cancellation Reasons
      summary: Create cancellation reasons
      description: Create cancellation reasons
      operationId: createCancellationReasons
      requestBody:
        description: Cancellation reason to be created
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCancellationReasons'
      responses:
        '200':
          description: Request processed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/createCancellationReasonResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/badRequestError'
        '403':
          description: Unauthorized access
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/unAuthError'
  /v1/subscriptionDiscount:
    post:
      tags:
        - Subscription Discounts
      summary: Create subscription discounts
      description: Create subscription discounts
      operationId: createDiscount
      requestBody:
        description: Details of subscription discount to be created
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateDiscountRequest'
      responses:
        '200':
          description: Request processed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateDiscountResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/badRequestError'
        '403':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/unAuthError'
  /v1/subscriptionDiscount/{offerId}:
    get:
      tags:
        - Subscription Discounts
      summary: Get a subscription discount
      description: >-
        Get a subscription discount for a specified offer (specified by offer
        ID)
      operationId: getDiscount
      parameters:
        - in: path
          name: offerId
          description: Offer code
          required: true
          schema:
            type: string
            example: SUB-D45DD7
      responses:
        '200':
          description: Request processed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetDiscountResponse'
        '403':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/unAuthError'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/notFoundError'
    put:
      tags:
        - Subscription Discounts
      summary: Update a subscription discount
      description: >-
        Update a subscription discount for a specified offer (specified by offer
        ID)
      operationId: updateDiscount
      parameters:
        - in: path
          name: offerId
          required: true
          description: Offer ID
          schema:
            $ref: '#/components/schemas/Id'
      requestBody:
        description: Details used to update discount
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateDiscountRequest'
      responses:
        '200':
          description: Request processed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateDiscountResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/badRequestError'
        '403':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/unAuthError'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/notFoundError'
  /v1/subscriptionDiscount/deactivate/{id}:
    patch:
      tags:
        - Subscription Discounts
      summary: Deactivate a subscription discount
      description: Deactivate a specified subscription discount (specified by discount ID)
      operationId: deactivateDiscount
      parameters:
        - in: path
          name: id
          required: true
          description: Discount ID
          schema:
            $ref: '#/components/schemas/Id'
      responses:
        '200':
          description: Request processed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeactivateDiscountResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/badRequestError'
        '403':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/unAuthError'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/notFoundError'
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
  schemas:
    Id:
      type: string
      description: General object ID
      example: 606f01f441b8fc0008529916
    Address:
      required:
        - name
        - streetAddress
        - city
        - state
        - postalCode
        - country
        - phone
      type: object
      description: Bill-to address and phone details
      properties:
        name:
          $ref: '#/components/schemas/Name'
        streetAddress:
          $ref: '#/components/schemas/StreetAddress'
        city:
          description: City name
          type: string
          example: Boston
        state:
          description: State name
          type: string
          example: MA
        postalCode:
          description: Postal code
          type: string
          example: '02127'
        country:
          description: Country name
          type: string
          example: US
        phone:
          $ref: '#/components/schemas/Phone'
    AddressShipTo:
      required:
        - name
        - streetAddress
        - city
        - state
        - postalCode
        - country
        - phone
      type: object
      description: Ship-to address and phone details
      properties:
        name:
          $ref: '#/components/schemas/Name'
        streetAddress:
          $ref: '#/components/schemas/StreetAddress'
        city:
          description: City name
          type: string
          example: Boston
        state:
          description: State name
          type: string
          example: MA
        postalCode:
          description: Postal code
          type: string
          example: '02127'
        country:
          description: Country name
          type: string
          example: US
        phone:
          $ref: '#/components/schemas/Phone'
    AddressUpdate:
      type: object
      description: Billing address update details
      properties:
        name:
          $ref: '#/components/schemas/NameUpdate'
        streetAddress:
          $ref: '#/components/schemas/StreetAddressUpdate'
        city:
          description: City name
          type: string
          example: Boston
        state:
          description: State name
          type: string
          example: MA
        postalCode:
          description: Postal code
          type: string
          example: '02127'
        country:
          description: Country name
          type: string
          example: US
        phone:
          $ref: '#/components/schemas/PhoneUpdate'
    AddressUpdateShipTo:
      type: object
      description: Ship to details
      properties:
        name:
          $ref: '#/components/schemas/NameUpdate'
        streetAddress:
          $ref: '#/components/schemas/StreetAddressUpdate'
        city:
          description: City name
          type: string
          example: Boston
        state:
          description: State name
          type: string
          example: MA
        postalCode:
          description: Postal code
          type: string
          example: '02127'
        country:
          description: Country name
          type: string
          example: US
        phone:
          $ref: '#/components/schemas/PhoneUpdate'
    communicationPreference:
      type: object
      description: Customer's communications preferences
      properties:
        email:
          type: boolean
          description: >-
            true: Customer agrees to be contacted via email<br />false: Customer
            does not want to be contacted via email
          example: true
        sms:
          type: boolean
          description: >-
            true: Customer agrees to be contacted via text message<br />false:
            Customer does not want to be contacted via text message
          example: true
    Customer:
      required:
        - customerReferenceId
        - locale
        - email
        - firstName
        - lastName
      type: object
      description: Customer information
      properties:
        customerReferenceId:
          type: string
          description: Customer reference ID
          example: '12345'
        locale:
          type: string
          description: Customer locale (language_country)
          example: en_US
        email:
          type: string
          description: Customer's email address
          example: customer@example.com
        contactnumber:
          type: string
          description: Customer's contact number
          example: '5555551234'
        firstName:
          type: string
          example: Pat
          description: Customer's first name
        middleName:
          type: string
          example: E
          description: Customer's middle name or initial
        lastName:
          type: string
          example: Kake
          description: Customer's last name
        segments:
          type: array
          description: Customer's segments
          items:
            type: string
            example: employee
            description: Customer's segment (employee, management, pro user, etc.)
        employeeId:
          type: string
          example: '345'
          description: Customer employee ID
        status:
          type: string
          description: Customer status
          example: ACTIVE
          enum:
            - ACTIVE
            - INACTIVE
        isDeleted:
          type: boolean
          description: 'true: Customer is deleted<br />false: Customer is not deleted'
          example: false
        DeletedAt:
          type: string
          description: >-
            If `isDeleted`=true, time at which the customer was deleted<br />If
            `isDeleted`=false, NULL
          example: '2021-01-01T00:00:00.000Z'
        createdAt:
          type: string
          description: Time customer was created
          example: '2019-10-12T21:35:05.756Z'
        updatedAt:
          type: string
          description: Most recent time customer was updated
          example: '2021-10-14T05:40:55.997Z'
        communicationPreference:
          $ref: '#/components/schemas/communicationPreference'
    Name:
      required:
        - firstName
        - lastName
      type: object
      description: Customer's name
      properties:
        firstName:
          type: string
          example: Pat
          description: Customer's first name
        middleName:
          type: string
          example: E
          description: Customer's middle name or initial
        lastName:
          type: string
          example: Kake
          description: Customer's last name
    NameUpdate:
      type: object
      description: Customer's name to be updated
      properties:
        firstName:
          type: string
          example: Pat
          description: Customer's first name
        middleName:
          type: string
          example: E
          description: Customer's middle name or initial
        lastName:
          type: string
          example: Kake
          description: Customer's last name
    StreetAddress:
      required:
        - street1
      description: Street address
      type: object
      properties:
        street1:
          description: Street address field 1
          type: string
          example: 123 Main St
        street2:
          description: Street address field 2
          type: string
          example: Suite 100
    StreetAddressUpdate:
      type: object
      description: Street address to be updated
      properties:
        street1:
          type: string
          description: Street address field 1
          example: 123 Main St
        street2:
          type: string
          description: Street address field 2
          example: Suite 100
    Phone:
      required:
        - number
      type: object
      description: Customer's phone details
      properties:
        number:
          type: string
          description: Phone number
          example: '5555551234'
        kind:
          type: string
          description: Phone type
          example: home
    PhoneUpdate:
      type: object
      description: Customer's phone details to be updated
      properties:
        number:
          type: string
          description: Phone number
          example: '5555551234'
        kind:
          type: string
          description: Phone type
          example: home
    PaymentIdentifier:
      required:
        - cardIdentifier
        - expiryDate
      type: object
      description: Payment identifier details
      properties:
        cardIdentifier:
          type: string
          description: Last four digits of credit card number
          example: '1234'
        expiryDate:
          type: string
          description: Card expiration date
          example: 12/20
    UpdatePaymentIdentifier:
      type: object
      description: Payment identifier details to be updated
      properties:
        cardIdentifier:
          type: string
          description: Last four digits of credit card number
          example: '1234'
        expiryDate:
          type: string
          description: Card expiration date
          example: 12/20
    PaymentDetails:
      required:
        - paymentIdentifier
      type: object
      description: Payment details
      properties:
        paymentIdentifier:
          $ref: '#/components/schemas/PaymentIdentifier'
        paymentMethod:
          type: string
          description: Payment method
          example: credit_card
        paymentKind:
          type: string
          description: Payment type
          example: Visa
    UpdatePaymentDetails:
      type: object
      description: Payment details to be updated
      properties:
        paymentIdentifier:
          $ref: '#/components/schemas/UpdatePaymentIdentifier'
        paymentMethod:
          type: string
          description: Payment method
          example: credit_card
        paymentKind:
          type: string
          description: Payment type
          example: credit
    Plan:
      required:
        - frequency
        - frequencyType
      type: object
      description: Subscription plan details
      properties:
        id:
          type: string
          description: Subscription plan ID
          example: '1001'
        frequency:
          type: integer
          description: Subscription plan frequency value
          example: 30
        frequencyType:
          type: string
          description: Subscription plan frequency period
          example: Daily
    UpdatePlan:
      type: object
      description: Subscription plan details
      properties:
        id:
          type: string
          description: Subscription plan ID
          example: '1001'
        frequency:
          type: integer
          description: Subscription plan frequency value
          example: 30
        frequencyType:
          type: string
          description: Subscription plan frequency period
          example: Daily
    OrderSubscription:
      required:
        - plan
        - id
      type: object
      description: Subscription details
      properties:
        plan:
          $ref: '#/components/schemas/Plan'
        id:
          type: string
          description: Subscription ID
          example: 6256610bc312410009b7390b
    ItemPrice:
      required:
        - price
        - currencyCode
      type: object
      description: Item price details
      properties:
        price:
          type: integer
          description: Item price
          example: 100
        currencyCode:
          type: string
          description: Item currency code
          example: USD
    UpdateItemPrice:
      type: object
      description: Item price details to be updated
      properties:
        price:
          type: integer
          description: Item price
          example: 100
        currencyCode:
          type: string
          description: Item currency code
          example: USD
    Tax:
      required:
        - taxCode
        - taxAmount
        - currencyCode
      type: object
      description: Tax details
      properties:
        taxCode:
          type: string
          description: Tax code
          example: FR020000
        taxAmount:
          type: integer
          description: Tax amount (value, not percentage)
          example: 10
        currencyCode:
          type: string
          description: Tax currency code
          example: USD
    UpdateTax:
      type: object
      description: Tax details to be updated
      properties:
        taxCode:
          type: string
          description: Tax code
          example: FR020000
        taxAmount:
          type: integer
          description: Tax amount (value, not percentage)
          example: 10
        currencyCode:
          type: string
          description: Tax currency code
          example: USD
    Item:
      required:
        - id
        - sku
        - quantity
        - itemPrice
      type: object
      description: Item details
      properties:
        id:
          type: integer
          description: Item ID
          example: 1000000006
        sku:
          type: string
          description: Item SKU
          example: MOBO-X570
        quantity:
          type: integer
          description: Number of items
          example: 1
        weight:
          type: integer
          description: Item weight amount
          example: 10
        weightUnit:
          type: string
          description: Item weight unit
          example: lb
        title:
          type: string
          description: Item name
          example: Vitamin
        description:
          type: string
          description: Item description
          example: Vitamin C
        itemPrice:
          $ref: '#/components/schemas/ItemPrice'
        tax:
          $ref: '#/components/schemas/Tax'
    UpdateItem:
      type: object
      description: Item details to be updated
      properties:
        id:
          type: integer
          description: Item ID
          example: 1000000006
        sku:
          type: string
          description: Item SKU
          example: MOBO-X570
        quantity:
          type: integer
          description: Number of items
          example: 1
        weight:
          type: integer
          description: Item weight amount
          example: 10
        weightUnit:
          type: string
          description: Item weight unit
          example: lb
        title:
          type: string
          description: Item name
          example: Vitamin
        description:
          type: string
          description: Item description
          example: Vitamin C
        itemPrice:
          $ref: '#/components/schemas/UpdateItemPrice'
        tax:
          $ref: '#/components/schemas/UpdateTax'
    Expiry:
      type: object
      description: Expiration date and billing cycle
      properties:
        expiryDate:
          type: string
          description: Card expiration date
          example: '2022-07-18T09:16:11.437Z'
        billingCycles:
          type: number
          description: Billing cycle number
          example: 2
    Shipping:
      required:
        - shipmentCarrier
        - shipmentMethod
        - shipmentInstructions
        - shippingAmount
        - taxCode
        - taxAmount
        - currencyCode
      type: object
      description: Shipping details
      properties:
        shipmentCarrier:
          type: string
          description: Shipment carrier
          example: USPS
        shipmentMethod:
          type: string
          description: Shipment method
          example: Ground
        shipmentInstructions:
          type: string
          description: Shipment instructions
          example: Please leave the package in the box
        taxCode:
          type: string
          description: Shipment tax code
          example: SHP020000
        shippingAmount:
          type: integer
          description: Shipping cost
          example: 10
        taxAmount:
          type: integer
          description: Shipment tax amount (value, not percentage)
          example: 1
        currencyCode:
          type: string
          description: Shipment currency code
          example: USD
    UpdateShipping:
      type: object
      description: Shipping details to be updated
      properties:
        shipmentCarrier:
          type: string
          description: Shipment carrier
          example: USPS
        shipmentMethod:
          type: string
          description: Shipment method
          example: Ground
        shipmentInstructions:
          type: string
          description: Shipment instructions
          example: Please leave the package in the box
        taxCode:
          type: string
          description: Shipment tax code
          example: SHP020000
        shippingAmount:
          type: integer
          description: Shipping cost
          example: 10
        taxAmount:
          type: integer
          description: Shipment tax amount (value, not percentage)
          example: 1
        currencyCode:
          type: string
          description: Shipment currency code
          example: USD
    Offer:
      required:
        - id
      type: object
      description: Offer details
      properties:
        id:
          type: string
          description: Offer ID
          example: SUB-E10717
        source:
          type: string
          description: Offer source
          example: PDP
          enum:
            - PDP
            - CART
    UpdateOffer:
      type: object
      description: Offer details to be updated
      properties:
        id:
          type: string
          description: Offer ID
          example: SUB-E10717
        source:
          type: string
          description: Offer source
          example: PDP
          enum:
            - PDP
            - CART
    CustomAttributes:
      type: object
      description: Custom attributes
      properties:
        storeId:
          type: string
          description: Store ID
          example: 60cb07fc20387b000821c5c3
        associateId:
          type: integer
          description: Associate ID
          example: 1
        trackingUrl:
          type: string
          description: Tracking URL
          example: 609436d21baded0008945b05
    Items:
      required:
        - lineItemId
      type: object
      description: Item details
      properties:
        subscription:
          $ref: '#/components/schemas/OrderSubscription'
        item:
          $ref: '#/components/schemas/Item'
        shipping:
          $ref: '#/components/schemas/Shipping'
        offer:
          $ref: '#/components/schemas/Offer'
        lineItemId:
          type: integer
          description: Line item ID
          example: 1
        customAttributes:
          $ref: '#/components/schemas/CustomAttributes'
    OrderRetry:
      type: object
      description: Order retry details
      properties:
        maxRetries:
          type: integer
          description: Maximum number of retries
          example: 3
        retryType:
          type: string
          description: Retry type
          example: PAYMENT RETRY
          enum:
            - PAYMENT RETRY
            - INTENTORY RETRY
            - GENERIC RETRY
        retryAfterDays:
          type: integer
          description: Number of days after which to retry
          example: 1
        retryCount:
          type: integer
          description: Number of times to retry order
          example: 2
    OrderError:
      type: object
      description: Order error details
      properties:
        errorCode:
          type: string
          description: Brief error code
          example: ORDER_NOT_FOUND
        errorMessage:
          type: string
          description: Full error message
          example: The order is not found
    Order:
      required:
        - status
        - scheduledDate
        - totalAmount
        - currencyCode
        - customer
      type: object
      description: Order details
      properties:
        shipTo:
          $ref: '#/components/schemas/AddressShipTo'
        billTo:
          $ref: '#/components/schemas/Address'
        paymentDetails:
          $ref: '#/components/schemas/PaymentDetails'
        isDeleted:
          type: boolean
          description: 'true: Order is deleted<br />false: Order is not deleted'
          example: false
        deletedAt:
          type: string
          description: >-
            If `isDeleted`=true, time at which the order was deleted<br />If
            `isDeleted`=false, NULL
          example: '2019-01-01T00:00:00.000Z'
        id:
          type: string
          description: Order ID
          example: 6384462ab645220008a4358a
        status:
          type: string
          description: Order status
          example: SCHEDULED
          enum:
            - SCHEDULED
            - CANCELED
            - SUCCESS
            - SKIPPED
            - RETRY
            - SUBMITTED
            - FAILED
        totalAmount:
          type: integer
          description: Total order price
          example: 100
        totalTax:
          type: integer
          description: Total tax on order
          example: 10
        totalDiscount:
          type: integer
          description: Total discount for order (amount, not percentage)
          example: 10
        currencyCode:
          type: string
          description: Order currency code
          example: USD
        scheduledDate:
          type: string
          description: Date on which order is scheduled to be created
          example: '2019-01-01T00:00:00.000Z'
        customer:
          $ref: '#/components/schemas/Customer'
        lineItems:
          type: array
          items:
            $ref: '#/components/schemas/Items'
        createdAt:
          type: string
          description: Time order was created
          example: '2021-10-12T21:35:05.756Z'
        updatedAt:
          type: string
          description: Most recent time order was updated
          example: '2021-10-14T05:40:55.997Z'
        statusUpdatedAt:
          type: string
          description: Most recent time order status was updated
          example: '2021-10-14T10:24:36.468Z'
        Retry:
          $ref: '#/components/schemas/OrderRetry'
        error:
          $ref: '#/components/schemas/OrderError'
    UpdateOrder:
      type: object
      description: Order details to be updated
      properties:
        shipTo:
          $ref: '#/components/schemas/AddressShipTo'
        billTo:
          $ref: '#/components/schemas/Address'
        paymentDetails:
          $ref: '#/components/schemas/PaymentDetails'
        scheduledDate:
          type: string
          description: Date on which order is scheduled to be created
          example: '2019-01-01T00:00:00.000Z'
        status:
          type: string
          description: Order status
          example: SCHEDULED
          enum:
            - SCHEDULED
            - CANCELED
            - SUCCESS
            - SKIPPED
            - RETRY
            - SUBMITTED
            - FAILED
        lineItems:
          type: array
          items:
            $ref: '#/components/schemas/UpdateOrderItems'
    UpdateOrderItems:
      type: object
      description: Order item details to be updated
      properties:
        shipping:
          $ref: '#/components/schemas/Shipping'
        offer:
          $ref: '#/components/schemas/Offer'
        Item:
          $ref: '#/components/schemas/OrderUpdateItem'
        customAttributes:
          $ref: '#/components/schemas/CustomAttributes'
    OrderUpdateItem:
      type: object
      description: Order item update details
      properties:
        quantity:
          type: integer
          description: Number of items
          example: 1
        weight:
          type: integer
          description: Item weight amount
          example: 10
        weightUnit:
          type: string
          description: Item weight unit
          example: lb
        tax:
          $ref: '#/components/schemas/Tax'
    SkipOrderErrorItems:
      type: object
      description: Skip order error items
      properties:
        lineItemId:
          type: integer
          description: Line item ID
          example: 1
        code:
          type: string
          description: Error code
          example: SUBSCRIPTION_NOT_FOUND
    SkippedOrder:
      type: object
      description: Skipped order details
      properties:
        id:
          type: string
          description: Order ID
          example: 6384462ab645220008a4358a
        status:
          type: string
          description: Order status
          example: SKIPPED
    NextScheduledOrders:
      type: object
      description: Next scheduled orders
      properties:
        newOrders:
          type: array
          items:
            type: string
            description: Next scheduled items
            example: 62d51ab385a8cd00092eb8b7
        subscriptions:
          type: array
          items:
            type: string
            description: Next scheduled order related subscriptions
            example: 62d51ab385a8cd00092eb8b7
    AddItemToOrderItems:
      type: object
      description: Details of item to be added to order
      properties:
        subscriptionId:
          type: string
          description: Subscription ID
          example: 6256610bc312410009b7390b
        item:
          $ref: '#/components/schemas/Item'
        shipping:
          $ref: '#/components/schemas/Shipping'
    CustomerBody:
      required:
        - customerReferenceId
        - locale
        - email
        - firstName
        - lastName
        - communicationPreference
      type: object
      description: Customer details
      properties:
        customerReferenceId:
          type: string
          example: '12345'
          description: Unique customer reference ID
        locale:
          type: string
          example: en_US
          description: Customer locale (language_country)
        email:
          type: string
          example: customer@example.com
          description: Customer's email address
        contactnumber:
          type: string
          example: '+923333709568'
          description: Customer's contact number
        firstName:
          type: string
          example: Pat
          description: Customer's first name
        middleName:
          type: string
          example: E
          description: Customer's middle name or initial
        lastName:
          type: string
          example: Kake
          description: Customer's last name
        segment:
          type: array
          description: Customer's segments
          items:
            type: string
            example: employee
            description: Customer's segment (employee, management, pro user, etc.)
        employeeId:
          type: string
          example: '345'
          description: Customer employee ID
        communicationPreference:
          $ref: '#/components/schemas/communicationPreference'
    CustomerUpdateBody:
      required:
        - customerReferenceId
      description: Customer details to be updated
      type: object
      properties:
        customerReferenceId:
          type: string
          example: '12345'
          description: Customer reference ID
        locale:
          type: string
          example: en_US
          description: Customer locale (language_country)
        email:
          type: string
          example: customer@example.com
          description: Customer's email address
        contactnumber:
          type: string
          example: '+923333709568'
          description: Customer's contact number
        firstName:
          type: string
          example: Pat
          description: Customer's first name
        middleName:
          type: string
          example: E
          description: Customer's middle name or initial
        lastName:
          type: string
          example: Kake
          description: Customer's last name
        segment:
          type: array
          description: Customer's segments
          items:
            type: string
            example: employee
            description: Customer's segment (employee, management, pro user, etc.)
        employeeId:
          type: string
          example: '345'
          description: Customer employee ID
        communicationPreference:
          $ref: '#/components/schemas/communicationPreference'
    SubscriptionItems:
      type: object
      description: Items in a subscription
      properties:
        id:
          type: integer
          description: Item ID
          example: 1000000006
        sku:
          type: string
          description: Subscription item SKU
          example: MOBO-X570
        quantity:
          type: integer
          description: Number of items
          example: 1
        weight:
          type: integer
          description: Item weight amount
          example: 10
        weightUnit:
          type: string
          description: Item weight unit
          example: lb
        itemPrice:
          $ref: '#/components/schemas/ItemPrice'
        tax:
          $ref: '#/components/schemas/Tax'
        plan:
          $ref: '#/components/schemas/Plan'
        offsetDays:
          description: Number of days after which order is to be created
          type: number
          example: 2
        offer:
          $ref: '#/components/schemas/Offer'
        shipping:
          $ref: '#/components/schemas/Shipping'
        expiry:
          $ref: '#/components/schemas/Expiry'
    CustomerResponse:
      description: Customer details after creation
      type: object
      properties:
        id:
          description: Customer ID
          type: string
          example: 62cffd65e8d7eb868c6a29d6
        customerReferenceId:
          type: string
          example: '12345'
          description: Customer reference ID
        locale:
          type: string
          example: en_US
          description: Customer locale (language_country)
        email:
          type: string
          example: customer@example.com
          description: Customer's email address
        contactNumber:
          type: string
          example: '+923333709568'
          description: Customer's contact number
        firstName:
          type: string
          example: Pat
          description: Customer's first name
        middleName:
          type: string
          example: E
          description: Customer's middle name or initial
        lastName:
          type: string
          example: Kake
          description: Customer's last name
        segment:
          type: array
          description: Customer's segments
          items:
            type: string
            example: employee
            description: Customer's segment (employee, management, pro user, etc.)
        employeeId:
          type: string
          example: '345'
          description: Customer employee ID
        communicationPreference:
          $ref: '#/components/schemas/communicationPreference'
        status:
          type: string
          example: ACTIVE
          enum:
            - ACTIVE
            - INACTIVE
          description: Customer status
        createdAt:
          type: string
          description: Time customer was created
          example: '2021-10-12T21:35:05.756Z'
        updatedAt:
          type: string
          description: Most recent time customer was updated
          example: '2021-10-14T05:40:55.997Z'
    CreateBulkSubscriptionResponse:
      type: object
      description: Subscription item details after bulk creation
      properties:
        id:
          type: string
          description: Subscription ID
          example: 6256610bc312410009b7390b
        item:
          type: object
          description: Subscription item details
          properties:
            sku:
              type: string
              description: Subscription item SKU
              example: MOBO-X570
        customer:
          $ref: '#/components/schemas/CustomerResponse'
    CreateBulkSubscriptionError:
      type: object
      properties:
        errorCode:
          type: string
          description: Brief error code
          example: PRODUCT_DOES_NOT_EXIST
        errorMessage:
          type: string
          description: Full error message
          example: Product with the specified SKU or Item ID does not exist
        item:
          type: object
          description: Item detail (SKU generating error)
          properties:
            sku:
              type: string
              description: SKU of product having error
              example: MOBO-X570
    GetSubscriptionById:
      type: object
      description: Single subscription details
      properties:
        id:
          type: string
          description: Subscription ID
          example: 6256610bc312410009b7390b
        customer:
          $ref: '#/components/schemas/CustomerResponse'
        item:
          $ref: '#/components/schemas/Item'
        plan:
          $ref: '#/components/schemas/Plan'
        offer:
          $ref: '#/components/schemas/Offer'
        shipping:
          $ref: '#/components/schemas/Shipping'
        expiry:
          $ref: '#/components/schemas/Expiry'
        shipTo:
          $ref: '#/components/schemas/AddressShipTo'
        billTo:
          $ref: '#/components/schemas/Address'
        paymentDetails:
          $ref: '#/components/schemas/PaymentDetails'
        customAttributes:
          $ref: '#/components/schemas/CustomAttributes'
        status:
          type: string
          description: Subscription status
          example: ACTIVE
        isDeleted:
          type: boolean
          description: >-
            true: Subscription is deleted<br />false: Subscription is not
            deleted
          example: false
        deletedAt:
          type: string
          description: >-
            If `isDeleted`=true, time at which the subscription was deleted<br
            />If `isDeleted`=false, NULL
          example: '2019-01-01T00:00:00.000Z'
        channel:
          type: string
          description: Channel
          example: WEBSITE
        originOrderId:
          type: string
          description: Client's origin order ID
          example: 22-4498-4800
        offsetDays:
          description: Number of days after which order is to be created
          type: integer
          example: 2
        createdAt:
          type: string
          description: Time subscription was created
          example: '2021-10-12T21:35:05.756Z'
        updatedAt:
          type: string
          description: Most recent time subscription was updated
          example: '2021-10-14T05:40:55.997Z'
        statusUpdatedAt:
          type: string
          description: Most recent time order status was updated
          example: '2021-10-14T10:24:36.468Z'
    Validity:
      type: object
      description: >-
        Dates during which discount is valid, and orders to which discount
        applies
      properties:
        startDate:
          type: string
          description: Validity start date
          example: '2022-07-21T13:14:51.474Z'
        endDate:
          type: string
          description: Validity end date
          example: '2022-07-21T13:14:51.474Z'
        applyOnOrders:
          type: array
          description: Orders to which discount applies
          example:
            - 2
            - 3
          items:
            type: integer
            description: Order numbers to which discount applies
            example: 2
    Discount:
      type: object
      description: Discount detail
      properties:
        amount:
          type: number
          description: Discount amount
          example: 10
    Frequency:
      type: object
      description: Shipping frequency details
      properties:
        shippingFrequency:
          type: integer
          description: Shipping frequency
          example: 1
        shippingFrequencyType:
          type: string
          description: Shipping frequency period
          example: daily
          enum:
            - daily
            - weekly
            - monthly
            - yearly
        billingFrequency:
          type: integer
          description: Billing frequency
          example: 1
        billingFrequencyType:
          type: string
          description: Billing frequency period
          example: daily
          enum:
            - daily
            - weekly
            - monthly
            - yearly
    CreateCustomerRequestBody:
      $ref: '#/components/schemas/CustomerBody'
    UpdateCustomerRequestBody:
      $ref: '#/components/schemas/CustomerBody'
    UpdateShippingBillingRequestBody:
      description: Details for updating customer billing and shipping information
      type: object
      properties:
        shipTo:
          $ref: '#/components/schemas/AddressShipTo'
        billTo:
          $ref: '#/components/schemas/Address'
    CreateCustomerSuccessResponse:
      $ref: '#/components/schemas/CustomerResponse'
    GetCustomerSuccessResponse:
      $ref: '#/components/schemas/CustomerResponse'
    UpdateCustomerSuccessResponse:
      $ref: '#/components/schemas/CustomerResponse'
    UpdateShippingBillingSuccessResponse:
      description: >-
        Subscription details after updating customer billing and shipping
        information
      type: object
      properties:
        subscriptions:
          type: array
          description: Subscriptions associated with this customer
          items:
            type: object
            description: Subscription details
            properties:
              item:
                type: object
                description: Subscription item
                properties:
                  sku:
                    type: string
                    example: MOBO-X570
                    description: Item SKU
    CreateCancellationReasons:
      description: Cancellation reasons to be created
      type: array
      items:
        type: object
        properties:
          code:
            type: number
            description: Cancellation code
            example: 99
          reason:
            type: string
            description: Cancellation reason
            example: Customer is not happy
    GetCancellationReasonsResponse:
      description: Cancellation reason details
      type: object
      properties:
        responseStatus:
          description: Brief response status
          type: string
          example: OK
        message:
          description: Full response message
          type: string
          example: Request processed successfully
        data:
          description: Cancellation reason details
          type: array
          items:
            type: object
            properties:
              _id:
                type: string
                description: Cancellation reason ID
              createdAt:
                type: string
                description: Time cancellation reason was created
                example: '2021-10-12T21:35:05.756Z'
              updatedAt:
                type: string
                description: Most recent time cancellation reason was updated
                example: '2021-10-14T05:40:55.997Z'
              code:
                type: number
                description: Cancellation code
                example: 99
              reason:
                type: string
                description: Cancellation reason
                example: Customer is not happy
    createCancellationReasonResponse:
      description: Cancellation reason and code to be created
      type: object
      properties:
        responseStatus:
          description: Brief response status
          type: string
          example: OK
        message:
          description: Full response message
          type: string
          example: Request processed successfully
        data:
          description: Cancellation reasons and codes
          type: array
          items:
            type: object
            properties:
              code:
                type: number
                description: Cancellation code
                example: 99
              reason:
                type: string
                description: Cancellation reason
                example: Customer is not happy
    AddItemsToOrderRequest:
      type: object
      description: Add items to order
      properties:
        lineItems:
          description: Line items to add to order
          type: array
          items:
            $ref: '#/components/schemas/AddItemToOrderItems'
    removeItemsFromOrderRequest:
      type: object
      description: Remove items from order
      properties:
        lineItemIds:
          description: Line items to remove from order
          type: array
          items:
            type: integer
            example: 1
    updateOrderRequest:
      type: object
      description: Details to update order
      properties:
        order:
          $ref: '#/components/schemas/UpdateOrder'
    getSingleOrderById:
      type: object
      description: Single order returned by ID
      properties:
        responseStatus:
          description: Brief response status
          type: string
          example: OK
        message:
          description: Full response message
          type: string
          example: Request processed successfully
        data:
          description: Order details
          type: object
          properties:
            order:
              $ref: '#/components/schemas/Order'
    getOrdersbyCustomerReferenceId:
      type: object
      description: Get orders by customer reference ID
      properties:
        responseStatus:
          description: Brief response status
          type: string
          example: OK
        message:
          description: Full response message
          type: string
          example: Request processed successfully
        data:
          description: Order details
          type: object
          properties:
            orders:
              type: array
              items:
                $ref: '#/components/schemas/Order'
    AddItemsToOrderResponse:
      type: object
      description: Order details after adding items to order
      properties:
        responseStatus:
          description: Brief response status
          type: string
          example: OK
        message:
          description: Full response message
          type: string
          example: Request processed successfully
        data:
          description: Order details
          type: object
          properties:
            order:
              $ref: '#/components/schemas/Order'
    RemoveItemsFromOrderResponse:
      type: object
      description: Order details after removing items from order
      properties:
        responseStatus:
          description: Brief response status
          type: string
          example: OK
        message:
          description: Full response message
          type: string
          example: Request processed successfully
        data:
          description: Order details
          type: object
          properties:
            order:
              $ref: '#/components/schemas/Order'
    skippedOrderResponse:
      type: object
      description: Skipped order details
      properties:
        responseStatus:
          description: Brief response status
          type: string
          example: OK
        message:
          description: Full response message
          type: string
          example: Request processed successfully
        data:
          description: Skipped order details
          type: object
          properties:
            Order:
              $ref: '#/components/schemas/SkippedOrder'
            dateSkipped:
              type: string
              description: Date order skipped
              example: '2020-01-01T00:00:00.000Z'
            nextScheduledOrders:
              $ref: '#/components/schemas/NextScheduledOrders'
            errors:
              type: array
              description: Errors
              items:
                $ref: '#/components/schemas/SkipOrderErrorItems'
    triggerOrderNowResponse:
      type: object
      description: Order details after triggering order
      properties:
        responseStatus:
          description: Brief response status
          type: string
          example: OK
        message:
          description: Full response message
          type: string
          example: Request processed successfully
        data:
          description: Order details
          type: object
          properties:
            order:
              $ref: '#/components/schemas/Order'
    updateOrderResponse:
      type: object
      description: Order details after updating order
      properties:
        responseStatus:
          description: Brief response status
          type: string
          example: OK
        message:
          description: Full response message
          type: string
          example: Request processed successfully
        data:
          description: Order details
          type: object
          properties:
            order:
              $ref: '#/components/schemas/Order'
    CreateBulkRequestBody:
      type: object
      description: Details used to create bulk subscription
      required:
        - channel
        - items
        - shipTo
        - billTo
        - paymentDetails
      properties:
        channel:
          type: string
          description: Channel
          example: WEBSITE
          enum:
            - WEBSITE
            - POS
        originOrderId:
          type: string
          description: Client's origin order ID
          example: 22-4498-4800
        customer:
          $ref: '#/components/schemas/CustomerBody'
        shipTo:
          $ref: '#/components/schemas/AddressShipTo'
        billTo:
          $ref: '#/components/schemas/Address'
        paymentDetails:
          $ref: '#/components/schemas/PaymentDetails'
        customAttributes:
          $ref: '#/components/schemas/CustomAttributes'
        item:
          type: array
          description: Subscription items
          items:
            $ref: '#/components/schemas/SubscriptionItems'
    createSubscriptionBulkSuccessResponse:
      description: Bulk subscriptions created, and errors, if any
      type: object
      properties:
        responseStatus:
          description: Brief response status
          type: string
          example: OK
        message:
          description: Full response message
          type: string
          example: Request processed successfully
        data:
          type: object
          description: Subscriptions created, and errors, if any
          properties:
            subscriptions:
              type: array
              description: Subscriptions
              items:
                $ref: '#/components/schemas/CreateBulkSubscriptionResponse'
            errors:
              type: array
              description: Errors
              items:
                $ref: '#/components/schemas/SkipOrderErrorItems'
    createSubscriptionBulkPartialResponse:
      description: Bulk subscriptions created, and errors, if any
      type: object
      properties:
        responseStatus:
          description: Brief response status
          type: string
          example: OK
        message:
          description: Full response message
          type: string
          example: Request processed successfully
        data:
          type: object
          description: Subscriptions created, and errors, if any
          properties:
            subscriptions:
              type: array
              description: Subscriptions
              items:
                $ref: '#/components/schemas/CreateBulkSubscriptionResponse'
            errors:
              type: array
              description: Errors
              items:
                type: object
                description: Error details
                properties:
                  errorCode:
                    type: string
                    description: Brief error code
                    example: PRODUCT_DOES_NOT_EXIST
                  errorMessage:
                    type: string
                    description: Full error message
                    example: Product with the specified SKU or Item ID does not exist
                  item:
                    type: object
                    description: Item details
                    properties:
                      sku:
                        description: Subscription item SKU
                        type: string
                        example: MOBO-X570
    createSubscriptionBulkBadRequestError:
      type: object
      description: Bad-request errors when trying to create a bulk subscription
      properties:
        responseStatus:
          type: string
          description: Brief response status
          example: BAD_REQUEST
        message:
          type: string
          description: Full response message
          example: Bad request
        data:
          type: object
          description: Errors
          properties:
            errors:
              type: array
              description: Errors
              items:
                $ref: '#/components/schemas/CreateBulkSubscriptionError'
    GetSubscriptionByIdSuccessResponse:
      type: object
      description: Subscription returned by ID
      properties:
        responseStatus:
          description: Brief response status
          type: string
          example: OK
        message:
          description: Full response message
          type: string
          example: Request processed successfully
        data:
          type: object
          description: Subscription details
          properties:
            subscription:
              $ref: '#/components/schemas/GetSubscriptionById'
    GetAllSubscriptionsSuccessResponse:
      type: object
      description: Subscriptions array
      properties:
        responseStatus:
          description: Brief response status
          type: string
          example: OK
        message:
          description: Full response message
          type: string
          example: Request processed successfully
        data:
          type: object
          description: Subscriptions array
          properties:
            subscriptions:
              type: array
              description: Subscriptions
              items:
                $ref: '#/components/schemas/GetSubscriptionById'
            query:
              type: object
              description: Response pagination details
              properties:
                limit:
                  type: string
                  description: Maximum number of subscriptions to return
                  example: 10
                offset:
                  type: string
                  description: Number of subscriptions to skip before returning response
                  example: 10
                count:
                  type: number
                  description: Total number of subscriptions found
                  example: 100
    UpdateSubscriptionRequestBody:
      type: object
      description: Details used to update subscription
      properties:
        channel:
          type: string
          description: Channel
          example: WEBSITE
          enum:
            - WEBSITE
            - POS
        customer:
          $ref: '#/components/schemas/CustomerUpdateBody'
        shipTo:
          $ref: '#/components/schemas/AddressUpdateShipTo'
        billTo:
          $ref: '#/components/schemas/AddressUpdate'
        paymentDetails:
          $ref: '#/components/schemas/UpdatePaymentDetails'
        customAttributes:
          $ref: '#/components/schemas/CustomAttributes'
        item:
          $ref: '#/components/schemas/UpdateItem'
        plan:
          $ref: '#/components/schemas/UpdatePlan'
        offer:
          $ref: '#/components/schemas/UpdateOffer'
        shipping:
          $ref: '#/components/schemas/UpdateShipping'
        expiry:
          $ref: '#/components/schemas/Expiry'
    InactivateSubscriptionSuccessResponse:
      type: object
      description: Inactivated subscription
      properties:
        responseStatus:
          description: Brief response status
          type: string
          example: OK
        message:
          description: Full response message
          type: string
          example: Request processed successfully
        data:
          type: object
          description: Inactivated subscription
          properties:
            id:
              type: string
              description: Subscription ID
              example: 6256610bc312410009b7390b
            status:
              type: string
              description: Subscription status
              example: INACTIVE
    ReactivateSubscriptionSuccessResponse:
      type: object
      description: Reactivated subscription
      properties:
        responseStatus:
          description: Brief response status
          type: string
          example: OK
        message:
          description: Full response message
          type: string
          example: Request processed successfully
        data:
          type: object
          description: Reactivated subscription
          properties:
            id:
              type: string
              description: Subscription ID
              example: 6256610bc312410009b7390b
            status:
              type: string
              description: Subscription status
              example: ACTIVE
    ReplaceItem:
      type: object
      description: Item to be replaced
      properties:
        item:
          type: object
          description: Replacement item details
          properties:
            sku:
              type: string
              description: Item SKU
              example: MOBO-X570
        replacementItem:
          type: object
          description: Replacement item details
          properties:
            customAttributes:
              $ref: '#/components/schemas/CustomAttributes'
            item:
              $ref: '#/components/schemas/UpdateItem'
            plan:
              $ref: '#/components/schemas/UpdatePlan'
            offer:
              $ref: '#/components/schemas/UpdateOffer'
            shipping:
              $ref: '#/components/schemas/UpdateShipping'
            expiry:
              $ref: '#/components/schemas/Expiry'
    ReplaceItemSuccessResponse:
      type: object
      description: Replace item response
      properties:
        responseStatus:
          description: Brief response status
          type: string
          example: OK
        message:
          description: Full response message
          type: string
          example: >-
            This request to replace items is currently being processed. Once
            done, we will update you via your webhooks (your webhooks need to be
            configured). Refer to our documentation on more information on
            webhooks.
    DiscontinuedItemRequestBody:
      type: object
      description: SKUs of items to be discontinued
      properties:
        sku:
          type: array
          description: SKUs
          items:
            type: string
            description: Item SKU
            example: MOBO-X570
    CreateDiscountRequest:
      type: object
      description: Details of discount to be created
      properties:
        validity:
          $ref: '#/components/schemas/Validity'
        message:
          type: string
          description: Merchant discount message
          example: Offer terms and conditions
        discount:
          $ref: '#/components/schemas/Discount'
        skus:
          type: array
          description: SKUs to which discount applies
          items:
            type: string
            description: SKU
            example: MOBO-X570
        categories:
          type: array
          description: Product categories
          items:
            type: string
            description: Product category
            example: holiday-best-sellers
        frequency:
          $ref: '#/components/schemas/Frequency'
        itemQuantity:
          type: integer
          description: Number of items
          example: 1
        channel:
          type: string
          description: Channel
          example: WEBSITE
          enum:
            - WEBSITE
            - POS
        target:
          type: string
          description: Discount target
          example: PDP
          enum:
            - PDP
            - CART
            - QUICK VIEW
            - SUBSCRIPTION MANAGEMENT PORTAL
        customerSegment:
          type: array
          description: Customer segments
          items:
            type: string
            description: Customer segment
            example: employee
    UpdateDiscountRequest:
      type: object
      description: Details used to update discount
      properties:
        discount:
          $ref: '#/components/schemas/Discount'
        message:
          type: string
          description: Merchant discount message
          example: Offer terms and conditions
        skus:
          type: array
          description: SKUs
          items:
            type: string
            description: SKU
            example: MOBO-X570
        categories:
          type: array
          description: Product categories
          items:
            type: string
            description: Product category
            example: holiday-best-sellers
        frequency:
          $ref: '#/components/schemas/Frequency'
        itemQuantity:
          type: integer
          description: Number of items
          example: 1
        channel:
          type: string
          description: Channel
          example: WEBSITE
          enum:
            - WEBSITE
            - POS
        target:
          type: string
          description: Discount target
          example: PDP
          enum:
            - PDP
            - CART
            - QUICK VIEW
            - SUBSCRIPTION MANAGEMENT PORTAL
    CreateDiscountResponse:
      type: object
      description: Discount details after creation
      properties:
        responseStatus:
          description: Brief response status
          type: string
          example: OK
        message:
          description: Full response message
          type: string
          example: Request processed successfully
        data:
          description: Discount details
          type: object
          properties:
            id:
              type: string
              description: Discount ID
              example: 62d9196aeec12800095633f2
            status:
              type: string
              description: Discount status
              example: ACTIVE
              enum:
                - ACTIVE
                - INACTIVE
            offerCode:
              type: string
              description: Offer code
              example: SUB-D45DD7
            validity:
              $ref: '#/components/schemas/Validity'
            message:
              type: string
              description: Merchant discount message
              example: Offer terms and conditions
            discount:
              $ref: '#/components/schemas/Discount'
            skus:
              type: array
              description: SKUs
              items:
                type: string
                description: SKU
                example: MOBO-X570
            categories:
              type: array
              description: Product categories
              items:
                type: string
                description: Product category
                example: holiday-best-sellers
            frequency:
              $ref: '#/components/schemas/Frequency'
            itemQuantity:
              type: integer
              description: Number of items
              example: 1
            channel:
              type: string
              description: Channel
              example: WEBSITE
              enum:
                - WEBSITE
                - POS
            target:
              type: string
              description: Discount target
              example: PDP
              enum:
                - PDP
                - CART
                - QUICK VIEW
                - SUBSCRIPTION MANAGEMENT PORTAL
            customerSegment:
              type: array
              description: Customer segments
              items:
                type: string
                description: Customer segment
                example: employee
            isDeleted:
              type: boolean
              description: 'true: Customer is deleted<br />false: Customer is not deleted'
              example: false
            DeletedAt:
              type: string
              description: >-
                If `isDeleted`=true, time at which the customer was deleted<br
                />If `isDeleted`=false, NULL
              example: '2019-01-01T00:00:00.000Z'
            createdAt:
              type: string
              description: Time customer was created
              example: '2021-10-12T21:35:05.756Z'
            updatedAt:
              type: string
              description: Most recent time customer was updated
              example: '2021-10-14T05:40:55.997Z'
    GetDiscountResponse:
      type: object
      description: Single discount by offerCode
      properties:
        responseStatus:
          description: Brief response status
          type: string
          example: OK
        message:
          description: Full response message
          type: string
          example: Request processed successfully
        data:
          description: Discount details
          type: object
          properties:
            id:
              type: string
              description: Discount ID
              example: 62d9196aeec12800095633f2
            status:
              type: string
              description: Discount status
              example: ACTIVE
              enum:
                - ACTIVE
                - INACTIVE
            offerCode:
              type: string
              description: Offer code
              example: SUB-D45DD7
            validity:
              $ref: '#/components/schemas/Validity'
            message:
              type: string
              description: Merchant discount message
              example: Offer terms and conditions
            discount:
              $ref: '#/components/schemas/Discount'
            skus:
              type: array
              description: SKUs
              items:
                type: string
                description: SKU
                example: MOBO-X570
            categories:
              type: array
              description: Product categories
              items:
                type: string
                description: Product category
                example: holiday-best-sellers
            frequency:
              $ref: '#/components/schemas/Frequency'
            itemQuantity:
              type: integer
              description: Number of items
              example: 1
            channel:
              type: string
              description: Channel
              example: WEBSITE
              enum:
                - WEBSITE
                - POS
            target:
              type: string
              description: Discount target
              example: PDP
              enum:
                - PDP
                - CART
                - QUICK VIEW
                - SUBSCRIPTION MANAGEMENT PORTAL
            customerSegment:
              type: array
              description: Customer segments
              items:
                type: string
                description: Customer segment
                example: employee
            isDeleted:
              type: boolean
              description: 'true: Customer is deleted<br />false: Customer is not deleted'
              example: false
            DeletedAt:
              type: string
              description: >-
                If `isDeleted`=true, time at which the customer was deleted<br
                />If `isDeleted`=false, NULL
              example: '2019-01-01T00:00:00.000Z'
            createdAt:
              type: string
              description: Time customer was created
              example: '2021-10-12T21:35:05.756Z'
            updatedAt:
              type: string
              description: Most recent time customer was updated
              example: '2021-10-14T05:40:55.997Z'
    UpdateDiscountResponse:
      type: object
      description: Discount details after update
      properties:
        responseStatus:
          description: Brief response status
          type: string
          example: OK
        message:
          description: Full response message
          type: string
          example: Request processed successfully
        data:
          description: Discount details
          type: object
          properties:
            id:
              type: string
              description: Discount ID
              example: 62d9196aeec12800095633f2
            status:
              type: string
              description: Discount status
              example: ACTIVE
              enum:
                - ACTIVE
                - INACTIVE
            offerCode:
              type: string
              description: Offer code
              example: SUB-D45DD7
            validity:
              $ref: '#/components/schemas/Validity'
            message:
              type: string
              description: Merchant discount message
              example: Offer terms and conditions
            discount:
              $ref: '#/components/schemas/Discount'
            skus:
              type: array
              description: SKUs
              items:
                type: string
                description: SKU
                example: MOBO-X570
            categories:
              type: array
              description: Product categories
              items:
                type: string
                description: Product category
                example: holiday-best-sellers
            frequency:
              $ref: '#/components/schemas/Frequency'
            itemQuantity:
              type: integer
              description: Number of items
              example: 1
            channel:
              type: string
              description: Channel
              example: WEBSITE
              enum:
                - WEBSITE
                - POS
            target:
              type: string
              description: Discount target
              example: PDP
              enum:
                - PDP
                - CART
                - QUICK VIEW
                - SUBSCRIPTION MANAGEMENT PORTAL
            customerSegment:
              type: array
              description: Customer segments
              items:
                type: string
                description: Customer segment
                example: employee
            isDeleted:
              type: boolean
              description: 'true: Customer is deleted<br />false: Customer is not deleted'
              example: false
            DeletedAt:
              type: string
              description: >-
                If `isDeleted`=true, time at which the customer was deleted<br
                />If `isDeleted`=false, NULL
              example: '2019-01-01T00:00:00.000Z'
            createdAt:
              type: string
              description: Time customer was created
              example: '2021-10-12T21:35:05.756Z'
            updatedAt:
              type: string
              description: Most recent time customer was updated
              example: '2021-10-14T05:40:55.997Z'
    DeactivateDiscountResponse:
      type: object
      description: Discount details after deactivation
      properties:
        responseStatus:
          description: Brief response status
          type: string
          example: OK
        message:
          description: Full response message
          type: string
          example: Request processed successfully
        data:
          description: Discount details
          type: object
          properties:
            id:
              type: string
              description: Discount ID
              example: 62d9196aeec12800095633f2
            status:
              type: string
              description: Discount status
              example: INACTIVE
              enum:
                - ACTIVE
                - INACTIVE
            offerCode:
              type: string
              description: Offer code
              example: SUB-D45DD7
            validity:
              $ref: '#/components/schemas/Validity'
            message:
              type: string
              description: Merchant discount message
              example: Offer terms and conditions
            discount:
              $ref: '#/components/schemas/Discount'
            skus:
              type: array
              description: SKUs
              items:
                type: string
                description: SKU
                example: MOBO-X570
            categories:
              type: array
              description: Product categories
              items:
                type: string
                description: Product category
                example: holiday-best-sellers
            frequency:
              $ref: '#/components/schemas/Frequency'
            itemQuantity:
              type: integer
              description: Number of items
              example: 1
            channel:
              type: string
              description: Channel
              example: WEBSITE
              enum:
                - WEBSITE
                - POS
            target:
              type: string
              description: Discount target
              example: PDP
              enum:
                - PDP
                - CART
                - QUICK VIEW
                - SUBSCRIPTION MANAGEMENT PORTAL
            customerSegment:
              type: array
              description: Customer segments
              items:
                type: string
                description: Customer segment
                example: employee
            isDeleted:
              type: boolean
              description: 'true: Customer is deleted<br />false: Customer is not deleted'
              example: false
            DeletedAt:
              type: string
              description: >-
                If `isDeleted`=true, time at which the customer was deleted<br
                />If `isDeleted`=false, NULL
              example: '2019-01-01T00:00:00.000Z'
            createdAt:
              type: string
              description: Time customer was created
              example: '2021-10-12T21:35:05.756Z'
            updatedAt:
              type: string
              description: Most recent time customer was updated
              example: '2021-10-14T05:40:55.997Z'
    badRequestError:
      type: object
      description: Bad request error
      properties:
        responseStatus:
          description: Brief response status
          type: string
          example: BAD_REQUEST
        message:
          description: Full response message
          type: string
          example: Bad request
    subscriptionBadRequestError:
      type: object
      description: Bad request error
      properties:
        responseStatus:
          description: Brief response status
          type: string
          example: BAD_REQUEST
        message:
          description: Full response message
          type: object
          properties:
            code:
              type: string
              description: Brief response code
              example: PRICE_NOT_FOUND
            message:
              type: string
              description: Error message
              example: No price entry found
    notFoundError:
      type: object
      description: Not found
      properties:
        responseStatus:
          description: Brief response status
          type: string
          example: NOT_FOUND
        message:
          description: Full response message
          type: string
          example: Not found
    notFoundSubscriptionError:
      type: object
      description: Not found
      properties:
        responseStatus:
          description: Brief response status
          type: string
          example: NOT_FOUND
        message:
          description: Full response message
          type: string
          example: Subscription not found
    unAuthError:
      type: object
      description: Unauthenticated error
      properties:
        Message:
          description: Full response message
          example: User is not authorized to access this resource with an explicit deny
          type: string
security:
  - bearerAuth: []
