## Create Customer Orders

**post** `/api/v2/public/stores/{store_number}/orders/customerorders`

Creates customer orders and their lines for one store. Every `product_number` must already exist in the catalogue; an unknown one rejects the whole request. Setting `flush` to true first deletes all existing customer orders and lines for the stores in the request, so only use it when you are sending the complete set.

### Path Parameters

- `store_number: string`

### Query Parameters

- `flush: optional boolean`

  Deletes all existing customer orders for the stores in the request before inserting.

### Body Parameters

- `orders: optional array of object { order_number, customer_city, customer_country, 23 more }`

  - `order_number: string`

  - `customer_city: optional string`

  - `customer_country: optional string`

  - `customer_email: optional string`

  - `customer_name: optional string`

  - `customer_number: optional string`

  - `customer_phone: optional string`

  - `customer_street: optional string`

  - `customer_zipcode: optional string`

  - `delivery_city: optional string`

  - `delivery_country: optional string`

  - `delivery_street: optional string`

  - `delivery_zipcode: optional string`

  - `description: optional string`

  - `file_name: optional string`

  - `is_active: optional boolean`

  - `is_picked: optional boolean`

  - `is_rejected: optional boolean`

  - `order_comment: optional string`

  - `order_lines: optional array of object { line_number, product_number, quantity, 14 more }`

    - `line_number: number`

    - `product_number: string`

    - `quantity: number`

    - `barcode: optional string`

    - `delivery_date: optional string`

    - `description: optional string`

    - `full_fillment_status: optional string`

    - `is_picked: optional boolean`

    - `is_picked_from_warehouse: optional boolean`

    - `ordering_datetime: optional string`

    - `picked_quantity: optional number`

    - `picking_stock_pool_array: optional array of string`

    - `pickup_date: optional string`

    - `preferred_location_code: optional string`

    - `price: optional number`

    - `reference: optional string`

    - `stock_pool: optional number`

  - `order_type: optional string`

  - `order_type_code: optional string`

  - `order_type_description: optional string`

  - `reference: optional string`

  - `sales_order_id: optional string`

  - `status_id: optional number`

### Returns

- `success: boolean`

  Indicates whether the operation completed successfully.

- `data: optional string`

  Optional data payload returned by the operation.

- `message: optional string`

  Human-readable message describing the result.

### Example

```http
curl https://api.colleqtive.net/api/v2/public/stores/$STORE_NUMBER/orders/customerorders \
    -X POST \
    -H "Authorization: $COLLEQTIVE_BEARER_TOKEN"
```

#### Response

```json
{
  "success": true,
  "data": "data",
  "message": "message"
}
```
