# Create an order

Creates an order.
In the response, `ref` contains the order reference. Use the order reference to interact with a specific order, for example, to retrieve it, update it, or create a data extension for it.

Endpoint: POST /v2.1/orders
Version: v2.1
Security: BasicAuth

## Security:

  - `BasicAuth` (unknown)
    http basic

## Request fields (application/json):

  - `createdAt` (string)
    The date and time when the resource was created in Sitecore CDP.
    Example: 2024-01-01T16:17:16Z

  - `modifiedAt` (string)
    The date and time when the resource was updated in Sitecore CDP.
    Example: 2024-01-01T16:17:16Z

  - `orderedAt` (string, required)
    The date and time when the order was made.
    Example: 2024-01-01T16:17:16Z

  - `currencyCode` (string, required)
    The currency the guest used to complete a purchase. Set this to the organization’s default currency.
    Example: EUR

  - `price` (number, required)
    The amount paid for the order.
    Example: 50

  - `referenceId` (string, required)
    A unique identifier generated by your organization to reference the order. For flight orders, this is often the PNR.
    Example: B94TXY-1

  - `paymentType` (string)
    The method of payment for the order.
    Example: Card

  - `cardType` (string)
    The card type used to pay for the order.
    Example: Visa

  - `pointOfSale` (string)
    The point of sale used in the order.
    Example: home

  - `channel` (string)
    The channel used in the order.
    Enum: "WEB", "MOBILE_WEB", "MOBILE_APP", "CALL_CENTER", "AIRPORT_KIOSK", "BRANCH", "KIOSK", "OFFLINE", "GDS", "OTA", "OTHER"

  - `status` (string)
    The status of the order.
    Enum: "BROWSED", "CANCELLED", "CONFIRMED", "DECLINED", "PARTIALY_CONFIRMED", "PARTIALY_REFUNDED", "PAYMENT_PENDING", "PENDING", "PURCHASED", "REFUNDED", "RESERVED", "SEARCHED", "UNKNOWN"

## Response 201:

  - `201` (unknown)
    Resource successfully created

## Response 201 fields (application/json):

  - `ref` (string)
    The order reference. This is a unique identifier of the order record. Use the order reference to interact with a specific order, for example, to retrieve it, update it, or create a data extension for it.
    Example: 2d7de9df-45a2-45ea-872c-30e45139007d

  - `href` (string)
    The link to the order.
    Example: https://api-engage-eu.sitecorecloud.io/v2.1/orders/2d7de9df-45a2-45ea-872c-30e45139007d

  - `createdAt` (string)
    The date and time when the resource was created in Sitecore CDP.
    Example: 2024-01-01T16:17:16Z

  - `modifiedAt` (string)
    The date and time when the resource was updated in Sitecore CDP.
    Example: 2024-01-01T16:17:16Z

  - `orderedAt` (string)
    The date and time when the order was made.
    Example: 2024-01-01T16:17:16Z

  - `currencyCode` (string)
    The currency the guest used to complete a purchase.
    Example: EUR

  - `price` (number)
    The amount paid for the order.
    Example: 50

  - `referenceId` (string)
    A unique identifier generated by your organization to reference the order. For flight orders, this is often the PNR.
    Example: B94TXY-1

  - `paymentType` (string)
    The method of payment for the order.
    Example: Card

  - `cardType` (string)
    The card type used to pay for the order.
    Example: Visa

  - `pointOfSale` (string)
    The point of sale used in the order.
    Example: home

  - `channel` (string)
    The channel used in the order.
    Enum: "WEB", "MOBILE_WEB", "MOBILE_APP", "CALL_CENTER", "AIRPORT_KIOSK", "BRANCH", "KIOSK", "OFFLINE", "GDS", "OTA", "OTHER"

  - `status` (string)
    The status of the order.
    Enum: "BROWSED", "CANCELLED", "CONFIRMED", "DECLINED", "PARTIALY_CONFIRMED", "PARTIALY_REFUNDED", "PAYMENT_PENDING", "PENDING", "PURCHASED", "REFUNDED", "RESERVED", "SEARCHED", "UNKNOWN"

  - `contacts` (object)
    Contact details, containing a list of items.

  - `contacts.items` (array)
    List of order contacts.
    Example: []

  - `contacts.items.href` (string)
    Example: https://api-engage-eu.sitecorecloud.io/v2.1/guests/f7aabbca-1c1b-4fc2-be72-3e16294a4f03

  - `consumers` (object)
    Consumer details, containing a list of items.

  - `consumers.items` (array)
    List of consumers.
    Example: []

  - `orderItems` (object)
    Order item details, containing a list of items.

  - `orderItems.items` (array)
    List of order items.
    Example: []

## Response 400:

  - `400` (unknown)
    Bad request

## Response 400 fields (application/json):

  - `status` (integer)
    The HTTP request status.
    Example: 400

  - `code` (integer)
    The HTTP response status code.
    Example: 400

  - `message` (string)
    Error description.
    Example: orderedAt: may not be null.

  - `developerMessage` (string)
    Error description for developers.
    Example: orderedAt: may not be null.

  - `moreInfoUrl` (string)
    URL to get more information about the error.
    Example: https://support.sitecore.com

## Response 401:

  - `401` (unknown)
    Unauthorized request

## Response 401 fields (application/json):

  - `status` (string)
    The HTTP request status.
    Example: UNAUTHORIZED

  - `code` (integer)
    The HTTP response status code.
    Example: 401

  - `message` (string)
    Error description.
    Example: Authentication credentials are required to access the resource. All requests must be authenticated.

  - `moreInfoUrl` (string)
    URL to get more information about the error.
    Example: https://support.sitecore.com

## Response 409:

  - `409` (unknown)
    Already exists

## Response 409 fields (application/json):

  - `status` (integer)
    The HTTP request status.
    Example: 409

  - `code` (integer)
    The HTTP response status code.
    Example: 409

  - `message` (string)
    The resource already exists so it can't be created.

  - `developerMessage` (string)
    Error description for developers.
    Example: Order with ref AAA-9999 and orderedAt Wed Jun 23 17:49:07 CEST 2004 for client key ... already exist

  - `moreInfoUrl` (string)
    URL to get more information about the error.
    Example: https://support.sitecore.com

