# Orders

> Send orders to NinjaBuy, follow each line from purchase to delivery, and cancel them.

Source: https://www.ninjabuy.com/business/docs/api/orders

A sale of yours that we buy from the seller, check in our warehouse and ship to your customer, paid from your balance. Use it for WooCommerce, your own site, or anything else that sells; orders from your eBay account and Shopify store reach us without it.

Follow an order with webhooks rather than polling: [order events](https://www.ninjabuy.com/business/docs/webhooks.md#events) fire with source api when an order reaches us, is paid for, bought, held, cancelled and shipped, the last with its tracking.

Endpoints

- POST /v1/orders Create an order
- GET /v1/orders List orders
- GET /v1/orders/{id} Retrieve an order
- POST /v1/orders/{id}/cancel Cancel an order

## The Order object

- `id` string

  Starts ord\_.

- `external_id` string

  Your store's order number. Unique on your team.

- `source` string

  api.

- `store` string|null

  The connected WooCommerce site that sent it, like acme-goods.com; null for a key you made yourself.

- `status` string

  How far it got; see Statuses below.

- `payment_status` string

  unpaid, awaiting\_payment (your balance is short), or paid once the goods are paid for.

- `lane` string

  saver or fast.

- `lines[]` array

  variant, sku, title, quantity (items you sold) and units (bought per item). A line's variant id orders the same SKU again.

- `ship_to` object

  Your customer's name, address and phone. After the order’s retention period ends, only the destination country is kept.

- `hold` object|null

  While it waits for you: step (buy or ship), code (INSUFFICIENT\_FUNDS, MARGIN\_FLOOR, or the reason it was refused) and reason, in words you can show.

- `amount_due` money|null

  What your balance is short by, while awaiting\_payment.

- `charges` object

  What your balance paid, in CN¥: goods (the items, intake fee and tax), shipping (the parcel to your customer) and their total. Each is null until it is paid.

- `ninjabuy_orders` object

  The NinjaBuy orders that paid for it, goods and shipping, with their numbers on ninjabuy.com.

- `shipment` object|null

  Its parcel once placed: id (shp\_) and tracking\[] (number, url) once it ships.

- `cancel_reason` string|null

  The reason you sent when you cancelled it.

order

```json
{  "id": "ord_jd7f3k9m2x4q8w6e5r1t0y2u3i7o9p",  "external_id": "1012",  "source": "api",  "store": null,  "status": "checked",  "payment_status": "paid",  "lane": "saver",  "lines": [    {      "variant": "var_d2VpZGlhbi03NzUwOTcwODU2OjUxODcyMDk1NTQ",      "sku": "5187209554",      "title": "Heavyweight washed hoodie (Black / M)",      "quantity": 1,      "units": 1    }  ],  "ship_to": {    "name": "Sam Rivera",    "line1": "500 Congress Ave",    "line2": null,    "city": "Austin",    "region": "TX",    "postal_code": "78701",    "country": "US",    "phone": "+15125550142"  },  "hold": null,  "amount_due": null,  "charges": {    "goods": { "amount": "57.00", "currency": "CNY" },    "shipping": { "amount": "133.38", "currency": "CNY" },    "total": { "amount": "190.38", "currency": "CNY" }  },  "ninjabuy_orders": {    "goods": {      "id": "kh72v8w3n5q9r2t4y6u8i0o1p3a5s7d9",      "number": 18042    },    "shipping": {      "id": "kh79m2x4q8w6e5r1t0y2u3i7o9p1a3s5",      "number": 18107    }  },  "shipment": {    "id": "shp_kx81c4v6b8n0m2q4w6e8r0t2y4u6i8o0",    "tracking": []  },  "cancel_reason": null,  "created_at": "2026-11-01T09:14:02.000Z",  "updated_at": "2026-11-02T03:20:11.000Z"}
```

## Create an order

POST /v1/orders

Send one of your store's orders to us. Each line is a variant id an earlier order answered, or a listing link and the SKU to buy. It goes to your team's auto-buy, exactly as an eBay or Shopify order does: we buy it from the seller and pay from your balance, then ship and pay the parcel once it reaches our warehouse.

The answer is `201` with the order as `pending`; buying starts at once. One your balance cannot cover waits as `awaiting_payment` with `amount_due` and goes ahead by itself when you top up.

Turn auto-buy on first, in Business → Products → Orders: while it is off an order is refused, never left waiting. Only a key made by your team's owner or an admin can send orders, since they spend the balance.

Scope orders:write

### Body

- `external_id` string required

  Your order number, 1 to 64 printable characters. A second order with it is refused.

- `lines[]` array required

  1 to 50 lines, each variant and quantity, or url, sku and quantity (1 to 100). units (optional, 1 to 50) buys that many per item, for packs.

- `ship_to` object required

  name, line1 and country (two letters) are required; line2, city, region, postal\_code and phone as the address has them. email is accepted and not stored.

- `lane` string

  saver or fast. saver when left out.

### Errors

| Status | Type            | When                                                                                         |
| ------ | --------------- | -------------------------------------------------------------------------------------------- |
| 400    | bad-body        | A field is missing or wrong; errors\[] points at it.                                         |
| 403    | forbidden       | The key's creator is no longer the team's owner or an admin.                                 |
| 409    | duplicate-order | external\_id is already an order on your team; order names it.                               |
| 409    | auto-buy-off    | Your team's auto-buy is off.                                                                 |
| 422    | unprocessable   | A line's SKU is sold out or unknown, its link cannot be read, or its variant id is not ours. |
| 422    | not-shippable   | No published rate reaches ship\_to.country on that lane.                                     |

```bash
curl -X POST "https://www.ninjabuy.com/api/v1/orders" \  -H "Authorization: Bearer " \  -H "NinjaBuy-Version: 2026-11" \  -H "Idempotency-Key: $(uuidgen)" \  -H "Content-Type: application/json" \  -d '{    "external_id": "1012",    "lines": [      {        "variant": "var_d2VpZGlhbi03NzUwOTcwODU2OjUxODcyMDk1NTQ",        "quantity": 1      }    ],    "ship_to": {      "name": "Sam Rivera",      "line1": "500 Congress Ave",      "city": "Austin",      "region": "TX",      "postal_code": "78701",      "country": "US",      "phone": "+15125550142"    },    "lane": "saver"  }'
```

Response · 201

```
HTTP/2 201 Created​{  "id": "ord_jd7f3k9m2x4q8w6e5r1t0y2u3i7o9p",  "external_id": "1012",  "source": "api",  "store": null,  "status": "pending",  "payment_status": "unpaid",  "lane": "saver",  "lines": [    {      "variant": "var_d2VpZGlhbi03NzUwOTcwODU2OjUxODcyMDk1NTQ",      "sku": "5187209554",      "title": "Heavyweight washed hoodie (Black / M)",      "quantity": 1,      "units": 1    }  ],  "ship_to": {    "name": "Sam Rivera",    "line1": "500 Congress Ave",    "line2": null,    "city": "Austin",    "region": "TX",    "postal_code": "78701",    "country": "US",    "phone": "+15125550142"  },  "hold": null,  "amount_due": null,  "charges": {    "goods": null,    "shipping": null,    "total": { "amount": "0.00", "currency": "CNY" }  },  "ninjabuy_orders": { "goods": null, "shipping": null },  "shipment": null,  "cancel_reason": null,  "created_at": "2026-11-01T09:14:02.000Z",  "updated_at": "2026-11-01T09:14:02.000Z"}
```

## List orders

GET /v1/orders

Your team's API orders, newest first.

Scope orders:read

### Query parameters

- `external_id` string

  Optional. Find one by your own order number.

- `created_since` string

  Optional. An ISO 8601 time.

- `status` string

  Optional. One of the statuses below. A page can then hold fewer than limit.

- `source` string

  Optional. api: every order here is one you sent.

- `limit, cursor`

  [Pagination](https://www.ninjabuy.com/business/docs/api.md#pagination)

```bash
curl "https://www.ninjabuy.com/api/v1/orders?limit=25" \  -H "Authorization: Bearer " \  -H "NinjaBuy-Version: 2026-11"
```

Response · 200

```
HTTP/2 200 OK​{  "data": [    {      "id": "ord_jd7f3k9m2x4q8w6e5r1t0y2u3i7o9p",      "external_id": "1012",      "source": "api",      "store": null,      "status": "checked",      "payment_status": "paid",      "lane": "saver",      "lines": [        {          "variant": "var_d2VpZGlhbi03NzUwOTcwODU2OjUxODcyMDk1NTQ",          "sku": "5187209554",          "title": "Heavyweight washed hoodie (Black / M)",          "quantity": 1,          "units": 1        }      ],      "ship_to": {        "name": "Sam Rivera",        "line1": "500 Congress Ave",        "line2": null,        "city": "Austin",        "region": "TX",        "postal_code": "78701",        "country": "US",        "phone": "+15125550142"      },      "hold": null,      "amount_due": null,      "charges": {        "goods": { "amount": "57.00", "currency": "CNY" },        "shipping": { "amount": "133.38", "currency": "CNY" },        "total": { "amount": "190.38", "currency": "CNY" }      },      "ninjabuy_orders": {        "goods": {          "id": "kh72v8w3n5q9r2t4y6u8i0o1p3a5s7d9",          "number": 18042        },        "shipping": {          "id": "kh79m2x4q8w6e5r1t0y2u3i7o9p1a3s5",          "number": 18107        }      },      "shipment": {        "id": "shp_kx81c4v6b8n0m2q4w6e8r0t2y4u6i8o0",        "tracking": []      },      "cancel_reason": null,      "created_at": "2026-11-01T09:14:02.000Z",      "updated_at": "2026-11-02T03:20:11.000Z"    }  ],  "has_more": false,  "cursor": null}
```

## Retrieve an order

GET /v1/orders/{id}

Where it stands, what it cost, and its parcel and tracking.

Scope orders:read

### Path parameters

- `id` string required

  The order's id.

### Errors

| Status | Type      | When                        |
| ------ | --------- | --------------------------- |
| 404    | not-found | No such order on your team. |

```bash
curl "https://www.ninjabuy.com/api/v1/orders/ord_jd7f3k9m2x4q8w6e5r1t0y2u3i7o9p" \  -H "Authorization: Bearer " \  -H "NinjaBuy-Version: 2026-11"
```

Response · 200

```
HTTP/2 200 OK​{  "id": "ord_jd7f3k9m2x4q8w6e5r1t0y2u3i7o9p",  "external_id": "1012",  "source": "api",  "store": null,  "status": "checked",  "payment_status": "paid",  "lane": "saver",  "lines": [    {      "variant": "var_d2VpZGlhbi03NzUwOTcwODU2OjUxODcyMDk1NTQ",      "sku": "5187209554",      "title": "Heavyweight washed hoodie (Black / M)",      "quantity": 1,      "units": 1    }  ],  "ship_to": {    "name": "Sam Rivera",    "line1": "500 Congress Ave",    "line2": null,    "city": "Austin",    "region": "TX",    "postal_code": "78701",    "country": "US",    "phone": "+15125550142"  },  "hold": null,  "amount_due": null,  "charges": {    "goods": { "amount": "57.00", "currency": "CNY" },    "shipping": { "amount": "133.38", "currency": "CNY" },    "total": { "amount": "190.38", "currency": "CNY" }  },  "ninjabuy_orders": {    "goods": {      "id": "kh72v8w3n5q9r2t4y6u8i0o1p3a5s7d9",      "number": 18042    },    "shipping": {      "id": "kh79m2x4q8w6e5r1t0y2u3i7o9p1a3s5",      "number": 18107    }  },  "shipment": {    "id": "shp_kx81c4v6b8n0m2q4w6e8r0t2y4u6i8o0",    "tracking": []  },  "cancel_reason": null,  "created_at": "2026-11-01T09:14:02.000Z",  "updated_at": "2026-11-02T03:20:11.000Z"}
```

## Cancel an order

POST /v1/orders/{id}/cancel

Before we buy, nothing is bought. Once bought, a parcel not yet packed is cancelled and its charge goes back to your balance, and we ask the seller to cancel what has not reached our warehouse; what they take back is refunded to your balance once our team settles it. Items already here stay in your warehouse. A packed or shipped order cannot be cancelled. Cancelling twice answers the cancelled order.

Scope orders:write

### Path parameters

- `id` string required

  The order's id.

### Body

- `reason` string

  Optional, up to 500 characters. Kept on the order.

### Errors

| Status | Type          | When                                 |
| ------ | ------------- | ------------------------------------ |
| 404    | not-found     | No such order on your team.          |
| 409    | invalid-state | Its parcel is packed or has shipped. |

```bash
curl -X POST "https://www.ninjabuy.com/api/v1/orders/ord_jd7f3k9m2x4q8w6e5r1t0y2u3i7o9p/cancel" \  -H "Authorization: Bearer " \  -H "NinjaBuy-Version: 2026-11" \  -H "Idempotency-Key: $(uuidgen)" \  -H "Content-Type: application/json" \  -d '{ "reason": "Customer changed their mind" }'
```

Response · 200

```
HTTP/2 200 OK​{  "id": "ord_jd7f3k9m2x4q8w6e5r1t0y2u3i7o9p",  "external_id": "1012",  "source": "api",  "store": null,  "status": "cancelled",  "payment_status": "unpaid",  "lane": "saver",  "lines": [    {      "variant": "var_d2VpZGlhbi03NzUwOTcwODU2OjUxODcyMDk1NTQ",      "sku": "5187209554",      "title": "Heavyweight washed hoodie (Black / M)",      "quantity": 1,      "units": 1    }  ],  "ship_to": {    "name": "Sam Rivera",    "line1": "500 Congress Ave",    "line2": null,    "city": "Austin",    "region": "TX",    "postal_code": "78701",    "country": "US",    "phone": "+15125550142"  },  "hold": null,  "amount_due": null,  "charges": {    "goods": null,    "shipping": null,    "total": { "amount": "0.00", "currency": "CNY" }  },  "ninjabuy_orders": { "goods": null, "shipping": null },  "shipment": null,  "cancel_reason": "Customer changed their mind",  "created_at": "2026-11-01T09:14:02.000Z",  "updated_at": "2026-11-01T09:14:02.000Z"}
```

## Statuses

In order:

| Status            | Meaning                                                               |
| ----------------- | --------------------------------------------------------------------- |
| pending           | Received; we are paying for it from your balance.                     |
| awaiting\_payment | Your balance did not cover it. Top up and it goes ahead by itself.    |
| on\_hold          | Waiting for you: hold says why, and your Orders page has the buttons. |
| buying            | Paid; we are buying it from the seller.                               |
| with\_seller      | Bought; the seller has not sent it to our warehouse yet.              |
| checked           | In our warehouse; its parcel to your customer is being packed.        |
| shipped           | On its way, with tracking.                                            |
| cancelled         | You cancelled it.                                                     |

### Money

In the samples, buying one unit costs CN¥57.00 and shipping it CN¥133.38, taken from your balance. What each line is: [Fees](https://www.ninjabuy.com/business/docs/fees.md).

- The API is open on request. Our team sets up your Business account and issues its API keys.

  [Contact sales](https://www.ninjabuy.com/business#contact)
