---
title: "Update order by id"
method: PATCH
path: "/orders/{id}"
tags: ["Orders"]
---

# Update order by id

`PATCH /orders/{id}`

Update order by id

## Path parameters

- `id` integer, required

## Request body

- object
  - `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

## Response `200`

Updated order

- object
  - `meta` object
    - `error` number — Error number
    - `message` string — Error message
  - `data` object
    - `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

## Other responses

- `400` — On Error, response will contain an error and message with these posible 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
- `403` — Not authorized access
- `404` — Not found

---

[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)
