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

# Create order



## OpenAPI

````yaml post /v1/orders
openapi: 3.0.0
info:
  title: Orders Service
  description: Orders service API
  version: 1.0.0
  contact: {}
servers:
  - url: https://api.production.orderprotection.com
    description: Production server
security: []
tags:
  - name: orders
    description: ''
paths:
  /v1/orders:
    post:
      tags:
        - Orders
      summary: Create order
      operationId: OrdersApiController_createOrder
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrderCreateDto'
      responses:
        '201':
          description: The order passes validation and has been successfully created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OkStatusResponse'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedExceptionResponse'
        '409':
          description: Order with same sourceOrderId already exist.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiExceptionResponse'
      security:
        - bearer: []
components:
  schemas:
    OrderCreateDto:
      type: object
      required:
        - sourceOrderId
        - sourceOrderNumber
        - currency
        - sourceCreatedAt
        - total
        - subtotal
        - customerEmail
        - customerName
      properties:
        sourceOrderId:
          type: string
          example: '#517AB'
          description: Order ID on your platform
        originalSourceOrderId:
          type: string
          example: '12345'
          description: >-
            If this was a replacement for another Order, you can include the
            original order id here.
        sourceOrderNumber:
          type: string
          example: '#634C'
          description: Order Number on your platform
        sourceCreatedAt:
          format: date-time
          type: string
          example: '2000-05-15T21:00:00.000Z'
          description: Creation date of the order on your platform
        sourceUpdatedAt:
          format: date-time
          type: string
          example: '2000-05-15T21:00:00.000Z'
          nullable: true
          description: Updated date of the order on your platform
        sourceCancelledAt:
          format: date-time
          type: string
          example: '2000-05-15T21:00:00.000Z'
          nullable: true
          description: Cancellation date of the order on your platform
        policyCancelledAt:
          format: date-time
          type: string
          nullable: true
          example: '2024-03-20T12:00:00.000Z'
          description: Date when the policy was cancelled
        platformId:
          type: string
          example: api
          enum:
            - shopify
            - woocommerce
            - magento
            - bigcommerce
            - api
          description: Platform identifier
        premiumPaid:
          type: number
          example: 1.5
          description: Premium paid after discounts
        premiumCost:
          type: number
          example: 1
          description: Gross cost of revenue
        premiumDiscount:
          type: number
          example: 1
          description: Premium Discount
        currency:
          type: string
          example: USD
          enum:
            - ADP
            - AED
            - AFA
            - AFN
            - ALK
            - ALL
            - AMD
            - ANG
            - AOA
            - AOK
            - AON
            - AOR
            - ARA
            - ARP
            - ARS
            - ARY
            - ATS
            - AUD
            - AWG
            - AYM
            - AZM
            - AZN
            - BAD
            - BAM
            - BBD
            - BDT
            - BEC
            - BEF
            - BEL
            - BGJ
            - BGK
            - BGL
            - BGN
            - BHD
            - BIF
            - BMD
            - BND
            - BOB
            - BOP
            - BOV
            - BRB
            - BRC
            - BRE
            - BRL
            - BRN
            - BRR
            - BSD
            - BTN
            - BUK
            - BWP
            - BYB
            - BYN
            - BYR
            - BZD
            - CAD
            - CDF
            - CHC
            - CHE
            - CHF
            - CHW
            - CLF
            - CLP
            - CNY
            - COP
            - COU
            - CRC
            - CSD
            - CSJ
            - CSK
            - CUC
            - CUP
            - CVE
            - CYP
            - CZK
            - DDM
            - DEM
            - DJF
            - DKK
            - DOP
            - DZD
            - ECS
            - ECV
            - EEK
            - EGP
            - ERN
            - ESA
            - ESB
            - ESP
            - ETB
            - EUR
            - FIM
            - FJD
            - FKP
            - FRF
            - GBP
            - GEK
            - GEL
            - GHC
            - GHP
            - GHS
            - GIP
            - GMD
            - GNE
            - GNF
            - GNS
            - GQE
            - GRD
            - GTQ
            - GWE
            - GWP
            - GYD
            - HKD
            - HNL
            - HRD
            - HRK
            - HTG
            - HUF
            - IDR
            - IEP
            - ILP
            - ILR
            - ILS
            - INR
            - IQD
            - IRR
            - ISJ
            - ISK
            - ITL
            - JMD
            - JOD
            - JPY
            - KES
            - KGS
            - KHR
            - KMF
            - KPW
            - KRW
            - KWD
            - KYD
            - KZT
            - LAJ
            - LAK
            - LBP
            - LKR
            - LRD
            - LSL
            - LSM
            - LTL
            - LTT
            - LUC
            - LUF
            - LUL
            - LVL
            - LVR
            - LYD
            - MAD
            - MDL
            - MGA
            - MGF
            - MKD
            - MLF
            - MMK
            - MNT
            - MOP
            - MRO
            - MRU
            - MTL
            - MTP
            - MUR
            - MVQ
            - MVR
            - MWK
            - MXN
            - MXP
            - MXV
            - MYR
            - MZE
            - MZM
            - MZN
            - NAD
            - NGN
            - NIC
            - NIO
            - NLG
            - NOK
            - NPR
            - NZD
            - OMR
            - PAB
            - PEH
            - PEI
            - PEN
            - PES
            - PGK
            - PHP
            - PKR
            - PLN
            - PLZ
            - PTE
            - PYG
            - QAR
            - RHD
            - ROK
            - ROL
            - RON
            - RSD
            - RUB
            - RUR
            - RWF
            - SAR
            - SBD
            - SCR
            - SDD
            - SDG
            - SDP
            - SEK
            - SGD
            - SHP
            - SIT
            - SKK
            - SLL
            - SOS
            - SRD
            - SRG
            - SSP
            - STD
            - STN
            - SUR
            - SVC
            - SYP
            - SZL
            - THB
            - TJR
            - TJS
            - TMM
            - TMT
            - TND
            - TOP
            - TPE
            - TRL
            - TRY
            - TTD
            - TWD
            - TZS
            - UAH
            - UAK
            - UGS
            - UGW
            - UGX
            - USD
            - USN
            - USS
            - UYI
            - UYN
            - UYP
            - UYU
            - UYW
            - UZS
            - VEB
            - VEF
            - VES
            - VNC
            - VND
            - VUV
            - WST
            - XAF
            - XAG
            - XAU
            - XBA
            - XBB
            - XBC
            - XBD
            - XCD
            - XDR
            - XEU
            - XFO
            - XFU
            - XOF
            - XPD
            - XPF
            - XPT
            - XRE
            - XSU
            - XTS
            - XUA
            - XXX
            - YDD
            - YER
            - YUD
            - YUM
            - YUN
            - ZAL
            - ZAR
            - ZMK
            - ZMW
            - ZRN
            - ZRZ
            - ZWC
            - ZWD
            - ZWL
            - ZWN
            - ZWR
          description: Order currency
        total:
          type: number
          example: 15.4
          description: Order total
        discountTotal:
          type: number
          example: 1.2
          description: Order discount
        customerIp:
          type: string
          example: 123.123.123.123
          nullable: true
          description: Customer IP address
        exchangeRate:
          type: number
          example: 1.024
          nullable: true
          description: >-
            This should only be set if the store currency is `USD` and the order
            currency is not `USD`
        shippingCost:
          type: number
          example: 3.5
          description: Order shipping cost
        tax:
          type: number
          example: 0.55
          description: Order tax
        subtotal:
          type: number
          example: 11.3
          description: Order subtotal
        customerEmail:
          type: string
          example: john@doe.com
          description: Customer email
        customerName:
          type: string
          example: John
          description: Customer name
        customerPhone:
          type: string
          example: +1-555-796-3644
          description: Customer phone number
        shippingCostTax:
          type: number
          example: 234
          description: Tax associated with shipping
        orderItems:
          example:
            - productName: Handcrafted Wooden Table
              productUrl: https://bogus-clarity.name/
              productImage: https://bogus-clarity.name/product/image.jpg
              sku: 978-0-10-081434-9
              quantity: 4
              price: 45.43
              sourceItemId: '387179'
              sourceProductId: '477353'
              sourceVariantId: '17742'
              description: 'Variant: White Oak. Size: 10''x10'''
            - productName: Another prod
              productUrl: https://test.site/
              sku: '5555'
              quantity: 4
              price: 45.43
              sourceItemId: '387180'
              sourceProductId: '477353'
              sourceVariantId: '17742'
              description: 'Variant: White Oak. Size: 10''x10'''
          description: Array of product items
          type: array
          items:
            $ref: '#/components/schemas/OrderItemDto'
        address:
          type: array
          items:
            type: object
            required:
              - firstName
              - lastName
              - address1
              - city
              - state
              - zip
              - country
              - type
            properties:
              firstName:
                type: string
                example: Milford
              lastName:
                type: string
                example: Mayert
              address1:
                type: string
                example: 991 Nicolas Landing
              address2:
                type: string
                example: Apt. 796
                nullable: true
              city:
                type: string
                example: Rippinfurt
              state:
                type: string
                example: AZ
              stateAbr:
                type: string
                example: AZ
              zip:
                type: string
                example: '08731'
              country:
                type: string
                example: US
              type:
                type: string
                enum:
                  - BILLING
                  - SHIPPING
                example: SHIPPING
              lat:
                type: number
                example: 40.7128
                nullable: true
              lng:
                type: number
                example: -74.006
                nullable: true
          description: Shipping or Billing Address
    OkStatusResponse:
      type: object
      properties:
        status:
          type: string
          readOnly: true
          deprecated: false
          example: ok
      required:
        - status
    UnauthorizedExceptionResponse:
      type: object
      properties:
        message:
          type: string
          readOnly: true
          example: Unauthorized
        statusCode:
          type: number
          readOnly: true
          example: 401
      required:
        - message
        - statusCode
    ApiExceptionResponse:
      type: object
      properties:
        message:
          type: string
          readOnly: true
          example: order not found
        error:
          type: string
          readOnly: true
          example: Not Found
        statusCode:
          type: number
          readOnly: true
          example: 404
      required:
        - message
        - error
        - statusCode
    OrderItemDto:
      type: object
      properties:
        productName:
          type: string
          example: Handcrafted Soft Mouse
          description: Product name
        productUrl:
          type: string
          example: https://example.net/product/5
          description: Product URL
        productImage:
          type: string
          example: https://example.net/product/5/image.jpg
          description: Product Image URL
        sku:
          type: string
          example: 978-0-279-23986-8
          description: Product sku
        itemDescription:
          type: string
          example: 'Color: White. Size: 12'
          nullable: true
          description: >-
            Product variant information to help determine which item was
            purchased
        quantity:
          type: number
          example: 2
          description: Product quantity
        price:
          type: number
          example: 1050
          description: Product price
        discount:
          type: number
          example: 1050
          description: Product discount
        tax:
          type: number
          example: 1050
          description: Product tax
        sourceItemId:
          type: string
          example: '396568'
          description: Product source item id
        sourceProductId:
          type: string
          example: '164073'
          description: Product source product id
        sourceVariantId:
          type: string
          example: '449493'
          description: Product source variant id
        refundedQuantity:
          type: number
          example: 1
          description: Quantity of items refunded
        selectedOptions:
          example:
            - name: Size
              value: XS
          default: []
          description: Options associated with a variant. e.g. size, color
          type: array
          items:
            $ref: '#/components/schemas/SelectedOptions'
      required:
        - productName
        - productUrl
        - productImage
        - sku
        - quantity
        - price
        - discount
        - tax
        - sourceItemId
        - sourceProductId
        - sourceVariantId
    SelectedOptions:
      type: object
      properties:
        name:
          type: string
          example: Size
          description: Name associated with the selected option. e.g. size, color
        value:
          type: string
          example: XL
          description: Value associated with the name e.g. XS, Orange
      required:
        - name
        - value
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      type: http

````