> ## Documentation Index
> Fetch the complete documentation index at: https://docs.loopreturns.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Order

> Create a new order.



## OpenAPI

````yaml post /orders
openapi: 3.1.0
info:
  title: Orders API
  version: v1
  description: The Orders API allows managing your shop's orders within the Loop Platform.
  contact:
    name: Loop Returns
    url: https://loopreturns.com/
servers:
  - url: https://api.loopreturns.com/api/v1
security: []
tags:
  - name: Orders
paths:
  /orders:
    post:
      tags:
        - Orders
      summary: Create Order
      description: Create a new order.
      operationId: create-order
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateOrderRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  order:
                    $ref: '#/components/schemas/OrderResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
      security:
        - write: []
components:
  schemas:
    CreateOrderRequest:
      title: CreateOrderRequest
      type: object
      properties:
        external_id:
          type:
            - string
            - 'null'
          maxLength: 64
          examples:
            - 564400c7-7a6b-4f29-b6a5-7bb580b2992c
        name:
          type: string
          maxLength: 100
        secondary_identifier:
          type:
            - string
            - 'null'
          maxLength: 100
          description: >
            An optional secondary identifier for the order, enabling customer
            lookup by an alternate reference. Use this for any supplementary
            order ID your system tracks — for example a fulfillment system ID
            (e.g. NetSuite), a marketplace order number, or a confirmation
            number. Customers can look up their return using either name or
            secondary_identifier.
        sales_channel:
          type: string
          maxLength: 255
          examples:
            - online
            - mobile
          description: >
            Used to identify the sales channel that the order was created in. If
            a channel with this name is not already associated with the shop, it
            will be used to create a new channel.
        customer:
          type:
            - object
            - 'null'
          oneOf:
            - properties:
                id:
                  type: integer
                  format: int64
                  description: >
                    Global identifier of an existing customer. Required if
                    additional customer details are not provided.
            - properties:
                external_id:
                  type:
                    - string
                    - 'null'
                  maxLength: 64
                  examples:
                    - 564400c7-7a6b-4f29-b6a5-7bb580b2992c
                  description: >
                    If this is the only parameter, it will be used to associate
                    an existing customer with the order. If it is passed along
                    with the other properties, it will be used to create a new
                    customer.
                first_name:
                  type:
                    - string
                    - 'null'
                  maxLength: 50
                  description: Customer first name.
                last_name:
                  type:
                    - string
                    - 'null'
                  maxLength: 50
                  description: Customer last name.
                email:
                  type:
                    - string
                    - 'null'
                  maxLength: 255
                  description: Customer email address.
                phone:
                  type:
                    - string
                    - 'null'
                  maxLength: 30
                  description: Customer phone.
        status:
          type: string
          enum:
            - active
            - archived
            - cancelled
            - unknown
          description: Status of the Order.
        shipping_address:
          $ref: '#/components/schemas/Address'
        billing_address:
          $ref: '#/components/schemas/Address'
        taxes_included:
          type:
            - boolean
            - 'null'
        total_price:
          $ref: '#/components/schemas/MoneySet'
          description: >
            The price of the order in minor units, such as cents, with its
            corresponding currency.
        total_price_presentment:
          anyOf:
            - $ref: '#/components/schemas/MoneySet'
            - type: 'null'
          description: >
            The price of the order in minor units, such as cents. This is
            included if the price was shown to the customer in an alternate
            currency.
        total_discounts:
          anyOf:
            - $ref: '#/components/schemas/MoneySet'
            - type: 'null'
          description: >
            The deduction from the original order price as a way to promote
            sales, special offers, or customer loyalty rewards.
        total_discounts_presentment:
          anyOf:
            - $ref: '#/components/schemas/MoneySet'
            - type: 'null'
          description: >
            The deduction from the original order price as a way to promote
            sales, special offers, or customer loyalty rewards. This price is
            discounted from the original price according to the customer's local
            currency.
        total_taxes:
          anyOf:
            - $ref: '#/components/schemas/MoneySet'
            - type: 'null'
          description: The tax amount for the order.
        total_taxes_presentment:
          anyOf:
            - $ref: '#/components/schemas/MoneySet'
            - type: 'null'
          description: >-
            The tax amount for the order according to the customer's local
            currency.
        order_discounts:
          type: array
          items:
            $ref: '#/components/schemas/OrderDiscounts'
          description: List of discounts associated with the order.
        shipping_lines:
          type: array
          items:
            $ref: '#/components/schemas/ShippingLines'
          description: List of shipping line items associated with the order.
        refunds:
          type: array
          items:
            $ref: '#/components/schemas/RefundItems'
          description: List of refunds associated with the order.
        line_items:
          type: array
          items:
            $ref: '#/components/schemas/CreateLineItem'
          description: List of order line items associated with the order.
        fulfillments:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/Fulfillment'
          description: Fulfillment information for the order.
        source:
          type: object
          description: The source system that created the order.
          required:
            - name
          properties:
            name:
              type: string
              maxLength: 255
              description: Name of the source system (e.g. 'shopify', 'hubble').
        tags:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/TagRequestData'
        created_at:
          oneOf:
            - $ref: '#/components/schemas/Date'
            - type: 'null'
          description: >-
            The date and time the order was created in the source system.
            Required in the unstable API version; will become required in a
            future stable version.
        updated_at:
          oneOf:
            - $ref: '#/components/schemas/Date'
            - type: 'null'
        financial_status:
          type:
            - string
            - 'null'
          maxLength: 30
          enum:
            - pending
            - authorized
            - partially_paid
            - paid
            - partially_refunded
            - refunded
            - voided
            - null
          description: The financial status of the order.
        cancel_reason:
          type:
            - string
            - 'null'
          maxLength: 30
          enum:
            - customer
            - declined
            - fraud
            - inventory
            - other
            - staff
            - null
          description: The reason the order was cancelled, if applicable.
        processed_at:
          oneOf:
            - $ref: '#/components/schemas/Date'
            - type: 'null'
          description: The date and time when the order was processed in the source system.
        browser_ip:
          oneOf:
            - type: string
              format: ipv4
            - type: string
              format: ipv6
            - type: 'null'
          maxLength: 45
          description: The IP address of the browser used to place the order.
        client_details_user_agent:
          type:
            - string
            - 'null'
          maxLength: 1000
          description: The user agent string of the browser used to place the order.
        total_tip_received:
          anyOf:
            - $ref: '#/components/schemas/MoneySet'
            - type: 'null'
          description: The total tip amount received for the order.
        metadata:
          type:
            - array
            - 'null'
          description: >-
            Key/value metadata to attach to the order. A `return_id` key must
            reference a return that exists for the shop.
          items:
            type: object
            required:
              - key
              - value
            properties:
              key:
                type: string
                maxLength: 100
              value:
                description: Any value associated with the key.
        fees:
          type:
            - array
            - 'null'
          description: >-
            Fees associated with the order (for example, checkout-time
            protection offers).
          items:
            type: object
            required:
              - name
              - amount
            properties:
              name:
                type: string
                maxLength: 255
              amount:
                $ref: '#/components/schemas/MoneySet'
              presentment_amount:
                anyOf:
                  - $ref: '#/components/schemas/MoneySet'
                  - type: 'null'
              tax:
                anyOf:
                  - $ref: '#/components/schemas/MoneySet'
                  - type: 'null'
              accepted_offer_mode:
                type:
                  - array
                  - 'null'
                items:
                  type: string
              external_id:
                type:
                  - string
                  - 'null'
                maxLength: 64
      required:
        - name
        - status
        - taxes_included
        - total_price
        - line_items
        - source
        - sales_channel
    OrderResponse:
      title: OrderResponse
      type: object
      properties:
        id:
          type: integer
          format: int64
          minimum: 1
          examples:
            - 810772123123123
          readOnly: true
        external_id:
          type:
            - string
            - 'null'
          examples:
            - 564400c7-7a6b-4f29-b6a5-7bb580b2992c
        name:
          type: string
        secondary_identifier:
          type:
            - string
            - 'null'
        source:
          type:
            - string
            - 'null'
        sales_channel:
          type:
            - string
            - 'null'
          description: The name of the channel.
          examples:
            - shopify
        customer:
          type: object
          properties:
            id:
              type: integer
              description: The global identifier of the customer.
              examples:
                - 123123123123123
            external_id:
              type:
                - string
                - 'null'
              examples:
                - 564400c7-7a6b-4f29-b6a5-7bb580b2992c
            sales_channel:
              type:
                - string
                - 'null'
              description: The name of the channel associated with the customer.
              examples:
                - shopify
            first_name:
              type: string
            last_name:
              type: string
            email:
              type: string
            phone:
              type: string
        status:
          type: string
          enum:
            - active
            - archived
            - cancelled
            - unknown
          description: Status of the Order.
        shipping_address:
          $ref: '#/components/schemas/Address'
        billing_address:
          $ref: '#/components/schemas/Address'
        taxes_included:
          type: boolean
        total_price:
          $ref: '#/components/schemas/MoneySet'
          description: >
            The price of the order in minor units, such as cents, with its
            corresponding currency.
        total_price_presentment:
          $ref: '#/components/schemas/MoneySet'
          description: >
            The price of the order in minor units, such as cents. This is
            included if the price was shown to the customer in an alternate
            currency.
        total_discounts:
          $ref: '#/components/schemas/MoneySet'
          description: >
            The deduction from the original order price as a way to promote
            sales, special offers, or customer loyalty rewards.
        total_discounts_presentment:
          $ref: '#/components/schemas/MoneySet'
          description: >
            The deduction from the original order price as a way to promote
            sales, special offers, or customer loyalty rewards. This price is
            discounted from the original price according to the customer's local
            currency.
        shipping_lines:
          $ref: '#/components/schemas/ShippingLines'
          description: The shipping lines for the order.
        order_discounts:
          $ref: '#/components/schemas/OrderDiscounts'
          description: The discounts for the order.
        total_taxes:
          $ref: '#/components/schemas/MoneySet'
          description: The tax amount for the order.
        total_taxes_presentment:
          $ref: '#/components/schemas/MoneySet'
          description: >-
            The tax amount for the order according to the customer's local
            currency.
        tags:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/TagRequestData'
        refunds:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/RefundData'
        line_items:
          type: array
          items:
            $ref: '#/components/schemas/LineItem'
        fulfillments:
          type: array
          items:
            $ref: '#/components/schemas/Fulfillment'
        created_at:
          oneOf:
            - $ref: '#/components/schemas/Date'
            - type: 'null'
        updated_at:
          oneOf:
            - $ref: '#/components/schemas/Date'
            - type: 'null'
        financial_status:
          type:
            - string
            - 'null'
          enum:
            - pending
            - authorized
            - partially_paid
            - paid
            - partially_refunded
            - refunded
            - voided
            - null
          description: The financial status of the order.
        cancel_reason:
          type:
            - string
            - 'null'
          enum:
            - customer
            - declined
            - fraud
            - inventory
            - other
            - staff
            - null
          description: The reason the order was cancelled, if applicable.
        processed_at:
          oneOf:
            - $ref: '#/components/schemas/Date'
            - type: 'null'
          description: The date and time when the order was processed in the source system.
        browser_ip:
          oneOf:
            - type: string
              format: ipv4
            - type: string
              format: ipv6
            - type: 'null'
          maxLength: 45
          description: The IP address of the browser used to place the order.
        client_details_user_agent:
          type:
            - string
            - 'null'
          maxLength: 1000
          description: The user agent string of the browser used to place the order.
        total_tip_received:
          anyOf:
            - $ref: '#/components/schemas/MoneySet'
            - type: 'null'
          description: The total tip amount received for the order.
        warnings:
          type:
            - array
            - 'null'
          description: >-
            Non-fatal warnings about the order, surfaced after a successful
            write.
          items:
            type: object
            required:
              - code
              - message
            properties:
              code:
                type: string
              message:
                type: string
    Address:
      type: object
      properties:
        name:
          type:
            - string
            - 'null'
          maxLength: 100
          description: Recipient name.
        company:
          type:
            - string
            - 'null'
          maxLength: 100
          description: Recipient company.
        address1:
          type: string
          maxLength: 125
          description: Address line 1.
        address2:
          type:
            - string
            - 'null'
          maxLength: 125
          description: Address line 2.
        city:
          type:
            - string
          maxLength: 100
          description: City.
        region:
          type:
            - string
            - 'null'
          maxLength: 100
          description: State or Region.
        postal_code:
          type:
            - string
            - 'null'
          maxLength: 16
          description: Postal Code.
        country_code:
          type: string
          maxLength: 2
          description: Must be a valid 2 character country code.
      required:
        - address1
        - city
        - country_code
      examples:
        - name: John Smith
          company: Acme, Co
          address1: 123 Example St
          address2: Box 123
          city: Columbus
          region: OH
          postal_code: 12345
          country_code: US
    MoneySet:
      type: object
      examples:
        - amount: 50000
          currency_code: USD
        - amount: 25000
        - amount: 1500
          currency_code: EUR
      properties:
        amount:
          type: integer
          format: int32
          examples:
            - 25000
        currency_code:
          type:
            - string
          default: USD
          examples:
            - EUR
      required:
        - amount
        - currency_code
    OrderDiscounts:
      title: OrderDiscounts
      type: array
      items:
        $ref: '#/components/schemas/OrderDiscount'
    ShippingLines:
      title: ShippingLines
      type: array
      items:
        $ref: '#/components/schemas/ShippingLine'
    RefundItems:
      title: RefundItems
      type: array
      items:
        type: object
        required:
          - type
          - amount
        properties:
          external_id:
            type:
              - string
              - 'null'
          type:
            type:
              - string
              - 'null'
            description: Type of refund.
            enum:
              - line_item
              - shipping
              - other
          amount:
            $ref: '#/components/schemas/MoneySet'
          line_item:
            anyOf:
              - $ref: '#/components/schemas/RefundLineItem'
              - type: 'null'
          created_at:
            oneOf:
              - $ref: '#/components/schemas/Date'
              - type: 'null'
          updated_at:
            oneOf:
              - $ref: '#/components/schemas/Date'
              - type: 'null'
    CreateLineItem:
      type: object
      required:
        - product
        - unit_price
        - taxable
      properties:
        id:
          type: integer
          format: int64
          minimum: 1
          examples:
            - 810772123123125
          readOnly: true
        external_id:
          type:
            - string
            - 'null'
          maxLength: 64
          examples:
            - 564400c7-7a6b-4f29-b6a5-7bb580b2992c
        product:
          $ref: '#/components/schemas/Product'
        product_variant:
          anyOf:
            - $ref: '#/components/schemas/ProductVariant'
            - type: 'null'
        quantity:
          type:
            - integer
            - 'null'
        unit_price:
          $ref: '#/components/schemas/MoneySet'
          description: >
            The price of the order line item in minor units, such as cents, with
            its corresponding currency.
        unit_price_presentment:
          anyOf:
            - $ref: '#/components/schemas/MoneySet'
            - type: 'null'
          description: >
            The price of the order line item in minor units, such as cents. This
            is included if the price was shown to the customer in an alternate
            currency.
        unit_discounts:
          anyOf:
            - $ref: '#/components/schemas/MoneySet'
            - type: 'null'
          description: >
            The deduction from the original order line item price as a way to
            promote sales, special offers, or customer loyalty rewards.
        unit_discounts_presentment:
          anyOf:
            - $ref: '#/components/schemas/MoneySet'
            - type: 'null'
          description: >
            The deduction from the original order line item price as a way to
            promote sales, special offers, or customer loyalty rewards. This
            price is discounted from the original price according to the
            customer's local currency.
        taxable:
          type:
            - boolean
            - 'null'
        tax_lines:
          anyOf:
            - $ref: '#/components/schemas/TaxLines'
            - type: 'null'
        refunds:
          anyOf:
            - $ref: '#/components/schemas/RefundItems'
            - type: 'null'
          description: Attach a refund to this line item.
        discounts:
          oneOf:
            - $ref: '#/components/schemas/OrderLineItemDiscounts'
            - type: 'null'
        duties:
          oneOf:
            - $ref: '#/components/schemas/Duties'
            - type: 'null'
      examples:
        - external_id: 564400c7-7a6b-4f29-b6a5-7bb580b2992c
          product:
            id: 1073741824
          product_variant:
            id: 1073741824
          quantity: 500
          unit_price:
            amount: 50000
            currency_code: USD
          unit_price_presentment:
            amount: 50000
            currency_code: USD
          unit_discounts:
            amount: 50000
            currency_code: USD
          unit_discounts_presentment:
            amount: 50000
            currency_code: USD
          taxable: true
          tax_lines:
            title: OH State Tax
            rate: 2.5
            price:
              amount: 50000
              currency_code: USD
          refunds:
            external_id: refund-external-id
            type: line_item
            amount: 1000
            currency_code: USD
            line_item:
              quantity: 1
              restock: true
            created_at: '2023-04-25T13:25:00-05:00'
            updated_at: '2023-04-25T13:25:00-05:00'
          discounts:
            external_id: refund-external-id
            name: Discount Name
            discount_type: amount
            code: B1234
            reason: This is a discount reason.
            rate: 1.2
            discount_relation: x
            tax_adjustment_money:
              amount: 50000
              currency_code: USD
            net_adjustment_money:
              amount: 50000
              currency_code: USD
          duties:
            hs_code: AB123
            country_of_origin: USA
            price:
              amount: 50000
              currency_code: USD
            tax_lines:
              title: OH Municipal Tax
              rate: 2.1
              price:
                amount: 50000
                currency_code: USD
    Fulfillment:
      type: object
      required:
        - status
      properties:
        external_id:
          type:
            - string
            - 'null'
          maxLength: 64
          examples:
            - 564400c7-7a6b-4f29-b6a5-7bb580b2992c
        status:
          type: string
          enum:
            - success
            - failure
            - cancelled
            - pending
            - open
            - error
          description: >
            Status of the fulfillment:

            - `success` - The fulfillment was successful.

            - `failure` - The fulfillment request failed.

            - `cancelled` - The fulfillment was cancelled.

            - `pending` - Loop has created the fulfillment and is waiting for
            the fulfillment
              service to transition it to `open` or `success`.

            - `open` - The fulfillment has been acknowledged by the fulfillment
            service and is being processed.

            - `error` - There was an error with the fulfillment request.
        fulfilled_at:
          type:
            - string
            - 'null'
          format: date-time
          examples:
            - '2023-04-25T13:25:00-05:00'
          description: >-
            Set this field to indicate that the line item has been fulfilled, so
            it is returnable.
        shipping_carrier:
          type: string
        location:
          type:
            - object
            - 'null'
          properties:
            id:
              type: integer
              format: int64
              description: >
                Set to null to remove a location relationship or provide an
                existing location id. The id provided must belong to the
                authenticated users shop.
        fulfillment_line_items:
          $ref: '#/components/schemas/FulfillmentLineItems'
        tracking_numbers:
          type:
            - array
            - 'null'
          items:
            type: string
    TagRequestData:
      type: string
      description: A tag used to classify and group orders.
      examples:
        - VIP
    Date:
      type: string
      format: date-time
      examples:
        - '2023-04-25T13:25:00-05:00'
    RefundData:
      title: RefundData
      type: array
      items:
        $ref: '#/components/schemas/RefundItems'
    LineItem:
      type: object
      properties:
        id:
          type: integer
          format: int64
          minimum: 1
          examples:
            - 810772123123125
          readOnly: true
        external_id:
          type:
            - string
            - 'null'
          maxLength: 64
          examples:
            - 564400c7-7a6b-4f29-b6a5-7bb580b2992c
        product:
          $ref: '#/components/schemas/Product'
        product_variant:
          anyOf:
            - $ref: '#/components/schemas/ProductVariant'
            - type: 'null'
        quantity:
          type:
            - integer
            - 'null'
        unit_price:
          $ref: '#/components/schemas/MoneySet'
          description: >
            The price of the order line item in minor units, such as cents, with
            its corresponding currency.
        unit_price_presentment:
          anyOf:
            - $ref: '#/components/schemas/MoneySet'
            - type: 'null'
          description: >
            The price of the order line item in minor units, such as cents. This
            is included if the price was shown to the customer in an alternate
            currency.
        unit_discounts:
          anyOf:
            - $ref: '#/components/schemas/MoneySet'
            - type: 'null'
          description: >
            The deduction from the original order line item price as a way to
            promote sales, special offers, or customer loyalty rewards.
        unit_discounts_presentment:
          anyOf:
            - $ref: '#/components/schemas/MoneySet'
            - type: 'null'
          description: >
            The deduction from the original order line item price as a way to
            promote sales, special offers, or customer loyalty rewards. This
            price is discounted from the original price according to the
            customer's local currency.
        taxable:
          type:
            - boolean
            - 'null'
        tax_lines:
          oneOf:
            - $ref: '#/components/schemas/TaxLines'
            - type: 'null'
        refunds:
          oneOf:
            - $ref: '#/components/schemas/RefundItems'
            - type: 'null'
        discounts:
          oneOf:
            - $ref: '#/components/schemas/OrderLineItemDiscounts'
            - type: 'null'
        duties:
          oneOf:
            - $ref: '#/components/schemas/Duties'
            - type: 'null'
      examples:
        - external_id: 564400c7-7a6b-4f29-b6a5-7bb580b2992c
          product:
            id: 1073741824
          product_variant:
            id: 1073741824
          quantity: 500
          unit_price:
            amount: 50000,
            currency_code: USD,
          unit_price_presentment:
            amount: 50000,
            currency_code: USD,
          unit_discounts:
            amount: 50000,
            currency_code: USD,
          unit_discounts_presentment:
            amount: 50000,
            currency_code: USD,
          taxable: true
          tax_lines:
            title: OH State Tax
            rate: 2.5
            price:
              amount: 50000
              currency_code: USD
          refunds:
            external_id: refund-external-id
            type: line_item
            amount: 1000
            currency_code: USD
            line_item:
              quantity: 1
              restock: true
            created_at: '2023-04-25T13:25:00-05:00'
            updated_at: '2023-04-25T13:25:00-05:00'
          discounts:
            external_id: refund-external-id
            name: Discount Name
            discount_type: amount
            code: AB123
            reason: This is a discount reason.
            rate: 1.4
            discount_relation: x
            tax_adjustment_money:
              amount: 50000
              currency_code: USD
            net_adjustment_money:
              amount: 50000
              currency_code: USD
          duties:
            hs_code: HS1234
            country_of_origin: USA
            price:
              amount: 50000
              currency_code: USD
            tax_lines:
              title: OH Municipal Tax
              rate: 1.8
              price:
                amount: 50000
                currency_code: USD
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              examples:
                - '401'
            http_code:
              type: string
              examples:
                - GEN-UNAUTHORIZED
            message:
              type: string
              examples:
                - Unauthorized.
      title: ErrorResponse
    OrderDiscount:
      title: OrderDiscount
      type: object
      properties:
        external_id:
          type:
            - string
            - 'null'
          maxLength: 100
          examples:
            - 564400c7-7a6b-4f29-b6a5-7bb580b2992c
        name:
          type:
            - string
          maxLength: 64
        discount_type:
          type: string
          description: Type of discount.
          enum:
            - amount
            - bonus
            - bonus_choice
            - fixed_price
            - free
            - percentage
            - percentage_off_options
            - price_book_price
            - total_fixed_price
        code:
          type:
            - string
          maxLength: 100
        reason:
          type:
            - string
          maxLength: 512
        rate:
          type:
            - number
        tax_adjustment_money:
          $ref: '#/components/schemas/MoneySet'
        net_adjustment_money:
          $ref: '#/components/schemas/MoneySet'
    ShippingLine:
      title: ShippingLine
      type: object
      properties:
        title:
          type:
            - string
        price:
          $ref: '#/components/schemas/MoneySet'
        discounts:
          $ref: '#/components/schemas/ShippingLineDiscount'
        tax_lines:
          $ref: '#/components/schemas/TaxLines'
    RefundLineItem:
      title: RefundLineItem
      type: object
      properties:
        id:
          type:
            - integer
            - 'null'
        quantity:
          type:
            - integer
            - 'null'
        restock:
          type:
            - boolean
            - 'null'
    Product:
      type: object
      required:
        - id
      properties:
        id:
          type: integer
          format: int64
          description: The global identifier for an existing product.
    ProductVariant:
      type: object
      properties:
        id:
          type: integer
          format: int64
          description: The global identifier for an existing product.
    TaxLines:
      title: TaxLines
      type: array
      items:
        $ref: '#/components/schemas/TaxLine'
    OrderLineItemDiscounts:
      title: OrderLineItemDiscounts
      type: array
      items:
        $ref: '#/components/schemas/OrderLineItemDiscount'
    Duties:
      title: Duties
      type: array
      items:
        $ref: '#/components/schemas/Duty'
    FulfillmentLineItems:
      title: FulfillmentLineItems
      type: array
      items:
        $ref: '#/components/schemas/FulfillmentLineItem'
    ShippingLineDiscount:
      title: ShippingLineDiscount
      type: object
      properties:
        external_id:
          type:
            - string
            - 'null'
          maxLength: 64
          examples:
            - 564400c7-7a6b-4f29-b6a5-7bb580b2992c
        name:
          type:
            - string
        discount_type:
          type:
            - string
            - 'null'
          description: Type of discount.
          enum:
            - amount
            - bonus
            - bonus_choice
            - fixed_price
            - free
            - percentage
            - percentage_off_options
            - price_book_price
            - total_fixed_price
        code:
          type:
            - string
        reason:
          type:
            - string
        rate:
          type:
            - number
        net_adjustment_money:
          $ref: '#/components/schemas/MoneySet'
        tax_adjustment_money:
          $ref: '#/components/schemas/MoneySet'
    TaxLine:
      title: TaxLine
      type: object
      properties:
        title:
          type:
            - string
          maxLength: 100
        rate:
          type:
            - number
            - 'null'
        price:
          $ref: '#/components/schemas/MoneySet'
    OrderLineItemDiscount:
      title: OrderLineItemDiscount
      type: object
      properties:
        external_id:
          type:
            - string
            - 'null'
          maxLength: 100
          examples:
            - 564400c7-7a6b-4f29-b6a5-7bb580b2992c
        discount_type:
          type: string
          description: Type of discount.
          enum:
            - amount
            - bonus
            - bonus_choice
            - fixed_price
            - free
            - percentage
            - percentage_off_options
            - price_book_price
            - total_fixed_price
        discount_relation:
          type:
            - string
            - 'null'
          description: Discount Relation.
          enum:
            - prereq
            - entitled
            - x
            - 'y'
        name:
          type:
            - string
          maxLength: 64
        code:
          type:
            - string
          maxLength: 100
        reason:
          type:
            - string
          maxLength: 512
        rate:
          type:
            - number
        tax_adjustment_money:
          $ref: '#/components/schemas/MoneySet'
        net_adjustment_money:
          $ref: '#/components/schemas/MoneySet'
    Duty:
      title: Duty
      type: object
      properties:
        hs_code:
          type:
            - string
            - 'null'
          maxLength: 10
        country_of_origin:
          type:
            - string
            - 'null'
          maxLength: 2
          examples:
            - US
            - CA
        price:
          $ref: '#/components/schemas/MoneySet'
        tax_lines:
          $ref: '#/components/schemas/TaxLines'
    FulfillmentLineItem:
      title: FulfillmentLineItem
      type: object
      properties:
        external_id:
          type:
            - string
            - 'null'
          maxLength: 64
          examples:
            - 564400c7-7a6b-4f29-b6a5-7bb580b2992c
        order_line_item_external_id:
          type: string
          maxLength: 64
          examples:
            - 564400c7-7a6b-4f29-b6a5-7bb580b2992c
        quantity:
          type: integer
  responses:
    BadRequest:
      description: Response if the provided data is invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            Example 1:
              value:
                error:
                  code: '400'
                  http_code: BAD_REQUEST
                  message: The request was not readable or processable.
      headers:
        X-Loop-Request-ID:
          schema:
            type: string
          description: UUID to aid in debugging API issues.
    Unauthorized:
      description: >-
        Example response if request submitted without a valid API Key in
        X-Authorization.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
            x-examples:
              Example 1:
                errors: Unauthorized.
          examples:
            Unauthorized Error Response:
              value:
                error:
                  code: '401'
                  http_code: GEN-UNAUTHORIZED
                  message: Unauthorized.
      headers:
        X-Loop-Request-ID:
          schema:
            type: string
            examples:
              - 5a748e7c-5fcc-4fb0-a777-6a4d28e60d4c
            format: uuid
          description: UUID to aid in debugging API issues.
  securitySchemes:
    write:
      name: X-Authorization
      type: apiKey
      in: header
      description: 'API Scope: "Order (write)"'

````