# On Update endpoints (HTTP PATCH verb) (/api/using-the-api/on-update-endpoints-http-patch-verb)

How PATCH treats omitted fields, null, arrays, and addresses.

`PATCH /orders/{id}` is a partial update. What you leave out of the body is
left untouched, so you can change one nested field without resending the rest
of the order.

Three rules cover every field:

- **An omitted field is left unchanged.** An empty nested object (`{}`) is the
  same as omitting it, and a body that sets nothing returns the order
  unchanged.
- **An explicit `null` clears a nullable field.** Sending
  `{"deliveryInstructions": {"notes": null}}` removes the notes.
- **An array replaces the stored array in full.** There is no partial update of
  an array, so send the complete list you want to end up with.

Changing only the delivery notes, for example:

```bash
curl -X PATCH "https://api.spoke.com/connect/v1/orders/W3kJpzQm9q4LV2BdH7sNuT" \
  -H "Authorization: Bearer <api-key>" \
  -H "Content-Type: application/json" \
  -d '{"deliveryInstructions": {"notes": "Leave with the neighbour"}}'
```

The following rules apply when editing an order:

- **`address` is replaced, not merged.** An address you send replaces the
  stored address in full and is geocoded again exactly as on create, so it has
  to carry at least one field that can locate the delivery. Sending only `zip`
  discards the street lines rather than amending them.
- **`deliveryInstructions.handOffInfo.handOffType` cannot be cleared.** It
  accepts `pickup_by_courier`, and omitting it leaves the stored value alone.
  The deprecated `ship_to_courier` is treated as `pickup_by_courier` until a
  future API version rejects it.
- **`packageInfo.weight` is replaced as a whole.** Send `{ amount, unit }` to
  set it, `null` to clear it, or omit it to leave it unchanged. Do not send it
  together with the deprecated `packageLoadAmount` field, including null values.
- **Other nested objects cannot be `null` on an edit.** Clear the individual leaves
  instead, for example `{"deliveryInstructions": {"proofOfAttemptRequirements":
  {"enabled": null}}}`.

Only an editable order can be updated. An order becomes read-only once the
courier puts it on a route, and an order the courier added on your behalf
(`source: "courier"`) is read-only from the start. Both answer `409 Conflict`
with `code: "order_read_only"`.