# Create a wholesale order (draft by default; auto_confirm=true submits for review)

`POST /api/v1/orders` — Token required · order:write · write · 2 pts

Wholesale orders

## Request body (JSON)

| Field | Type | Description |
| --- | --- | --- |
| `warehouse_code` **required** | string | Warehouse code: AU (Australia, all warehouses — aggregate view), AUSYD2 (Sydney main, Rosehill), AUSYD1 (Sydney accessories), CN (China, all warehouses — aggregate view), CHNZJ1 (Zhenjiang). Full list: GET /api/v1/warehouses. |
| `lines` **required** | array<object> | Line array, each { sku, quantity }. At least one; quantity=0 removes the line when adjusting a reservation. (1–1000) |
| `lines[].sku` **required** | string | SKU / barcode — the **colour + size** level, e.g. OB0021611. For the whole style use product_code instead. (max length 64) |
| `lines[].quantity` **required** | integer | Quantity, a positive integer, e.g. 2. In reservation adjustments / carts, 0 removes the line. (0–99999) |
| `note` | string | Remark (optional, up to 500 characters). (max length 500) |
| `client_order_number` | string | The order number in your own system (the one you sent when creating the drop-ship order). (max length 64) |
| `auto_confirm` | boolean | Submit immediately (optional). **Omitted = draft only**, someone confirms it in the ERP before it takes effect — this default is intentional. A submitted drop-ship order is allocated at once and can no longer be edited. |
| `shipping` | object | Shipping info (required when placing a wholesale order signed in with an OMS account). Inside: shipping_method_id (see GET /api/v1/shipping-methods), address_id (see GET /api/v1/addresses), carrier_id (optional), pickup_at (only for pickup). Omit the whole object to use the defaults set on your OMS account; if none are set you get an error pointing here. |
| `shipping.shipping_method_id` | string | Shipping method id, from GET /api/v1/shipping-methods. (max length 64) |
| `shipping.carrier_id` | string | Carrier id (optional), from GET /api/v1/carriers. (max length 64) |
| `shipping.address_id` | string | Delivery address id, from GET /api/v1/addresses. The address book is maintained on the OMS site under User → Preferences. (max length 64) |
| `shipping.pickup_at` | string | Pickup time (optional, only for the pickup method), e.g. 2026-09-10T14:00:00. (max length 32) |

## Response

The envelope is decided by the HTTP status alone: 2xx with `{ data: … }` (lists also carry `page / page_size / has_more` or `total_count`); 4xx / 5xx with `{ error: { code, message, hint, request_id, doc_url } }`.

Response headers: `HTTP/1.1 201 Created`

```json
{
  "data": { "order_id": "SO2026090300123", "channel_code": "100780", "warehouse_code": "AU",
    "status": 0, "lines": [{ "sku": "OB0021611", "quantity": 2 }], "created_date": "2026-09-03" }
}
```

A success response carries no human-readable text — no `code / result / msg`. `error.code` is the only field your code should branch on; `message` follows `Accept-Language`.

> Send an `Idempotency-Key` header (any unique string, e.g. a UUID) on writes: a network retry never creates a second order. Orders are drafts by default until a person confirms them in the ERP.

## Examples

### curl

```bash
curl -X POST "https://connect.everugg.net.au/api/v1/orders" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: <uuid>" \
  -d '{ "warehouse_code": "AU", "lines": [ { "sku": "OB0021611", "quantity": 2 } ] }'
```

### Python

```python
import requests

r = requests.post(
    "https://connect.everugg.net.au/api/v1/orders",
    headers={"Authorization": "Bearer " + TOKEN, "Idempotency-Key": str(uuid.uuid4())},
    json={
      "warehouse_code": "AU",
      "lines": [
        {
          "sku": "OB0021611",
          "quantity": 2
        }
      ]
    },
)
data = r.json()
r.raise_for_status()  # 4xx/5xx: data["error"]["code"] / ["hint"]
```

### Node

```js
const res = await fetch("https://connect.everugg.net.au/api/v1/orders", {
  method: "POST",
  headers: { Authorization: `Bearer ${TOKEN}`, "Content-Type": "application/json", "Idempotency-Key": crypto.randomUUID() },
  body: JSON.stringify({
    "warehouse_code": "AU",
    "lines": [
      {
        "sku": "OB0021611",
        "quantity": 2
      }
    ]
  }),
})
const data = await res.json()
if (!res.ok) throw new Error(`${data.error?.code}: ${data.error?.message}`)
```

### Java

```java
HttpRequest req = HttpRequest.newBuilder()
    .uri(URI.create("https://connect.everugg.net.au/api/v1/orders"))
    .header("Authorization", "Bearer " + token)
    .header("Content-Type", "application/json")
    .header("Idempotency-Key", UUID.randomUUID().toString())
    .POST(HttpRequest.BodyPublishers.ofString("{ \"warehouse_code\": \"AU\", \"lines\": [ { \"sku\": \"OB0021611\", \"quantity\": 2 } ] }"))
    .build();
HttpResponse<String> res = HttpClient.newHttpClient().send(req, HttpResponse.BodyHandlers.ofString());
```

---
Markdown source: https://connect.everugg.net.au/reference/post-api-v1-orders.md?lang=en · Web page: https://connect.everugg.net.au/reference?op=post-api-v1-orders&lang=en
