# Orders to write

`GET /api/erp/v1/orders`

Sales orders waiting to be written to the ERP (max 100): the `order` body holds `ref`, `po`, `date`, `due`, `currency`, `customer` (CRM id, ERP `ext_id` / `code` — empty when there is no account, name, tax number / office, address, phone, e-mail) and `lines` (`code`, `name`, `qty`, `unit`, `price`). `claim=1` claims them (not returned again for 30 minutes); after writing to the ERP report the result with `POST /api/erp/v1/orders/{id}`.

## Query parameters

| Field | Type | Description |
|---|---|---|
| `claim` | integer | 1 = claim the orders. Values: `1` |

## Response

```json 200
{
  "ok": true,
  "orders": [
    {
      "attempts": 0,
      "created_at": "2026-10-09T23:14:44",
      "id": 1,
      "order": {
        "currency": "EUR",
        "customer": {
          "address": "Adana Organize Sanayi Bölgesi, 3. Cadde No: 12, Adana",
          "city": "Adana",
          "code": "120.01.045",
          "email": "ayse.aydin@kumsalplastik.example",
          "ext_id": "120.01.045",
          "id": 9,
          "name": "Kumsal Plastik Ambalaj San. ve Tic. A.Ş.",
          "phone": "0 (322) 000 53 49",
          "rid": "001GrgCmxBfaxaN",
          "tax_no": "4810123456",
          "tax_office": "Kozyatağı"
        },
        "date": "2026-06-12",
        "due": null,
        "kind": "Yeni Sipariş",
        "lines": [
          {
            "code": "HS30",
            "ext_id": "153.PU500",
            "name": "HS 30 Isıl Yapışma Laki",
            "price": 6.18,
            "qty": 2000.0,
            "unit": "kg"
          }
        ],
        "note": null,
        "order_id": 17,
        "owner": {
          "email": "deniz@ornekkimya.com.tr",
          "name": "Deniz Aksoy"
        },
        "payment_days": 90,
        "po": "PO-7781",
        "ref": "8015r8lSTizJbmt"
      }
    }
  ]
}
```
