# Customer PO number

`POST /api/v1/orders/{id}/po`

Writes the order's customer purchase-order number (`customer_po`), or clears it when empty; whitespace is collapsed, at most 60 characters. On an order already sent to the ERP (`sent`, `open`, `shipped`, `invoiced`, `closed`) the answer is 409 — change the number in the ERP. The response is the updated order row (`order`) and whether it changed (`changed`). Order rows (`orders` on company / opportunity records) carry `customer_po`, `product_id` (for live stock), `status`, `due_date`, `amount` and the ERP send state (`erp`: `status`, `label`, `tone`, `ext_no`, `error`; `null` when not sent).

## Path parameters

| Field | Type | Description |
|---|---|---|
| `id` (required) | integer | Order id. |

## Body

| Field | Type | Description |
|---|---|---|
| `customer_po` | string | The customer's PO number; empty = clear. |

## Response

```json 200
{
  "changed": true,
  "ok": true,
  "order": {
    "amount": 24720.0,
    "currency": "EUR",
    "customer_id": 9,
    "customer_po": "PO-7790",
    "date": "2026-09-23",
    "due_date": null,
    "erp": null,
    "id": 16,
    "kg": 4000.0,
    "kind": "Yeni Sipariş",
    "note": "",
    "opp_id": 52,
    "payment_days": 90,
    "price": 6.18,
    "product": "HS 30 Isıl Yapışma Laki",
    "product_id": 5,
    "pu": "€/kg",
    "status": "Kapandı",
    "unit": "kg"
  }
}
```
