# Report order result

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

Writes the order's state in the ERP. `status`: `sent` · `open` · `shipped` · `invoiced` · `closed` · `cancelled` · `error`. `ext_no` is the ERP document number (shown on the order row). Shipped / invoiced / closed closes the CRM order (connection setting); cancelled notifies the order owner. If the account was just created in the ERP, `customer_ext_id` (+ `customer_code`) stores the company match. `error` with an `error` text marks the send as failed (*Retry* in the CRM). Call again whenever the state changes.

## Path parameters

| Field | Type | Description |
|---|---|---|
| `id` (required) | integer | Send id (`GET /api/erp/v1/orders` → `id`). |

## Body

| Field | Type | Description |
|---|---|---|
| `status` (required) | string | State in the ERP. Values: `sent`, `open`, `shipped`, `invoiced`, `closed`, `cancelled`, `error` |
| `ext_no` | string | ERP document number. |
| `ext_id` | string | ERP document id. |
| `ext_status` | string | The ERP's own status text. |
| `customer_ext_id` | string | Id of the account just created in the ERP. |
| `customer_code` | string | The new account's code. |
| `error` | string | Error text when `status: error`. |

## Response

```json 200
{
  "id": 1,
  "ok": true,
  "status": "open"
}
```
