---
title: "Add 1 or more orders"
method: POST
path: "/orders"
tags: ["Orders"]
---

# Add 1 or more orders

`POST /orders`

Endpoint to add Orders

## Request body

- object[] — Orders to add
  - `poiId` integer, required — Poi id
  - `code` string, required — Order code
  - `date` string, date, required — Order date with the format YYYY-MM-DD
  - `operation` 'PEDIDO' | 'RETIRO' | 'COBRANZA', required — Order type
  - `totalAmount` number — Order total amount with taxes
  - `totalAmountWithoutTaxes` number — Order total amount without taxes
  - `label` string — Order label
  - `timeWindow` object[] — Order time windows (use User TimeZone)
    - `from` string — Window Start time
    - `to` string — Window End time
  - `priority` number — Order priority from 0 to 9
  - `assignedDeviceId` integer — Order assigned device id. Is used to group orders by device in the optimizer application
  - `statusId` number — Status for the order
  - `merchants` object[] — Merchants to attach to the order
    - `_id` integer — Merchant id
  - `orderItems` object[] — Order items
    - `productId` integer — Product id
    - `unitPrice` number — Product price
    - `productCode` string — Product code
    - `weight` number — Product weight
    - `quantity` integer — Product amount
  - `orderMeasures` object[] — Order measures
    - `constraintId` integer — Constraint id
    - `value` number — Value

## Response `200`

Order/s added
On Error, meta object will contain an error array with these possible values
### Error codes:
Code | Description | Field
----------------|-------------|-------------
1001 | Wrong time window object | timeWindow
2002 | Wrong time window values, must be string | timeWindow
2003 | Wrong time window, 'from' must be less than 'to' | timeWindow
2004 | Wrong time window, times are overlapped | timeWindow
2020 | Order code already present for this user | code
2021 | Order code not found or not allowed for this user | code
2026 | Invalid operation type | operation
2032 | Poi id not found or not allowed for this user | poiId
2037 | totalAmount must be greater than zero and not empty | totalAmount
2038 | orderItems and orderMeasures are not allowed for collection orders | orderItems, orderMeasures
2039 | orderStatus not found or not allowed for this user | statusId
2051 | Merchant id not found or not allowed for this user | merchants
2052 | Exceeded limit of 3 emails per order | merchants
2054 | subStatus not found or not allowed for this user | subSstatusId

- object
  - `meta` unknown
  - `data` object[] — Orders added
    - `poiId` integer — Poi id
    - `code` string — Order code
    - `date` string, date — Order date with the format YYYY-MM-DD
    - `operation` 'PEDIDO' | 'RETIRO' | 'COBRANZA' — Order type
    - `qtn` string — Quadminds tracking number (Track & Trace)
    - `totalAmount` number — Order total amount with taxes
    - `totalAmountWithoutTaxes` number — Order total amount without taxes
    - `label` string — Order label
    - `timeWindow` object[] — Order time windows (use User TimeZone)
      - `from` string — Window Start time
      - `to` string — Window End time
    - `priority` number — Order priority from 0 to 9
    - `assignedDeviceId` integer — Order assigned device id. Is used to group orders by device in the optimizer application
    - `statusId` number — Status for the order
    - `merchants` object[] — Merchants to attach to the order
      - `_id` integer — Merchant id
    - `orderItems` object[] — Order items
      - `orderId` integer — Order id
      - `productId` integer — Product id
      - `productCode` string — Product code
      - `quantity` integer — Product amount
      - `deliveredQuantity` integer — Delivered product amount
      - `weight` integer — Product weight
      - `deliveredWeight` integer — Delivered product weight
      - `unitPrice` number — Product price
    - `orderMeasures` object[] — Order measures
      - `orderId` integer — Order id
      - `constraintId` integer — Constraint id
      - `value` number — Value

## Other responses

- `403` — Not authorized access

---

[API](https://skmtc.net/quadminds/apis/quadminds-api-v2.md) · [All operations](https://skmtc.net/quadminds/apis/quadminds-api-v2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/quadminds/quadminds-api-v2/versions/e0ab56dece05/schema)
