# Drop-ship pre-allocation: per line, whether it can be filled, how much is short, when pre-sale stock arrives and what is payable

`POST /api/v1/dropship-orders/allocation-preview` — Token required · df:write · write · 2 pts

Drop-ship orders

Drop-ship pre-allocation: per line, whether it can be filled, how much is short, when pre-sale stock arrives and what is payable. Note: pre-allocation holds stock — submit, or call DELETE …/{dropship_order_id}/allocation to release it

## 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. |
| `dropship_order_ids` **required** | array<string> | Array of drop-ship serial numbers (the serial_number returned when the line was created). Up to 200 per call. (1–200) |
| `use_reservation` | boolean | Whether to draw on your reserved (locked) stock for this allocation. Omit = do not use it. |

## 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 } }`.

```json
{
  "data": { … }
}
```

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/dropship-orders/allocation-preview" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: <uuid>" \
  -d '{ "warehouse_code": "AU", "dropship_order_ids": [ "<dropship_order_id>" ] }'
```

### Python

```python
import requests

r = requests.post(
    "https://connect.everugg.net.au/api/v1/dropship-orders/allocation-preview",
    headers={"Authorization": "Bearer " + TOKEN, "Idempotency-Key": str(uuid.uuid4())},
    json={
      "warehouse_code": "AU",
      "dropship_order_ids": [
        "<dropship_order_id>"
      ]
    },
)
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/dropship-orders/allocation-preview", {
  method: "POST",
  headers: { Authorization: `Bearer ${TOKEN}`, "Content-Type": "application/json", "Idempotency-Key": crypto.randomUUID() },
  body: JSON.stringify({
    "warehouse_code": "AU",
    "dropship_order_ids": [
      "<dropship_order_id>"
    ]
  }),
})
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/dropship-orders/allocation-preview"))
    .header("Authorization", "Bearer " + token)
    .header("Content-Type", "application/json")
    .header("Idempotency-Key", UUID.randomUUID().toString())
    .POST(HttpRequest.BodyPublishers.ofString("{ \"warehouse_code\": \"AU\", \"dropship_order_ids\": [ \"<dropship_order_id>\" ] }"))
    .build();
HttpResponse<String> res = HttpClient.newHttpClient().send(req, HttpResponse.BodyHandlers.ofString());
```

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