# Orders

> List and read every order of your account whatever its channel, place an order paid from your wallet, read its status, shipments and money, and cancel it while it is created.

Source: https://docs.b7r.app/orders

A key with `orders:read` sees every order of your account, however it came in: placed through the API, created by hand in the app, bought on your Salla, Zid or Shopify store, or bought on your B7R store. A key with `orders:write` places orders and cancels them as you can in the app. The walk-throughs are in [Place an order](https://docs.b7r.app/place-an-order) and [Track an order](https://docs.b7r.app/track-an-order).

An order you place names your SKUs, your shopper's name, phone and Saudi address, and your selling price per line. B7R charges your wallet the cost of the lines plus the carrier fee, prints, packs and ships under your brand. An order can carry `seller`, an `id` and a `name` of your own: the name shows on the order in the app and on the packing slip, and `GET /v1/orders` lists it. The shipping label carries your account's brand.

## Where an order came from

| Field | Means |
| --- | --- |
| `channel` | Where the order came from: one value of the table below. |
| `store_order_id` | The store's own id of the order, as your order page in the app shows it. `null` unless the order came from a store. |
| `store_order_number` | The order number your shopper sees in the store, as the packing slip prints it. `null` unless the order came from a store, or the store sent none. |
| `external_id` | Your own id. Set only on an order you placed through the API; `null` on every other channel. |
| `paid_by` | Who paid: see [Payment](https://docs.b7r.app/orders#payment). |
| `sale` | The statement of a B7R store order: see [B7R store orders](https://docs.b7r.app/orders#b7r-store-orders). `null` on every other order. |

| `channel` | The order |
| --- | --- |
| `api` | Placed through the API with a key of your account. |
| `manual` | Created in the app, by you or by B7R for you. |
| `salla`, `zid`, `shopify` | Bought on that store you connected to B7R. |
| `b7r_store` | Bought on your B7R store. |
| `store` | Bought on a store you have since disconnected. |

A platform B7R adds later shows under its own name, so treat a `channel` you do not know as a store order you handle by default ([versioning](https://docs.b7r.app/versioning)). `GET /v1/orders?channel=` keeps one channel.

## Statuses

| `status` | Means | Next |
| --- | --- | --- |
| `created` | Accepted. You can still cancel it. | `in_production`, or `cancelled` |
| `in_production` | Being printed. The invoice is made here. | `shipped` |
| `shipped` | Home: with the carrier. Pickup: ready for collection at B7R. | `delivered` |
| `delivered` | Home: delivered. Pickup: collected. | None |
| `cancelled` | Cancelled; see `cancellation`. | B7R can reopen it to `created`. |

An order moves one step at a time. B7R can move it one step back, with a reason; the `order.status_changed` update then says `direction: backward`. `delivery_method` is the order carrier's: `home` or `pickup`.

## Payment

| `payment_status` | Means |
| --- | --- |
| `paid` | Paid: by your wallet, by the store, or by the shopper. |
| `not_paid` | Your wallet was short; a top-up pays waiting orders oldest first. |
| `awaiting_funds` | A store order the store settles after delivery (`paid_by: store_settlement`) whose hold on the store could not be placed yet. |
| `refund_pending` | Cancelled; the refund lands in seconds. |
| `refunded` | Cancelled and refunded. |

| `paid_by` | Means |
| --- | --- |
| `wallet` | Your B7R wallet paid it: API orders, manual orders and the store orders charged to your wallet. |
| `store_settlement` | The store holds the shopper's payment and settles B7R's cost after delivery; your wallet is not charged. |
| `shopper` | A B7R store order the shopper paid B7R for; your wallet never moved. `sale` shows the payment, the fee and your profit. |

## B7R store orders

A shopper on your B7R store pays B7R, so your wallet never moves for that order. `money` is B7R's cost of the order. `sale` is the statement your order page shows: `paid` (what the shopper paid: `lines`, `shipping` and `total`), `fee` (the payment and service fee) and `profit` (what you keep: `net`, `vat` and `gross`, which can be negative after B7R edits the order). Such an order is cancelled with a reason, and the shopper is refunded in full: see [Cancel an order](https://docs.b7r.app/orders#cancel-an-order).

sale on a B7R store order:

```json
{
  "sale": {
    "paid": {
      "lines": {
        "net": "198.00",
        "vat": "0.00",
        "gross": "198.00",
        "currency": "SAR"
      },
      "shipping": {
        "net": "25.00",
        "vat": "0.00",
        "gross": "25.00",
        "currency": "SAR"
      },
      "total": {
        "net": "223.00",
        "vat": "0.00",
        "gross": "223.00",
        "currency": "SAR"
      }
    },
    "fee": {
      "net": "6.50",
      "vat": "0.00",
      "gross": "6.50",
      "currency": "SAR"
    },
    "profit": {
      "net": "71.50",
      "vat": "0.00",
      "gross": "71.50",
      "currency": "SAR"
    }
  }
}
```

## What moves money

- Placing an order charges the wallet at once, or leaves it `not_paid` until a top-up pays waiting orders oldest first.
- A cancel of a paid order, by you or by B7R, refunds the wallet (`refund_pending`, then `refunded`). A not paid order is cancelled with nothing to refund. A store order the store holds is released. A B7R store order refunds the shopper through the payment gateway, never your wallet.
- B7R can reopen a cancelled order to `created`: a refunded or never paid order is charged its full total again when the balance covers it, otherwise it waits as `not_paid`; an order still paid stays paid.
- B7R can edit a `created` order for you: on a paid order an increase is charged and a decrease refunded, and it stays paid; on a not paid order only the totals move. `money` always shows the current totals, and you get `order.edited`.

## Cancellation codes

| `cancellation.code` | Means |
| --- | --- |
| `merchant_self_cancel` | Cancelled from your side: your API call, your account in the app, or a key revoked with its orders. |
| `print_error` | B7R printed it wrong; refunded. |
| `damaged` | Damaged before delivery; refunded. |
| `lost_in_transit` | Lost by the carrier; refunded. |
| `policy_takedown` | A design was taken down. |
| `design_quality` | A design cannot be printed well. |
| `store_cancel` | Cancelled in your store (Salla, Zid, Shopify) before printing; refunded as your own cancel. |
| `creator_cancel` | You cancelled a B7R store order with a reason, in the app or through the API; the shopper is refunded. |
| `shopper_cancel` | The shopper cancelled their B7R store order before printing; the shopper is refunded. |
| `undeliverable` | A B7R store order could not be delivered and was closed; the shopper is refunded for the items. |
| `other` | Anything else: read `cancellation.message`. |

`cancellation.message` is the reason your account sees in the app, or null. B7R may add codes to this list ([versioning](https://docs.b7r.app/versioning)): treat a code you do not know as `other`.

## Saved customers

The customers the app saved from your manual and store orders, with the area `customer_list:read` (which needs `orders:read` and `customers:read`). B7R records every read in your activity log. An order you place through the API never adds or changes a saved customer.

## Search saved customers

`POST /v1/customers/search`

Finds your saved customers by a part of the name or the phone, `q`, 2 to 100 characters; a phone in any form, such as `05…` or `+966…`, matches the form it is saved in. Without `q`, the customers who ordered most recently. At most `limit` of them, 1 to 50 (default 20). Each answers its name, the last 4 digits of its phone, when it last ordered and how many orders it has. It counts in `searches_per_minute`, as the orders search does.

Key: A key with the `customer_list:read` area. Send `Idempotency-Key` and `Content-Type: application/json`.

Body:

- `q` (string): A part of the customer's name or phone, 2 to 100 characters; a phone in any form matches its stored form. Without it, the customers who ordered most recently. Never kept in the call's record. 2 to 100.
- `limit` (integer): At most this many customers, 1 to 50 (default 20). 1 to 50.

Answer:

- `data` (array of object, required)
  - `id` (string (uuid), required)
  - `name` (string, required)
  - `phone_last4` (string, required): The last 4 digits of the customer's phone; never the whole phone.
  - `last_order_at` (string or null, required): When the customer last ordered; null when never.
  - `order_count` (integer, required)

Errors: `unauthorized` (401), `area_forbidden` (403), `account_inactive` (403), `connection_disabled` (403), `https_required` (403), `invalid_request` (400), `idempotency_key_required` (400), `request_too_large` (413), `unsupported_media_type` (415), `rate_limited` (429), `internal_error` (500), `upstream_unavailable` (502), `api_unavailable` (503), `request_expired` (503), `service_unavailable` (503), `upstream_timeout` (504). See [Errors](https://docs.b7r.app/errors).

Request:

```bash
curl -X POST https://api.b7r.app/v1/customers/search \
  -H "Authorization: Bearer $B7R_API_KEY" \
  -H "Idempotency-Key: $(uuidgen 2>/dev/null || node -e 'console.log(crypto.randomUUID())')" \
  -H "Content-Type: application/json" \
  -d '{
    "q": "0551234987",
    "limit": 10
  }'
```

```javascript
const res = await fetch("https://api.b7r.app/v1/customers/search", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.B7R_API_KEY}`,
    "Idempotency-Key": crypto.randomUUID(),
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "q": "0551234987",
    "limit": 10
  }),
});
const data = await res.json();
```

```python
import os, requests, uuid

res = requests.post(
    "https://api.b7r.app/v1/customers/search",
    headers={
        "Authorization": f"Bearer {os.environ['B7R_API_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "q": "0551234987",
        "limit": 10
    },
    timeout=30,
)
data = res.json()
```

Answer (200 OK):

```json
{
  "data": [
    {
      "id": "6c3b1f0e-2a4d-4c8e-9b7f-1d2e3f4a5b6c",
      "name": "سارة العتيبي",
      "phone_last4": "4987",
      "last_order_at": "2026-11-20T09:14:02.000Z",
      "order_count": 3
    }
  ]
}
```

## A saved customer's last address

`GET /v1/customers/{id}/last-address`

The shipping address of your latest order for this customer, to send again with a new order; `address` is `null` when you have no order for them. A customer of another account answers `404 not_found`, as one that does not exist.

Key: A key with the `customer_list:read` area.

Path:

- `id` (string (uuid), required)

Answer:

- `address` (object or null, required): The shipping address of your latest order for this customer; null when you have no order for them.
  - `country` (string, required)
  - `city` (string, required)
  - `district` (string or null, required)
  - `street` (string or null, required)
  - `building` (string or null, required)
  - `postal_code` (string or null, required)
  - `national_address` (string or null, required)

Errors: `unauthorized` (401), `area_forbidden` (403), `account_inactive` (403), `connection_disabled` (403), `https_required` (403), `not_found` (404), `invalid_request` (400), `rate_limited` (429), `internal_error` (500), `upstream_unavailable` (502), `api_unavailable` (503), `request_expired` (503), `service_unavailable` (503), `upstream_timeout` (504). See [Errors](https://docs.b7r.app/errors).

Request:

```bash
curl https://api.b7r.app/v1/customers/6c3b1f0e-2a4d-4c8e-9b7f-1d2e3f4a5b6c/last-address \
  -H "Authorization: Bearer $B7R_API_KEY"
```

```javascript
const res = await fetch("https://api.b7r.app/v1/customers/6c3b1f0e-2a4d-4c8e-9b7f-1d2e3f4a5b6c/last-address", {
  headers: {
    Authorization: `Bearer ${process.env.B7R_API_KEY}`,
  },
});
const data = await res.json();
```

```python
import os, requests

res = requests.get(
    "https://api.b7r.app/v1/customers/6c3b1f0e-2a4d-4c8e-9b7f-1d2e3f4a5b6c/last-address",
    headers={
        "Authorization": f"Bearer {os.environ['B7R_API_KEY']}",
    },
    timeout=30,
)
data = res.json()
```

Answer (200 OK):

```json
{
  "address": {
    "country": "SA",
    "city": "الرياض",
    "district": "العليا",
    "street": "شارع التحلية",
    "building": "4512",
    "postal_code": "12345",
    "national_address": "RRRD1234"
  }
}
```

## Shopper details

Order answers show the shopper masked: the name's first letter and the last 3 digits of the phone, and `shipping_address` is `null`. To ship an order yourself, or to reach its shopper, read it with `?include=customer` using a key that holds the `customers:read` area ([Keys and access](https://docs.b7r.app/keys-and-access#areas)).

- `GET /v1/orders/{order_id}?include=customer` answers the shopper in full, the fields your order page in the app shows: `customer` with `name`, `phone`, `email` and `gender` (each of the last two may be `null`; a B7R store order records no gender), and `shipping_address` with `country`, `city`, `district`, `street`, `building`, `postal_code` and `national_address`.
- `GET /v1/orders?include=customer` adds each row's `customer.name`, as your order list in the app shows it.
- Without `customers:read`, `include=customer` answers `403 area_forbidden` naming `customers:read`. Without `include`, the answer stays masked, whatever the key holds.
- B7R records every call with `include=customer` in its activity log, with the key prefix. Read the shopper once per order, when you need it, and keep polling without `include`.
- Placing and cancelling an order always answer masked, even for a key with `customers:read`: a retry with the same `Idempotency-Key` replays the stored answer to any key of your account, so a stored answer never holds a shopper. [Updates](https://docs.b7r.app/updates) never carry shopper details.
- You receive these details to fulfil your own orders: protect them, as the Custom API terms require.

GET /v1/orders/{order_id}?include=customer:

```json
{
  "customer": {
    "name": "Sara Alqahtani",
    "phone": "+966551234567",
    "email": "sara@example.com",
    "gender": "female"
  },
  "shipping_address": {
    "country": "SA",
    "city": "Riyadh",
    "district": "Al Malqa",
    "street": "Anas Bin Malik Road",
    "building": "2929",
    "postal_code": null,
    "national_address": "RRRD2929"
  }
}
```

GET /v1/orders?include=customer (one row):

```json
{
  "id": "B26112200042",
  "customer": {
    "name": "Sara Alqahtani"
  }
}
```

## Check an order

`POST /v1/orders/check`

Runs every check of `POST /v1/orders` and answers what the order would cost, whether your wallet would pay it now, and what the key may still spend today. Nothing is saved, charged or numbered, and no email is sent.

An account that does not meet a verification requirement is refused `403 verification_required` first, as a manual order is in the app, with the missing groups in `errors` (see [Errors](https://docs.b7r.app/errors)).

When the order would wait as `not_paid`, `missing_if_created` is a top-up that is sure to pay it: the wallet pays unpaid orders oldest first, so the figure covers every unpaid order you have and then this one. A smaller top-up may still pay it, since the wallet skips an order it cannot pay and pays newer, smaller ones. The order would wait as not paid and be paid by itself after a top-up in the app. The figure is as of the read, and the minimum top-up the app sets still applies. It is null when the order would be paid.

Key: A key with the `orders:write` area. Send `Idempotency-Key` and `Content-Type: application/json`.

Body:

- `external_id` (string, required): 1 to 64.
- `seller` (object)
  - `id` (string, required): 1 to 64.
  - `name` (string, required): 1 to 60.
- `customer` (object)
  - `name` (string, required): 2 to 120.
  - `phone` (string, required): At most 32.
  - `email` (string (email)): The shopper's email, kept encrypted on the order. B7R never writes to it. At most 254.
- `customer_id` (string (uuid)): A saved customer of your account (`POST /v1/customers/search`), in place of `customer`: the order takes their name, phone and email. Needs the customer_list:read area. The address is still the order's.
- `address` (object, required)
  - `country` (constant, required): Always `"SA"`.
  - `city` (string, required): 1 to 80.
  - `district` (string, required): 1 to 80.
  - `street` (string, required): 1 to 120.
  - `national_address` (string)
  - `building` (string): At most 40.
  - `postal_code` (string): At most 12.
- `lines` (array of object, required): 1 to 50 items.
  - `sku` (string, required): 1 to 64.
  - `quantity` (integer, required): 1 to 999.
  - `selling_price` (string, required)
- `carrier_id` (string (uuid))
- `note` (string): At most 500.

Answer:

- `money` (object, required)
  - `lines_total` (object, required)
    - `net` (string, required)
    - `vat` (string, required)
    - `gross` (string, required)
    - `currency` (constant, required): Always `"SAR"`.
  - `shipping` (object, required)
    - `net` (string, required)
    - `vat` (string, required)
    - `gross` (string, required)
    - `currency` (constant, required): Always `"SAR"`.
  - `total` (object, required)
    - `net` (string, required)
    - `vat` (string, required)
    - `gross` (string, required)
    - `currency` (constant, required): Always `"SAR"`.
- `payment_status_if_created` (string, required): One of `paid`, `not_paid`.
- `missing_if_created` (object or null, required): When the order would wait as not_paid: a top-up sure to pay it and every unpaid order before it (the wallet pays unpaid orders oldest first). As of this read; the minimum top-up the app sets still applies. Null when the order would be paid.
  - `amount` (string, required)
  - `currency` (constant, required): Always `"SAR"`.
- `lines` (array of object, required)
  - `sku` (string, required)
  - `quantity` (integer, required)
  - `unit_cost` (object, required)
    - `net` (string, required)
    - `vat` (string, required)
    - `gross` (string, required)
    - `currency` (constant, required): Always `"SAR"`.
- `spend_left_today` (object or null, required)
  - `amount` (string, required)
  - `currency` (constant, required): Always `"SAR"`.

Errors: `unauthorized` (401), `area_forbidden` (403), `account_inactive` (403), `connection_disabled` (403), `https_required` (403), `invalid_request` (400), `idempotency_key_required` (400), `request_too_large` (413), `unsupported_media_type` (415), `rate_limited` (429), `internal_error` (500), `upstream_unavailable` (502), `api_unavailable` (503), `request_expired` (503), `service_unavailable` (503), `upstream_timeout` (504), `try_again_later` (503), `order_exists` (409), `order_rejected` (422), `spend_cap_reached` (422), `unpaid_backlog_full` (422), `verification_required` (403). See [Errors](https://docs.b7r.app/errors).

Request:

```bash
curl -X POST https://api.b7r.app/v1/orders/check \
  -H "Authorization: Bearer $B7R_API_KEY" \
  -H "Idempotency-Key: $(uuidgen 2>/dev/null || node -e 'console.log(crypto.randomUUID())')" \
  -H "Content-Type: application/json" \
  -d '{
    "external_id": "ord-77120",
    "seller": {
      "id": "seller-1042",
      "name": "Najd Prints"
    },
    "customer": {
      "name": "Sara Alqahtani",
      "phone": "0551234567",
      "email": "sara@example.com"
    },
    "address": {
      "country": "SA",
      "city": "Riyadh",
      "district": "Al Malqa",
      "street": "Anas Bin Malik Road",
      "national_address": "RRRD2929",
      "building": "2929"
    },
    "lines": [
      {
        "sku": "B7R-TS-0042-BLK-M",
        "quantity": 2,
        "selling_price": "99.00"
      }
    ],
    "carrier_id": "9b1d3f5a-7c9e-4b1d-8f5a-6c8e0a2b4d6f"
  }'
```

```javascript
const res = await fetch("https://api.b7r.app/v1/orders/check", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.B7R_API_KEY}`,
    "Idempotency-Key": crypto.randomUUID(),
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "external_id": "ord-77120",
    "seller": {
      "id": "seller-1042",
      "name": "Najd Prints"
    },
    "customer": {
      "name": "Sara Alqahtani",
      "phone": "0551234567",
      "email": "sara@example.com"
    },
    "address": {
      "country": "SA",
      "city": "Riyadh",
      "district": "Al Malqa",
      "street": "Anas Bin Malik Road",
      "national_address": "RRRD2929",
      "building": "2929"
    },
    "lines": [
      {
        "sku": "B7R-TS-0042-BLK-M",
        "quantity": 2,
        "selling_price": "99.00"
      }
    ],
    "carrier_id": "9b1d3f5a-7c9e-4b1d-8f5a-6c8e0a2b4d6f"
  }),
});
const data = await res.json();
```

```python
import os, requests, uuid

res = requests.post(
    "https://api.b7r.app/v1/orders/check",
    headers={
        "Authorization": f"Bearer {os.environ['B7R_API_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "external_id": "ord-77120",
        "seller": {
            "id": "seller-1042",
            "name": "Najd Prints"
        },
        "customer": {
            "name": "Sara Alqahtani",
            "phone": "0551234567",
            "email": "sara@example.com"
        },
        "address": {
            "country": "SA",
            "city": "Riyadh",
            "district": "Al Malqa",
            "street": "Anas Bin Malik Road",
            "national_address": "RRRD2929",
            "building": "2929"
        },
        "lines": [
            {
                "sku": "B7R-TS-0042-BLK-M",
                "quantity": 2,
                "selling_price": "99.00"
            }
        ],
        "carrier_id": "9b1d3f5a-7c9e-4b1d-8f5a-6c8e0a2b4d6f"
    },
    timeout=30,
)
data = res.json()
```

Answer (200 OK):

```json
{
  "money": {
    "lines_total": {
      "net": "120.00",
      "vat": "0.00",
      "gross": "120.00",
      "currency": "SAR"
    },
    "shipping": {
      "net": "25.00",
      "vat": "0.00",
      "gross": "25.00",
      "currency": "SAR"
    },
    "total": {
      "net": "145.00",
      "vat": "0.00",
      "gross": "145.00",
      "currency": "SAR"
    }
  },
  "payment_status_if_created": "paid",
  "missing_if_created": null,
  "lines": [
    {
      "sku": "B7R-TS-0042-BLK-M",
      "quantity": 2,
      "unit_cost": {
        "net": "60.00",
        "vat": "0.00",
        "gross": "60.00",
        "currency": "SAR"
      }
    }
  ],
  "spend_left_today": {
    "amount": "1855.00",
    "currency": "SAR"
  }
}
```

## Place an order

`POST /v1/orders`

Accepted whole or refused whole: when any line cannot be ordered, nothing is saved and every bad line is listed. A line may name any SKU of any active product of your account, made in the app or through the API, published to a store or not; the SKU of an archived product, or of a colour you removed or a size or colour B7R retired, is refused as `sku_unavailable`. On success the answer is `201` and your wallet is charged at once; when the balance is short the order is `not_paid` and is paid, oldest first, when you top up. Every order answer, here, in a read and in the list, carries `funding`: on an order that waits as `not_paid` for your wallet, `missing` is a top-up of this amount that is sure to pay it and every older unpaid order (the order waits as not paid and is paid by itself after a top-up in the app; the figure is as of the read, and the minimum top-up the app sets still applies) and `top_up_url` opens your wallet; on any other order it is null. A repeat of this call with the same `Idempotency-Key` answers `funding` as it was when the order was created. The answer shows the shopper masked.

One order per `external_id`, ever: a second one answers `409 order_exists` with the first order's id. Retry a timeout with the same `Idempotency-Key` and body: you get the same order and one charge.

An account that does not meet a verification requirement cannot place an order, as a manual order is refused in the app: `403 verification_required`, with the missing groups in `errors`. Nothing is charged, and no order number or `external_id` is used, so the same request with the same `Idempotency-Key` works once the account is verified. A retry with the same `Idempotency-Key` within 24 hours answers that order; a new request for an `external_id` already placed may answer `403` while the account is blocked, so read that order with `GET /v1/orders?external_id=`. `GET /v1/me?include=verification` lists what is missing.

The shopper is `customer` (a name, a Saudi mobile and, if you have it, an email) or `customer_id`, one of your saved customers from [`POST /v1/customers/search`](#search-saved-customers), never both. With `customer_id` the order takes the saved customer's name, phone and email, and the address is still the one you send; it needs `customer_list:read` (`403 area_forbidden` at `/body/customer_id` without it), and an id that is not a saved customer of your account is `400 invalid_request` with `unknown_customer`. The email is kept encrypted on the order, as the app keeps it: B7R never writes to your shopper. An API order does not add or change a saved customer.

Key: A key with the `orders:write` area. Send `Idempotency-Key` and `Content-Type: application/json`.

Body:

- `external_id` (string, required): 1 to 64.
- `seller` (object)
  - `id` (string, required): 1 to 64.
  - `name` (string, required): 1 to 60.
- `customer` (object)
  - `name` (string, required): 2 to 120.
  - `phone` (string, required): At most 32.
  - `email` (string (email)): The shopper's email, kept encrypted on the order. B7R never writes to it. At most 254.
- `customer_id` (string (uuid)): A saved customer of your account (`POST /v1/customers/search`), in place of `customer`: the order takes their name, phone and email. Needs the customer_list:read area. The address is still the order's.
- `address` (object, required)
  - `country` (constant, required): Always `"SA"`.
  - `city` (string, required): 1 to 80.
  - `district` (string, required): 1 to 80.
  - `street` (string, required): 1 to 120.
  - `national_address` (string)
  - `building` (string): At most 40.
  - `postal_code` (string): At most 12.
- `lines` (array of object, required): 1 to 50 items.
  - `sku` (string, required): 1 to 64.
  - `quantity` (integer, required): 1 to 999.
  - `selling_price` (string, required)
- `carrier_id` (string (uuid))
- `note` (string): At most 500.

Answer:

- `id` (string, required)
- `external_id` (string or null, required): Your own order id, on an order placed through the API; null on every other channel.
- `channel` (string, required): Where the order came from: api, manual, b7r_store, the store platform (salla, zid, shopify), or store for a store since removed. Accept a value you do not know.
- `store_order_id` (string or null, required): The store's own id of the order, as the B7R order page shows it; null when the order did not come from a store.
- `store_order_number` (string or null, required): The order number the shopper sees in the store, as the packing slip prints it; null when the order did not come from a store or the store sent none.
- `paid_by` (string, required): Who paid: wallet (your wallet), store_settlement (the store holds the payment and settles after delivery), shopper (a B7R store order: your wallet never moved). One of `wallet`, `store_settlement`, `shopper`.
- `status` (string, required): One of `created`, `in_production`, `shipped`, `delivered`, `cancelled`.
- `payment_status` (string, required): One of `paid`, `not_paid`, `awaiting_funds`, `refund_pending`, `refunded`.
- `funding` (object or null, required): Null unless the order is not_paid and your wallet pays it. The order waits as not_paid and is paid by itself after a top-up in the app; nothing else is needed.
  - `missing` (object, required): A top-up of this amount is sure to pay this order and every older unpaid order: the wallet pays unpaid orders oldest first. As of this read; the minimum top-up the app sets still applies.
    - `amount` (string, required)
    - `currency` (constant, required): Always `"SAR"`.
  - `top_up_url` (string (uri), required): Where you top up: your wallet in the B7R app.
- `delivery_method` (string, required): One of `home`, `pickup`.
- `seller` (object or null, required)
  - `id` (string, required)
  - `name` (string, required)
- `carrier_id` (string (uuid) or null, required)
- `money` (object, required)
  - `lines_total` (object, required)
    - `net` (string, required)
    - `vat` (string, required)
    - `gross` (string, required)
    - `currency` (constant, required): Always `"SAR"`.
  - `shipping` (object, required)
    - `net` (string, required)
    - `vat` (string, required)
    - `gross` (string, required)
    - `currency` (constant, required): Always `"SAR"`.
  - `total` (object, required)
    - `net` (string, required)
    - `vat` (string, required)
    - `gross` (string, required)
    - `currency` (constant, required): Always `"SAR"`.
- `sale` (object or null, required): A B7R store order's sale as your order page shows it: what the shopper paid, the payment and service fee, and your profit. Null on every other order.
  - `paid` (object, required)
    - `lines` (object, required)
      - `net` (string, required)
      - `vat` (string, required)
      - `gross` (string, required)
      - `currency` (constant, required): Always `"SAR"`.
    - `shipping` (object, required)
      - `net` (string, required)
      - `vat` (string, required)
      - `gross` (string, required)
      - `currency` (constant, required): Always `"SAR"`.
    - `total` (object, required)
      - `net` (string, required)
      - `vat` (string, required)
      - `gross` (string, required)
      - `currency` (constant, required): Always `"SAR"`.
  - `fee` (object, required)
    - `net` (string, required)
    - `vat` (string, required)
    - `gross` (string, required)
    - `currency` (constant, required): Always `"SAR"`.
  - `profit` (object, required)
    - `net` (string, required)
    - `vat` (string, required)
    - `gross` (string, required)
    - `currency` (constant, required): Always `"SAR"`.
- `shipments` (array of object, required)
  - `carrier_id` (string (uuid) or null, required)
  - `tracking_number` (string or null, required)
  - `tracking_url` (string or null, required)
  - `shipped_at` (string or null, required)
  - `delivered_at` (string or null, required)
- `cancellation` (object or null, required)
  - `code` (string, required): One of `merchant_self_cancel`, `print_error`, `damaged`, `lost_in_transit`, `policy_takedown`, `design_quality`, `store_cancel`, `creator_cancel`, `shopper_cancel`, `undeliverable`, `other`.
  - `message` (string or null, required)
- `invoice` (object or null, required)
  - `number` (string, required)
  - `issued_at` (string, required)
- `allowed_actions` (array of string, required)
- `created_at` (string, required)
- `line_items` (array of object, required)
  - `id` (string (uuid), required)
  - `sku` (string, required)
  - `quantity` (integer, required)
  - `unit_cost` (object, required)
    - `net` (string, required)
    - `vat` (string, required)
    - `gross` (string, required)
    - `currency` (constant, required): Always `"SAR"`.
  - `selling_price` (object, required)
    - `amount` (string, required)
    - `currency` (constant, required): Always `"SAR"`.
- `customer` (object, required): The shopper, masked: the name's first letter and the phone's last 3 digits. In full only on GET /v1/orders/{order_id}?include=customer with customers:read.
  - `name` (string, required)
  - `phone` (string, required)
- `shipping_address` (null, required): Always null here. The address comes only on GET /v1/orders/{order_id}?include=customer with customers:read.

Errors: `unauthorized` (401), `area_forbidden` (403), `account_inactive` (403), `connection_disabled` (403), `https_required` (403), `invalid_request` (400), `idempotency_key_required` (400), `request_too_large` (413), `unsupported_media_type` (415), `rate_limited` (429), `internal_error` (500), `upstream_unavailable` (502), `api_unavailable` (503), `request_expired` (503), `service_unavailable` (503), `upstream_timeout` (504), `idempotency_mismatch` (409), `idempotency_in_flight` (409), `order_exists` (409), `order_rejected` (422), `spend_cap_reached` (422), `unpaid_backlog_full` (422), `order_limit_reached` (429), `verification_required` (403). See [Errors](https://docs.b7r.app/errors).

Request:

```bash
curl -X POST https://api.b7r.app/v1/orders \
  -H "Authorization: Bearer $B7R_API_KEY" \
  -H "Idempotency-Key: $(uuidgen 2>/dev/null || node -e 'console.log(crypto.randomUUID())')" \
  -H "Content-Type: application/json" \
  -d '{
    "external_id": "ord-77120",
    "seller": {
      "id": "seller-1042",
      "name": "Najd Prints"
    },
    "customer": {
      "name": "Sara Alqahtani",
      "phone": "0551234567",
      "email": "sara@example.com"
    },
    "address": {
      "country": "SA",
      "city": "Riyadh",
      "district": "Al Malqa",
      "street": "Anas Bin Malik Road",
      "national_address": "RRRD2929",
      "building": "2929"
    },
    "lines": [
      {
        "sku": "B7R-TS-0042-BLK-M",
        "quantity": 2,
        "selling_price": "99.00"
      }
    ],
    "carrier_id": "9b1d3f5a-7c9e-4b1d-8f5a-6c8e0a2b4d6f"
  }'
```

```javascript
const res = await fetch("https://api.b7r.app/v1/orders", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.B7R_API_KEY}`,
    "Idempotency-Key": crypto.randomUUID(),
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "external_id": "ord-77120",
    "seller": {
      "id": "seller-1042",
      "name": "Najd Prints"
    },
    "customer": {
      "name": "Sara Alqahtani",
      "phone": "0551234567",
      "email": "sara@example.com"
    },
    "address": {
      "country": "SA",
      "city": "Riyadh",
      "district": "Al Malqa",
      "street": "Anas Bin Malik Road",
      "national_address": "RRRD2929",
      "building": "2929"
    },
    "lines": [
      {
        "sku": "B7R-TS-0042-BLK-M",
        "quantity": 2,
        "selling_price": "99.00"
      }
    ],
    "carrier_id": "9b1d3f5a-7c9e-4b1d-8f5a-6c8e0a2b4d6f"
  }),
});
const data = await res.json();
```

```python
import os, requests, uuid

res = requests.post(
    "https://api.b7r.app/v1/orders",
    headers={
        "Authorization": f"Bearer {os.environ['B7R_API_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "external_id": "ord-77120",
        "seller": {
            "id": "seller-1042",
            "name": "Najd Prints"
        },
        "customer": {
            "name": "Sara Alqahtani",
            "phone": "0551234567",
            "email": "sara@example.com"
        },
        "address": {
            "country": "SA",
            "city": "Riyadh",
            "district": "Al Malqa",
            "street": "Anas Bin Malik Road",
            "national_address": "RRRD2929",
            "building": "2929"
        },
        "lines": [
            {
                "sku": "B7R-TS-0042-BLK-M",
                "quantity": 2,
                "selling_price": "99.00"
            }
        ],
        "carrier_id": "9b1d3f5a-7c9e-4b1d-8f5a-6c8e0a2b4d6f"
    },
    timeout=30,
)
data = res.json()
```

Answer (201 Created):

```json
{
  "id": "B26112200042",
  "external_id": "ord-77120",
  "channel": "api",
  "store_order_id": null,
  "store_order_number": null,
  "paid_by": "wallet",
  "status": "created",
  "payment_status": "paid",
  "funding": null,
  "seller": {
    "id": "seller-1042",
    "name": "Najd Prints"
  },
  "carrier_id": "9b1d3f5a-7c9e-4b1d-8f5a-6c8e0a2b4d6f",
  "delivery_method": "home",
  "money": {
    "lines_total": {
      "net": "120.00",
      "vat": "0.00",
      "gross": "120.00",
      "currency": "SAR"
    },
    "shipping": {
      "net": "25.00",
      "vat": "0.00",
      "gross": "25.00",
      "currency": "SAR"
    },
    "total": {
      "net": "145.00",
      "vat": "0.00",
      "gross": "145.00",
      "currency": "SAR"
    }
  },
  "sale": null,
  "shipments": [],
  "cancellation": null,
  "allowed_actions": [
    "cancel"
  ],
  "invoice": null,
  "created_at": "2026-11-22T12:30:11.902Z",
  "line_items": [
    {
      "id": "5b8c0d3e-4f6a-4b7c-9d8e-0f1a2b3c4d5e",
      "sku": "B7R-TS-0042-BLK-M",
      "quantity": 2,
      "unit_cost": {
        "net": "60.00",
        "vat": "0.00",
        "gross": "60.00",
        "currency": "SAR"
      },
      "selling_price": {
        "amount": "99.00",
        "currency": "SAR"
      }
    }
  ],
  "customer": {
    "name": "S***",
    "phone": "*********567"
  },
  "shipping_address": null
}
```

## List orders

`GET /v1/orders`

Every order of your account, newest first, from every channel, without the shopper and the lines. `include=customer` adds the name of each shopper (with `customers:read`, see [Shopper details](#shopper-details)); `include=items` adds each order's lines with the product's name and photo (with `order_details:read`); ask for both as `include=customer.items`. A key without the area an `include` needs is refused `403 area_forbidden` before anything is read. Each row says where it came from (`channel`) and who paid (`paid_by`); the example shows a B7R store order, a Salla order and an API order. Page with `cursor` until `next_cursor` is `null`; `limit` sets the page size, 1 to 100 (default 50).

Filters: `channel` keeps one channel (`channel=api` lists the orders you placed through the API; a channel you have no order on answers an empty page, and a value that is not a channel name is `400 invalid_request`); `external_id` finds the API order that carries it; `status` and `payment_status` keep one value each; `seller_ref` keeps the orders of one seller, exactly its `seller.id`. Filters combine.

`sort` is `newest` (the default), `oldest`, or `total_desc` (the order total, highest first). A `cursor` works only with the sort it came from: another sort answers `400 invalid_request` with `invalid_cursor`. To follow changes, [updates](https://docs.b7r.app/updates) tell you about every order of your account, whatever its channel; each row here carries `status` and `payment_status`.

Key: A key with the `orders:read` area.

Query:

- `external_id` (string): 1 to 64.
- `channel` (string): Only the orders of this channel: api, manual, b7r_store, salla, zid, shopify or store. A channel you have no order on answers an empty page.
- `status` (string): Only the orders in this status. One of `created`, `in_production`, `shipped`, `delivered`, `cancelled`.
- `payment_status` (string): Only the orders in this payment status. One of `paid`, `not_paid`, `awaiting_funds`, `refund_pending`, `refunded`.
- `seller_ref` (string): Only the orders of this seller: exactly the seller's `id`.
- `sort` (string): newest (the default) or oldest by when the order was made, or total_desc by its total, highest first. A cursor works only with the sort that made it. One of `newest`, `oldest`, `total_desc`.
- `limit` (string)
- `cursor` (string): 1 to 256.
- `include` (string): customer: add the shopper's name (needs customers:read; every such call is logged). items: add each order's lines with their names and photos (needs order_details:read). Join both with a dot: include=customer.items.

Answer:

- `data` (array of object, required)
  - `id` (string, required)
  - `external_id` (string or null, required): Your own order id, on an order placed through the API; null on every other channel.
  - `channel` (string, required): Where the order came from: api, manual, b7r_store, the store platform (salla, zid, shopify), or store for a store since removed. Accept a value you do not know.
  - `store_order_id` (string or null, required): The store's own id of the order, as the B7R order page shows it; null when the order did not come from a store.
  - `store_order_number` (string or null, required): The order number the shopper sees in the store, as the packing slip prints it; null when the order did not come from a store or the store sent none.
  - `paid_by` (string, required): Who paid: wallet (your wallet), store_settlement (the store holds the payment and settles after delivery), shopper (a B7R store order: your wallet never moved). One of `wallet`, `store_settlement`, `shopper`.
  - `status` (string, required): One of `created`, `in_production`, `shipped`, `delivered`, `cancelled`.
  - `payment_status` (string, required): One of `paid`, `not_paid`, `awaiting_funds`, `refund_pending`, `refunded`.
  - `funding` (object or null, required): Null unless the order is not_paid and your wallet pays it. The order waits as not_paid and is paid by itself after a top-up in the app; nothing else is needed.
    - `missing` (object, required): A top-up of this amount is sure to pay this order and every older unpaid order: the wallet pays unpaid orders oldest first. As of this read; the minimum top-up the app sets still applies.
      - `amount` (string, required)
      - `currency` (constant, required): Always `"SAR"`.
    - `top_up_url` (string (uri), required): Where you top up: your wallet in the B7R app.
  - `delivery_method` (string, required): One of `home`, `pickup`.
  - `seller` (object or null, required)
    - `id` (string, required)
    - `name` (string, required)
  - `carrier_id` (string (uuid) or null, required)
  - `money` (object, required)
    - `lines_total` (object, required)
      - `net` (string, required)
      - `vat` (string, required)
      - `gross` (string, required)
      - `currency` (constant, required): Always `"SAR"`.
    - `shipping` (object, required)
      - `net` (string, required)
      - `vat` (string, required)
      - `gross` (string, required)
      - `currency` (constant, required): Always `"SAR"`.
    - `total` (object, required)
      - `net` (string, required)
      - `vat` (string, required)
      - `gross` (string, required)
      - `currency` (constant, required): Always `"SAR"`.
  - `sale` (object or null, required): A B7R store order's sale as your order page shows it: what the shopper paid, the payment and service fee, and your profit. Null on every other order.
    - `paid` (object, required)
      - `lines` (object, required)
        - `net` (string, required)
        - `vat` (string, required)
        - `gross` (string, required)
        - `currency` (constant, required): Always `"SAR"`.
      - `shipping` (object, required)
        - `net` (string, required)
        - `vat` (string, required)
        - `gross` (string, required)
        - `currency` (constant, required): Always `"SAR"`.
      - `total` (object, required)
        - `net` (string, required)
        - `vat` (string, required)
        - `gross` (string, required)
        - `currency` (constant, required): Always `"SAR"`.
    - `fee` (object, required)
      - `net` (string, required)
      - `vat` (string, required)
      - `gross` (string, required)
      - `currency` (constant, required): Always `"SAR"`.
    - `profit` (object, required)
      - `net` (string, required)
      - `vat` (string, required)
      - `gross` (string, required)
      - `currency` (constant, required): Always `"SAR"`.
  - `shipments` (array of object, required)
    - `carrier_id` (string (uuid) or null, required)
    - `tracking_number` (string or null, required)
    - `tracking_url` (string or null, required)
    - `shipped_at` (string or null, required)
    - `delivered_at` (string or null, required)
  - `cancellation` (object or null, required)
    - `code` (string, required): One of `merchant_self_cancel`, `print_error`, `damaged`, `lost_in_transit`, `policy_takedown`, `design_quality`, `store_cancel`, `creator_cancel`, `shopper_cancel`, `undeliverable`, `other`.
    - `message` (string or null, required)
  - `invoice` (object or null, required)
    - `number` (string, required)
    - `issued_at` (string, required)
  - `allowed_actions` (array of string, required)
  - `created_at` (string, required)
  - `customer` (object): The shopper's name, only with include=customer and customers:read.
    - `name` (string, required)
  - `items` (array of object): The order's lines with their names and photos, only with include=items and order_details:read.
    - `sku` (string, required)
    - `quantity` (integer, required)
    - `product_id` (string (uuid) or null, required): The product the line sells; null when its SKU no longer exists.
    - `color_id` (string (uuid) or null, required)
    - `size_id` (string (uuid) or null, required)
    - `name` (object, required)
      - `ar` (string, required)
      - `en` (string, required)
    - `photo_url` (string or null, required): The product's photo in the line's colour, as the app's order card shows it; null when it has none.
- `next_cursor` (string or null, required)

Errors: `unauthorized` (401), `area_forbidden` (403), `account_inactive` (403), `connection_disabled` (403), `https_required` (403), `invalid_request` (400), `rate_limited` (429), `internal_error` (500), `upstream_unavailable` (502), `api_unavailable` (503), `request_expired` (503), `service_unavailable` (503), `upstream_timeout` (504), `try_again_later` (503). See [Errors](https://docs.b7r.app/errors).

Request:

```bash
curl https://api.b7r.app/v1/orders \
  -H "Authorization: Bearer $B7R_API_KEY"
```

```javascript
const res = await fetch("https://api.b7r.app/v1/orders", {
  headers: {
    Authorization: `Bearer ${process.env.B7R_API_KEY}`,
  },
});
const data = await res.json();
```

```python
import os, requests

res = requests.get(
    "https://api.b7r.app/v1/orders",
    headers={
        "Authorization": f"Bearer {os.environ['B7R_API_KEY']}",
    },
    timeout=30,
)
data = res.json()
```

Answer (200 OK):

```json
{
  "data": [
    {
      "id": "B26112300017",
      "external_id": null,
      "channel": "b7r_store",
      "store_order_id": null,
      "store_order_number": null,
      "paid_by": "shopper",
      "status": "created",
      "payment_status": "paid",
      "funding": null,
      "seller": null,
      "carrier_id": "9b1d3f5a-7c9e-4b1d-8f5a-6c8e0a2b4d6f",
      "delivery_method": "home",
      "money": {
        "lines_total": {
          "net": "120.00",
          "vat": "0.00",
          "gross": "120.00",
          "currency": "SAR"
        },
        "shipping": {
          "net": "25.00",
          "vat": "0.00",
          "gross": "25.00",
          "currency": "SAR"
        },
        "total": {
          "net": "145.00",
          "vat": "0.00",
          "gross": "145.00",
          "currency": "SAR"
        }
      },
      "sale": {
        "paid": {
          "lines": {
            "net": "198.00",
            "vat": "0.00",
            "gross": "198.00",
            "currency": "SAR"
          },
          "shipping": {
            "net": "25.00",
            "vat": "0.00",
            "gross": "25.00",
            "currency": "SAR"
          },
          "total": {
            "net": "223.00",
            "vat": "0.00",
            "gross": "223.00",
            "currency": "SAR"
          }
        },
        "fee": {
          "net": "6.50",
          "vat": "0.00",
          "gross": "6.50",
          "currency": "SAR"
        },
        "profit": {
          "net": "71.50",
          "vat": "0.00",
          "gross": "71.50",
          "currency": "SAR"
        }
      },
      "shipments": [],
      "cancellation": null,
      "allowed_actions": [
        "cancel_with_reason"
      ],
      "invoice": null,
      "created_at": "2026-11-23T14:02:37.118Z"
    },
    {
      "id": "B26112300009",
      "external_id": null,
      "channel": "salla",
      "store_order_id": "1457983214",
      "store_order_number": "218842",
      "paid_by": "wallet",
      "status": "created",
      "payment_status": "paid",
      "funding": null,
      "seller": null,
      "carrier_id": "9b1d3f5a-7c9e-4b1d-8f5a-6c8e0a2b4d6f",
      "delivery_method": "home",
      "money": {
        "lines_total": {
          "net": "120.00",
          "vat": "0.00",
          "gross": "120.00",
          "currency": "SAR"
        },
        "shipping": {
          "net": "25.00",
          "vat": "0.00",
          "gross": "25.00",
          "currency": "SAR"
        },
        "total": {
          "net": "145.00",
          "vat": "0.00",
          "gross": "145.00",
          "currency": "SAR"
        }
      },
      "sale": null,
      "shipments": [],
      "cancellation": null,
      "allowed_actions": [
        "cancel"
      ],
      "invoice": null,
      "created_at": "2026-11-23T09:41:15.620Z"
    },
    {
      "id": "B26112200042",
      "external_id": "ord-77120",
      "channel": "api",
      "store_order_id": null,
      "store_order_number": null,
      "paid_by": "wallet",
      "status": "created",
      "payment_status": "paid",
      "funding": null,
      "seller": {
        "id": "seller-1042",
        "name": "Najd Prints"
      },
      "carrier_id": "9b1d3f5a-7c9e-4b1d-8f5a-6c8e0a2b4d6f",
      "delivery_method": "home",
      "money": {
        "lines_total": {
          "net": "120.00",
          "vat": "0.00",
          "gross": "120.00",
          "currency": "SAR"
        },
        "shipping": {
          "net": "25.00",
          "vat": "0.00",
          "gross": "25.00",
          "currency": "SAR"
        },
        "total": {
          "net": "145.00",
          "vat": "0.00",
          "gross": "145.00",
          "currency": "SAR"
        }
      },
      "sale": null,
      "shipments": [],
      "cancellation": null,
      "allowed_actions": [
        "cancel"
      ],
      "invoice": null,
      "created_at": "2026-11-22T12:30:11.902Z"
    }
  ],
  "next_cursor": null
}
```

Only your Salla orders:

```bash
curl "https://api.b7r.app/v1/orders?channel=salla" \
  -H "Authorization: Bearer $B7R_API_KEY"
```

```javascript
const res = await fetch("https://api.b7r.app/v1/orders?channel=salla", {
  headers: {
    Authorization: `Bearer ${process.env.B7R_API_KEY}`,
  },
});
const data = await res.json();
```

```python
import os, requests

res = requests.get(
    "https://api.b7r.app/v1/orders?channel=salla",
    headers={
        "Authorization": f"Bearer {os.environ['B7R_API_KEY']}",
    },
    timeout=30,
)
data = res.json()
```

200 OK:

```json
{
  "data": [
    {
      "id": "B26112300009",
      "external_id": null,
      "channel": "salla",
      "store_order_id": "1457983214",
      "store_order_number": "218842",
      "paid_by": "wallet",
      "status": "created",
      "payment_status": "paid",
      "funding": null,
      "seller": null,
      "carrier_id": "9b1d3f5a-7c9e-4b1d-8f5a-6c8e0a2b4d6f",
      "delivery_method": "home",
      "money": {
        "lines_total": {
          "net": "120.00",
          "vat": "0.00",
          "gross": "120.00",
          "currency": "SAR"
        },
        "shipping": {
          "net": "25.00",
          "vat": "0.00",
          "gross": "25.00",
          "currency": "SAR"
        },
        "total": {
          "net": "145.00",
          "vat": "0.00",
          "gross": "145.00",
          "currency": "SAR"
        }
      },
      "sale": null,
      "shipments": [],
      "cancellation": null,
      "allowed_actions": [
        "cancel"
      ],
      "invoice": null,
      "created_at": "2026-11-23T09:41:15.620Z"
    }
  ],
  "next_cursor": null
}
```

## Search orders

`POST /v1/orders/search`

Finds your orders by `q`, 2 to 100 characters, as the app's order search finds them: an order number or a part of it, the store's order id, and the store order number the shopper sees. With `customers:read` it also finds a shopper's phone in any form, its last 4 digits, or the words of a name. Newest first, filtered by `status` and `payment_status` when you send them; page with `cursor` until `next_cursor` is `null`. The rows are the list's, without the shopper.

A key without `customers:read` searches the numbers only. A term that could then match only a shopper (a name, a phone) is refused `403 area_forbidden` at `/body/q`, before anything is read. With `customers:read`, a search a name or a phone could match is recorded in your activity log, with the key prefix and never the term. The term is in the body so a name, an Arabic word or a `+966` phone can be sent at all; it is never kept in the call's record. Each search counts in your account's `searches_per_minute` (see `GET /v1/me?include=limits`), shared with the saved customers search; past it the answer is `429 rate_limited` with `Retry-After` and the limit.

Key: A key with the `orders:read` area. Send `Idempotency-Key` and `Content-Type: application/json`.

Body:

- `q` (string, required): What to find, 2 to 100 characters: an order number, a store order number or id, and, with customers:read, a shopper's phone, its last 4 digits or a name. Never kept in the call's record. 2 to 100.
- `status` (string): Only the orders in this status. One of `created`, `in_production`, `shipped`, `delivered`, `cancelled`.
- `payment_status` (string): Only the orders in this payment status. One of `paid`, `not_paid`, `awaiting_funds`, `refund_pending`, `refunded`.
- `limit` (integer): The page size, 1 to 100 (default 50). 1 to 100.
- `cursor` (string): The `next_cursor` of the page before. 1 to 256.

Answer:

- `data` (array of object, required)
  - `id` (string, required)
  - `external_id` (string or null, required): Your own order id, on an order placed through the API; null on every other channel.
  - `channel` (string, required): Where the order came from: api, manual, b7r_store, the store platform (salla, zid, shopify), or store for a store since removed. Accept a value you do not know.
  - `store_order_id` (string or null, required): The store's own id of the order, as the B7R order page shows it; null when the order did not come from a store.
  - `store_order_number` (string or null, required): The order number the shopper sees in the store, as the packing slip prints it; null when the order did not come from a store or the store sent none.
  - `paid_by` (string, required): Who paid: wallet (your wallet), store_settlement (the store holds the payment and settles after delivery), shopper (a B7R store order: your wallet never moved). One of `wallet`, `store_settlement`, `shopper`.
  - `status` (string, required): One of `created`, `in_production`, `shipped`, `delivered`, `cancelled`.
  - `payment_status` (string, required): One of `paid`, `not_paid`, `awaiting_funds`, `refund_pending`, `refunded`.
  - `funding` (object or null, required): Null unless the order is not_paid and your wallet pays it. The order waits as not_paid and is paid by itself after a top-up in the app; nothing else is needed.
    - `missing` (object, required): A top-up of this amount is sure to pay this order and every older unpaid order: the wallet pays unpaid orders oldest first. As of this read; the minimum top-up the app sets still applies.
      - `amount` (string, required)
      - `currency` (constant, required): Always `"SAR"`.
    - `top_up_url` (string (uri), required): Where you top up: your wallet in the B7R app.
  - `delivery_method` (string, required): One of `home`, `pickup`.
  - `seller` (object or null, required)
    - `id` (string, required)
    - `name` (string, required)
  - `carrier_id` (string (uuid) or null, required)
  - `money` (object, required)
    - `lines_total` (object, required)
      - `net` (string, required)
      - `vat` (string, required)
      - `gross` (string, required)
      - `currency` (constant, required): Always `"SAR"`.
    - `shipping` (object, required)
      - `net` (string, required)
      - `vat` (string, required)
      - `gross` (string, required)
      - `currency` (constant, required): Always `"SAR"`.
    - `total` (object, required)
      - `net` (string, required)
      - `vat` (string, required)
      - `gross` (string, required)
      - `currency` (constant, required): Always `"SAR"`.
  - `sale` (object or null, required): A B7R store order's sale as your order page shows it: what the shopper paid, the payment and service fee, and your profit. Null on every other order.
    - `paid` (object, required)
      - `lines` (object, required)
        - `net` (string, required)
        - `vat` (string, required)
        - `gross` (string, required)
        - `currency` (constant, required): Always `"SAR"`.
      - `shipping` (object, required)
        - `net` (string, required)
        - `vat` (string, required)
        - `gross` (string, required)
        - `currency` (constant, required): Always `"SAR"`.
      - `total` (object, required)
        - `net` (string, required)
        - `vat` (string, required)
        - `gross` (string, required)
        - `currency` (constant, required): Always `"SAR"`.
    - `fee` (object, required)
      - `net` (string, required)
      - `vat` (string, required)
      - `gross` (string, required)
      - `currency` (constant, required): Always `"SAR"`.
    - `profit` (object, required)
      - `net` (string, required)
      - `vat` (string, required)
      - `gross` (string, required)
      - `currency` (constant, required): Always `"SAR"`.
  - `shipments` (array of object, required)
    - `carrier_id` (string (uuid) or null, required)
    - `tracking_number` (string or null, required)
    - `tracking_url` (string or null, required)
    - `shipped_at` (string or null, required)
    - `delivered_at` (string or null, required)
  - `cancellation` (object or null, required)
    - `code` (string, required): One of `merchant_self_cancel`, `print_error`, `damaged`, `lost_in_transit`, `policy_takedown`, `design_quality`, `store_cancel`, `creator_cancel`, `shopper_cancel`, `undeliverable`, `other`.
    - `message` (string or null, required)
  - `invoice` (object or null, required)
    - `number` (string, required)
    - `issued_at` (string, required)
  - `allowed_actions` (array of string, required)
  - `created_at` (string, required)
  - `customer` (object): The shopper's name, only with include=customer and customers:read.
    - `name` (string, required)
  - `items` (array of object): The order's lines with their names and photos, only with include=items and order_details:read.
    - `sku` (string, required)
    - `quantity` (integer, required)
    - `product_id` (string (uuid) or null, required): The product the line sells; null when its SKU no longer exists.
    - `color_id` (string (uuid) or null, required)
    - `size_id` (string (uuid) or null, required)
    - `name` (object, required)
      - `ar` (string, required)
      - `en` (string, required)
    - `photo_url` (string or null, required): The product's photo in the line's colour, as the app's order card shows it; null when it has none.
- `next_cursor` (string or null, required)

Errors: `unauthorized` (401), `area_forbidden` (403), `account_inactive` (403), `connection_disabled` (403), `https_required` (403), `invalid_request` (400), `idempotency_key_required` (400), `request_too_large` (413), `unsupported_media_type` (415), `rate_limited` (429), `internal_error` (500), `upstream_unavailable` (502), `api_unavailable` (503), `request_expired` (503), `service_unavailable` (503), `upstream_timeout` (504). See [Errors](https://docs.b7r.app/errors).

Request:

```bash
curl -X POST https://api.b7r.app/v1/orders/search \
  -H "Authorization: Bearer $B7R_API_KEY" \
  -H "Idempotency-Key: $(uuidgen 2>/dev/null || node -e 'console.log(crypto.randomUUID())')" \
  -H "Content-Type: application/json" \
  -d '{
    "q": "SO-1043",
    "status": "created"
  }'
```

```javascript
const res = await fetch("https://api.b7r.app/v1/orders/search", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.B7R_API_KEY}`,
    "Idempotency-Key": crypto.randomUUID(),
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "q": "SO-1043",
    "status": "created"
  }),
});
const data = await res.json();
```

```python
import os, requests, uuid

res = requests.post(
    "https://api.b7r.app/v1/orders/search",
    headers={
        "Authorization": f"Bearer {os.environ['B7R_API_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "q": "SO-1043",
        "status": "created"
    },
    timeout=30,
)
data = res.json()
```

Answer (200 OK):

```json
{
  "data": [
    {
      "id": "B26112300017",
      "external_id": null,
      "channel": "b7r_store",
      "store_order_id": null,
      "store_order_number": null,
      "paid_by": "shopper",
      "status": "created",
      "payment_status": "paid",
      "funding": null,
      "seller": null,
      "carrier_id": "9b1d3f5a-7c9e-4b1d-8f5a-6c8e0a2b4d6f",
      "delivery_method": "home",
      "money": {
        "lines_total": {
          "net": "120.00",
          "vat": "0.00",
          "gross": "120.00",
          "currency": "SAR"
        },
        "shipping": {
          "net": "25.00",
          "vat": "0.00",
          "gross": "25.00",
          "currency": "SAR"
        },
        "total": {
          "net": "145.00",
          "vat": "0.00",
          "gross": "145.00",
          "currency": "SAR"
        }
      },
      "sale": {
        "paid": {
          "lines": {
            "net": "198.00",
            "vat": "0.00",
            "gross": "198.00",
            "currency": "SAR"
          },
          "shipping": {
            "net": "25.00",
            "vat": "0.00",
            "gross": "25.00",
            "currency": "SAR"
          },
          "total": {
            "net": "223.00",
            "vat": "0.00",
            "gross": "223.00",
            "currency": "SAR"
          }
        },
        "fee": {
          "net": "6.50",
          "vat": "0.00",
          "gross": "6.50",
          "currency": "SAR"
        },
        "profit": {
          "net": "71.50",
          "vat": "0.00",
          "gross": "71.50",
          "currency": "SAR"
        }
      },
      "shipments": [],
      "cancellation": null,
      "allowed_actions": [
        "cancel_with_reason"
      ],
      "invoice": null,
      "created_at": "2026-11-23T14:02:37.118Z"
    },
    {
      "id": "B26112300009",
      "external_id": null,
      "channel": "salla",
      "store_order_id": "1457983214",
      "store_order_number": "218842",
      "paid_by": "wallet",
      "status": "created",
      "payment_status": "paid",
      "funding": null,
      "seller": null,
      "carrier_id": "9b1d3f5a-7c9e-4b1d-8f5a-6c8e0a2b4d6f",
      "delivery_method": "home",
      "money": {
        "lines_total": {
          "net": "120.00",
          "vat": "0.00",
          "gross": "120.00",
          "currency": "SAR"
        },
        "shipping": {
          "net": "25.00",
          "vat": "0.00",
          "gross": "25.00",
          "currency": "SAR"
        },
        "total": {
          "net": "145.00",
          "vat": "0.00",
          "gross": "145.00",
          "currency": "SAR"
        }
      },
      "sale": null,
      "shipments": [],
      "cancellation": null,
      "allowed_actions": [
        "cancel"
      ],
      "invoice": null,
      "created_at": "2026-11-23T09:41:15.620Z"
    },
    {
      "id": "B26112200042",
      "external_id": "ord-77120",
      "channel": "api",
      "store_order_id": null,
      "store_order_number": null,
      "paid_by": "wallet",
      "status": "created",
      "payment_status": "paid",
      "funding": null,
      "seller": {
        "id": "seller-1042",
        "name": "Najd Prints"
      },
      "carrier_id": "9b1d3f5a-7c9e-4b1d-8f5a-6c8e0a2b4d6f",
      "delivery_method": "home",
      "money": {
        "lines_total": {
          "net": "120.00",
          "vat": "0.00",
          "gross": "120.00",
          "currency": "SAR"
        },
        "shipping": {
          "net": "25.00",
          "vat": "0.00",
          "gross": "25.00",
          "currency": "SAR"
        },
        "total": {
          "net": "145.00",
          "vat": "0.00",
          "gross": "145.00",
          "currency": "SAR"
        }
      },
      "sale": null,
      "shipments": [],
      "cancellation": null,
      "allowed_actions": [
        "cancel"
      ],
      "invoice": null,
      "created_at": "2026-11-22T12:30:11.902Z"
    }
  ],
  "next_cursor": null
}
```

## Count orders by status

`GET /v1/orders/counts`

How many orders of your account are in each status, from every channel, as the app counts them on its order tabs.

Key: A key with the `orders:read` area.

Answer:

- `counts` (object, required): Every order of the account, of every channel, per status.
  - `created` (integer, required)
  - `in_production` (integer, required)
  - `shipped` (integer, required)
  - `delivered` (integer, required)
  - `cancelled` (integer, required)

Errors: `unauthorized` (401), `area_forbidden` (403), `account_inactive` (403), `connection_disabled` (403), `https_required` (403), `invalid_request` (400), `rate_limited` (429), `internal_error` (500), `upstream_unavailable` (502), `api_unavailable` (503), `request_expired` (503), `service_unavailable` (503), `upstream_timeout` (504). See [Errors](https://docs.b7r.app/errors).

Request:

```bash
curl https://api.b7r.app/v1/orders/counts \
  -H "Authorization: Bearer $B7R_API_KEY"
```

```javascript
const res = await fetch("https://api.b7r.app/v1/orders/counts", {
  headers: {
    Authorization: `Bearer ${process.env.B7R_API_KEY}`,
  },
});
const data = await res.json();
```

```python
import os, requests

res = requests.get(
    "https://api.b7r.app/v1/orders/counts",
    headers={
        "Authorization": f"Bearer {os.environ['B7R_API_KEY']}",
    },
    timeout=30,
)
data = res.json()
```

Answer (200 OK):

```json
{
  "counts": {
    "created": 4,
    "in_production": 2,
    "shipped": 7,
    "delivered": 31,
    "cancelled": 3
  }
}
```

## Read an order

`GET /v1/orders/{order_id}`

The status, the payment, the money, the lines, each shipment with its tracking, the invoice once made, and what you can do now (`allowed_actions`: `cancel`, `cancel_with_reason`, or none). Any order of your account reads, whatever its channel. The shopper comes back masked, without the address; add `include=customer` for the full shopper ([Shopper details](#shopper-details)).

Key: A key with the `orders:read` area.

Path:

- `order_id` (string, required): B7R's order id: opaque, `B` and digits.

Query:

- `include` (constant): customer: add the shopper to the answer. Needs the customers:read area; every such call is logged. Always `"customer"`.

Answer:

- `id` (string, required)
- `external_id` (string or null, required): Your own order id, on an order placed through the API; null on every other channel.
- `channel` (string, required): Where the order came from: api, manual, b7r_store, the store platform (salla, zid, shopify), or store for a store since removed. Accept a value you do not know.
- `store_order_id` (string or null, required): The store's own id of the order, as the B7R order page shows it; null when the order did not come from a store.
- `store_order_number` (string or null, required): The order number the shopper sees in the store, as the packing slip prints it; null when the order did not come from a store or the store sent none.
- `paid_by` (string, required): Who paid: wallet (your wallet), store_settlement (the store holds the payment and settles after delivery), shopper (a B7R store order: your wallet never moved). One of `wallet`, `store_settlement`, `shopper`.
- `status` (string, required): One of `created`, `in_production`, `shipped`, `delivered`, `cancelled`.
- `payment_status` (string, required): One of `paid`, `not_paid`, `awaiting_funds`, `refund_pending`, `refunded`.
- `funding` (object or null, required): Null unless the order is not_paid and your wallet pays it. The order waits as not_paid and is paid by itself after a top-up in the app; nothing else is needed.
  - `missing` (object, required): A top-up of this amount is sure to pay this order and every older unpaid order: the wallet pays unpaid orders oldest first. As of this read; the minimum top-up the app sets still applies.
    - `amount` (string, required)
    - `currency` (constant, required): Always `"SAR"`.
  - `top_up_url` (string (uri), required): Where you top up: your wallet in the B7R app.
- `delivery_method` (string, required): One of `home`, `pickup`.
- `seller` (object or null, required)
  - `id` (string, required)
  - `name` (string, required)
- `carrier_id` (string (uuid) or null, required)
- `money` (object, required)
  - `lines_total` (object, required)
    - `net` (string, required)
    - `vat` (string, required)
    - `gross` (string, required)
    - `currency` (constant, required): Always `"SAR"`.
  - `shipping` (object, required)
    - `net` (string, required)
    - `vat` (string, required)
    - `gross` (string, required)
    - `currency` (constant, required): Always `"SAR"`.
  - `total` (object, required)
    - `net` (string, required)
    - `vat` (string, required)
    - `gross` (string, required)
    - `currency` (constant, required): Always `"SAR"`.
- `sale` (object or null, required): A B7R store order's sale as your order page shows it: what the shopper paid, the payment and service fee, and your profit. Null on every other order.
  - `paid` (object, required)
    - `lines` (object, required)
      - `net` (string, required)
      - `vat` (string, required)
      - `gross` (string, required)
      - `currency` (constant, required): Always `"SAR"`.
    - `shipping` (object, required)
      - `net` (string, required)
      - `vat` (string, required)
      - `gross` (string, required)
      - `currency` (constant, required): Always `"SAR"`.
    - `total` (object, required)
      - `net` (string, required)
      - `vat` (string, required)
      - `gross` (string, required)
      - `currency` (constant, required): Always `"SAR"`.
  - `fee` (object, required)
    - `net` (string, required)
    - `vat` (string, required)
    - `gross` (string, required)
    - `currency` (constant, required): Always `"SAR"`.
  - `profit` (object, required)
    - `net` (string, required)
    - `vat` (string, required)
    - `gross` (string, required)
    - `currency` (constant, required): Always `"SAR"`.
- `shipments` (array of object, required)
  - `carrier_id` (string (uuid) or null, required)
  - `tracking_number` (string or null, required)
  - `tracking_url` (string or null, required)
  - `shipped_at` (string or null, required)
  - `delivered_at` (string or null, required)
- `cancellation` (object or null, required)
  - `code` (string, required): One of `merchant_self_cancel`, `print_error`, `damaged`, `lost_in_transit`, `policy_takedown`, `design_quality`, `store_cancel`, `creator_cancel`, `shopper_cancel`, `undeliverable`, `other`.
  - `message` (string or null, required)
- `invoice` (object or null, required)
  - `number` (string, required)
  - `issued_at` (string, required)
- `allowed_actions` (array of string, required)
- `created_at` (string, required)
- `line_items` (array of object, required)
  - `id` (string (uuid), required)
  - `sku` (string, required)
  - `quantity` (integer, required)
  - `unit_cost` (object, required)
    - `net` (string, required)
    - `vat` (string, required)
    - `gross` (string, required)
    - `currency` (constant, required): Always `"SAR"`.
  - `selling_price` (object, required)
    - `amount` (string, required)
    - `currency` (constant, required): Always `"SAR"`.
- `customer` (object or object, required): The shopper. Masked (name and phone only) unless you ask with include=customer and your key holds customers:read: then name, phone, email and gender in full.
  - `name` (string, required)
  - `phone` (string, required)
  - `email` (string or null, required)
  - `gender` (string or null, required)
- `shipping_address` (object or null, required): The shipping address, with include=customer and customers:read only; null otherwise.
  - `country` (string, required)
  - `city` (string, required)
  - `district` (string or null, required)
  - `street` (string or null, required)
  - `building` (string or null, required)
  - `postal_code` (string or null, required)
  - `national_address` (string or null, required)

Errors: `unauthorized` (401), `area_forbidden` (403), `account_inactive` (403), `connection_disabled` (403), `https_required` (403), `not_found` (404), `invalid_request` (400), `rate_limited` (429), `internal_error` (500), `upstream_unavailable` (502), `api_unavailable` (503), `request_expired` (503), `service_unavailable` (503), `upstream_timeout` (504), `try_again_later` (503). See [Errors](https://docs.b7r.app/errors).

Request:

```bash
curl https://api.b7r.app/v1/orders/B26112200042 \
  -H "Authorization: Bearer $B7R_API_KEY"
```

```javascript
const res = await fetch("https://api.b7r.app/v1/orders/B26112200042", {
  headers: {
    Authorization: `Bearer ${process.env.B7R_API_KEY}`,
  },
});
const data = await res.json();
```

```python
import os, requests

res = requests.get(
    "https://api.b7r.app/v1/orders/B26112200042",
    headers={
        "Authorization": f"Bearer {os.environ['B7R_API_KEY']}",
    },
    timeout=30,
)
data = res.json()
```

Answer (200 OK):

```json
{
  "id": "B26112200042",
  "external_id": "ord-77120",
  "channel": "api",
  "store_order_id": null,
  "store_order_number": null,
  "paid_by": "wallet",
  "status": "shipped",
  "payment_status": "paid",
  "funding": null,
  "seller": {
    "id": "seller-1042",
    "name": "Najd Prints"
  },
  "carrier_id": "9b1d3f5a-7c9e-4b1d-8f5a-6c8e0a2b4d6f",
  "delivery_method": "home",
  "money": {
    "lines_total": {
      "net": "120.00",
      "vat": "0.00",
      "gross": "120.00",
      "currency": "SAR"
    },
    "shipping": {
      "net": "25.00",
      "vat": "0.00",
      "gross": "25.00",
      "currency": "SAR"
    },
    "total": {
      "net": "145.00",
      "vat": "0.00",
      "gross": "145.00",
      "currency": "SAR"
    }
  },
  "sale": null,
  "shipments": [
    {
      "carrier_id": "9b1d3f5a-7c9e-4b1d-8f5a-6c8e0a2b4d6f",
      "tracking_number": "TRK7731904415",
      "tracking_url": "https://track.example.com/TRK7731904415",
      "shipped_at": "2026-11-24T08:05:40.120Z",
      "delivered_at": null
    }
  ],
  "cancellation": null,
  "allowed_actions": [],
  "invoice": {
    "number": "INV-2026-004210",
    "issued_at": "2026-11-23T07:44:02.330Z"
  },
  "created_at": "2026-11-22T12:30:11.902Z",
  "line_items": [
    {
      "id": "5b8c0d3e-4f6a-4b7c-9d8e-0f1a2b3c4d5e",
      "sku": "B7R-TS-0042-BLK-M",
      "quantity": 2,
      "unit_cost": {
        "net": "60.00",
        "vat": "0.00",
        "gross": "60.00",
        "currency": "SAR"
      },
      "selling_price": {
        "amount": "99.00",
        "currency": "SAR"
      }
    }
  ],
  "customer": {
    "name": "S***",
    "phone": "*********567"
  },
  "shipping_address": null
}
```

## An order's details

`GET /v1/orders/{order_id}/details`

What your order page shows of one order, with `order_details:read`: every status change, newest first; the carrier's events; what B7R changed on the order, by section; each line with its product, colour, size, technique, print zones and their photos and print sizes, whether a design changed since the order, the price, B7R's cost and the profit; the money (your revenue, B7R's cost including what an edit kept, your profit); and the flags (another carrier, a store's cancel request, items that are not B7R's). A Salla hold order adds its `hold`.

A B7R store order adds `store_order`: the sale (what the shopper paid, the fee, your profit), its documents, its complaints with their messages, and its events: an edit, a delivery exception opened or closed, and each time B7R printed an item again; `money` is then `null`. On a cancelled order every profit is `null`, as the order page shows none. No shopper's name, phone or address is here: read them with `include=customer` on the order. A complaint's messages are the shopper's own words: B7R records every read in your activity log. When any part cannot be read the answer is `503 service_unavailable`, never a shorter one.

Key: A key with the `order_details:read` area.

Path:

- `order_id` (string, required): B7R's order id: opaque, `B` and digits.

Answer:

- `order_id` (string, required)
- `status_history` (array of object, required): Every status change, newest first.
  - `from` (string or null, required)
  - `to` (string, required)
  - `reason` (string or null, required)
  - `at` (string, required)
- `tracking_events` (array of object, required): The carrier's events, oldest first.
  - `kind` (string, required)
  - `carrier_status` (string or null, required)
  - `at` (string, required)
  - `note` (string or null, required)
- `edits` (array of object, required): What B7R changed on the order, by section, oldest first.
  - `sections` (array of string, required)
  - `at` (string, required)
- `lines` (array of object, required)
  - `sku` (string, required)
  - `quantity` (integer, required)
  - `name` (object, required)
    - `ar` (string, required)
    - `en` (string, required)
  - `color` (object, required)
    - `name` (object, required)
      - `ar` (string, required)
      - `en` (string, required)
    - `hex` (string or null, required)
  - `size` (object, required)
    - `label` (string, required)
  - `technique` (object or null, required)
    - `id` (string, required)
    - `name` (object, required)
      - `ar` (string, required)
      - `en` (string, required)
  - `blank` (boolean, required): Sold with no print.
  - `zones` (array of object, required)
    - `zone_id` (string, required)
    - `name` (object, required)
      - `ar` (string, required)
      - `en` (string, required)
    - `photo_url` (string or null, required)
    - `print_size_cm` (object or null, required)
      - `width` (number, required)
      - `height` (number, required)
    - `design_changed_since_order` (boolean, required)
  - `unit_price` (string, required): Your selling price of one piece.
  - `unit_cost` (string, required): B7R's cost of one piece, locked at the order.
  - `profit` (string or null, required): The line's profit; null on a cancelled order.
- `money` (object or null, required): Your revenue, B7R's cost (what an edit kept included) and your profit, as the order page shows them; null on a B7R store order (see store_order.sale); profit null on a cancelled order.
  - `revenue` (string, required)
  - `cost` (string, required)
  - `kept` (string, required)
  - `profit` (string or null, required)
- `flags` (object, required)
  - `other_carrier` (object, required)
    - `pending` (boolean, required)
    - `raised_at` (string or null, required)
    - `cleared_at` (string or null, required)
  - `store_cancel_requested_at` (string or null, required)
  - `non_b7r_items` (object, required)
    - `present` (boolean, required)
    - `value` (string, required)
- `hold` (object or null, required): The store's hold of B7R's cost on a Salla hold order; null on any other.
  - `status` (string, required)
  - `amount` (string, required)
- `store_order` (object or null, required): A B7R store order only: its sale, documents, complaints and events.
  - `sale` (object, required)
    - `paid` (string, required)
    - `fee` (string, required)
    - `creator_profit` (string, required)
  - `documents` (array of object, required)
    - `id` (string, required)
    - `kind` (string, required)
    - `issued_at` (string, required)
    - `superseded` (boolean, required)
  - `complaints` (array of object, required)
    - `id` (string, required)
    - `issue_type` (string, required)
    - `status` (string, required)
    - `opened_at` (string, required)
    - `messages` (array of object, required)
      - `from` (string, required): One of `shopper`, `support`.
      - `body` (string, required)
      - `at` (string, required)
  - `events` (array of object, required)
    - `kind` (string, required): One of `edit`, `exception_opened`, `exception_closed`, `reprint`.
    - `at` (string, required)

Errors: `unauthorized` (401), `area_forbidden` (403), `account_inactive` (403), `connection_disabled` (403), `https_required` (403), `not_found` (404), `invalid_request` (400), `rate_limited` (429), `internal_error` (500), `upstream_unavailable` (502), `api_unavailable` (503), `request_expired` (503), `service_unavailable` (503), `upstream_timeout` (504). See [Errors](https://docs.b7r.app/errors).

Request:

```bash
curl https://api.b7r.app/v1/orders/B20261120007/details \
  -H "Authorization: Bearer $B7R_API_KEY"
```

```javascript
const res = await fetch("https://api.b7r.app/v1/orders/B20261120007/details", {
  headers: {
    Authorization: `Bearer ${process.env.B7R_API_KEY}`,
  },
});
const data = await res.json();
```

```python
import os, requests

res = requests.get(
    "https://api.b7r.app/v1/orders/B20261120007/details",
    headers={
        "Authorization": f"Bearer {os.environ['B7R_API_KEY']}",
    },
    timeout=30,
)
data = res.json()
```

Answer (200 OK):

```json
{
  "order_id": "B20261120007",
  "status_history": [
    {
      "from": "in_production",
      "to": "shipped",
      "reason": null,
      "at": "2026-11-21T08:02:11.000Z"
    },
    {
      "from": "created",
      "to": "in_production",
      "reason": null,
      "at": "2026-11-20T13:40:05.000Z"
    }
  ],
  "tracking_events": [
    {
      "kind": "picked_up",
      "carrier_status": "pickedUp",
      "at": "2026-11-21T09:15:00.000Z",
      "note": null
    }
  ],
  "edits": [],
  "lines": [
    {
      "sku": "TSWHMD00042",
      "quantity": 2,
      "name": {
        "ar": "قميص الصقر",
        "en": "Falcon shirt"
      },
      "color": {
        "name": {
          "ar": "أبيض",
          "en": "White"
        },
        "hex": "#FFFFFF"
      },
      "size": {
        "label": "M"
      },
      "technique": {
        "id": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",
        "name": {
          "ar": "طباعة DTF",
          "en": "DTF printing"
        }
      },
      "blank": false,
      "zones": [
        {
          "zone_id": "3d4e5f6a-7b8c-4d9e-8f0a-1b2c3d4e5f6a",
          "name": {
            "ar": "الأمام",
            "en": "Front"
          },
          "photo_url": "https://cdn.b7r.app/m/merchant-mockups/front.jpg",
          "print_size_cm": {
            "width": 28,
            "height": 35
          },
          "design_changed_since_order": false
        }
      ],
      "unit_price": "120.00",
      "unit_cost": "45.00",
      "profit": "150.00"
    }
  ],
  "money": {
    "revenue": "265.00",
    "cost": "115.00",
    "kept": "0.00",
    "profit": "150.00"
  },
  "flags": {
    "other_carrier": {
      "pending": false,
      "raised_at": null,
      "cleared_at": null
    },
    "store_cancel_requested_at": null,
    "non_b7r_items": {
      "present": false,
      "value": "0.00"
    }
  },
  "hold": null,
  "store_order": null
}
```

## Cancel an order

`POST /v1/orders/{order_id}/cancel`

Only while the order is `created`, for any channel, with the same refund as in the app. `allowed_actions` on the order says how the cancel goes:

`cancel`: an order your wallet paid or a store holds (API, manual, Salla, Zid, Shopify). Send no body. The wallet is refunded or the store hold released, and a store order is cancelled in the store too. A `reason` you send is checked (3 to 500 characters, no control characters) and not needed.

`cancel_with_reason`: a B7R store order. Send `{ "reason": "..." }` of 3 to 500 characters: without it the answer is `400 invalid_request` with the code `required` at `/body/reason`. The shopper is refunded in full through the payment gateway and your wallet never moves. A refused cancel answers `409 order_not_cancellable` with `errors[0].code` `self_service_off` (cancelling store orders is switched off), `too_late` (printing started), `payment_disputed` (the payment has an open dispute with the bank) or `not_allowed`. In a list, `cancel_with_reason` shows while cancelling store orders is on; an order B7R moved back to `created` after printing can still answer `too_late`, so read the order itself for the exact answer.

No action: the order cannot be cancelled through the API (`409 order_not_cancellable`): open a ticket from the Help Center in the B7R app. A created B7R store order also shows no action while cancelling store orders is switched off, and on its own read once the order has been printed. Cancelling an order you already cancelled answers `200` with it.

Its `external_id` stays taken: a new order needs a new one.

Key: A key with the `orders:write` area. Send `Idempotency-Key` and `Content-Type: application/json`.

Path:

- `order_id` (string, required): B7R's order id: opaque, `B` and digits.

Body:

- `reason` (string): 3 to 500.

Answer:

- `id` (string, required)
- `external_id` (string or null, required): Your own order id, on an order placed through the API; null on every other channel.
- `channel` (string, required): Where the order came from: api, manual, b7r_store, the store platform (salla, zid, shopify), or store for a store since removed. Accept a value you do not know.
- `store_order_id` (string or null, required): The store's own id of the order, as the B7R order page shows it; null when the order did not come from a store.
- `store_order_number` (string or null, required): The order number the shopper sees in the store, as the packing slip prints it; null when the order did not come from a store or the store sent none.
- `paid_by` (string, required): Who paid: wallet (your wallet), store_settlement (the store holds the payment and settles after delivery), shopper (a B7R store order: your wallet never moved). One of `wallet`, `store_settlement`, `shopper`.
- `status` (string, required): One of `created`, `in_production`, `shipped`, `delivered`, `cancelled`.
- `payment_status` (string, required): One of `paid`, `not_paid`, `awaiting_funds`, `refund_pending`, `refunded`.
- `funding` (object or null, required): Null unless the order is not_paid and your wallet pays it. The order waits as not_paid and is paid by itself after a top-up in the app; nothing else is needed.
  - `missing` (object, required): A top-up of this amount is sure to pay this order and every older unpaid order: the wallet pays unpaid orders oldest first. As of this read; the minimum top-up the app sets still applies.
    - `amount` (string, required)
    - `currency` (constant, required): Always `"SAR"`.
  - `top_up_url` (string (uri), required): Where you top up: your wallet in the B7R app.
- `delivery_method` (string, required): One of `home`, `pickup`.
- `seller` (object or null, required)
  - `id` (string, required)
  - `name` (string, required)
- `carrier_id` (string (uuid) or null, required)
- `money` (object, required)
  - `lines_total` (object, required)
    - `net` (string, required)
    - `vat` (string, required)
    - `gross` (string, required)
    - `currency` (constant, required): Always `"SAR"`.
  - `shipping` (object, required)
    - `net` (string, required)
    - `vat` (string, required)
    - `gross` (string, required)
    - `currency` (constant, required): Always `"SAR"`.
  - `total` (object, required)
    - `net` (string, required)
    - `vat` (string, required)
    - `gross` (string, required)
    - `currency` (constant, required): Always `"SAR"`.
- `sale` (object or null, required): A B7R store order's sale as your order page shows it: what the shopper paid, the payment and service fee, and your profit. Null on every other order.
  - `paid` (object, required)
    - `lines` (object, required)
      - `net` (string, required)
      - `vat` (string, required)
      - `gross` (string, required)
      - `currency` (constant, required): Always `"SAR"`.
    - `shipping` (object, required)
      - `net` (string, required)
      - `vat` (string, required)
      - `gross` (string, required)
      - `currency` (constant, required): Always `"SAR"`.
    - `total` (object, required)
      - `net` (string, required)
      - `vat` (string, required)
      - `gross` (string, required)
      - `currency` (constant, required): Always `"SAR"`.
  - `fee` (object, required)
    - `net` (string, required)
    - `vat` (string, required)
    - `gross` (string, required)
    - `currency` (constant, required): Always `"SAR"`.
  - `profit` (object, required)
    - `net` (string, required)
    - `vat` (string, required)
    - `gross` (string, required)
    - `currency` (constant, required): Always `"SAR"`.
- `shipments` (array of object, required)
  - `carrier_id` (string (uuid) or null, required)
  - `tracking_number` (string or null, required)
  - `tracking_url` (string or null, required)
  - `shipped_at` (string or null, required)
  - `delivered_at` (string or null, required)
- `cancellation` (object or null, required)
  - `code` (string, required): One of `merchant_self_cancel`, `print_error`, `damaged`, `lost_in_transit`, `policy_takedown`, `design_quality`, `store_cancel`, `creator_cancel`, `shopper_cancel`, `undeliverable`, `other`.
  - `message` (string or null, required)
- `invoice` (object or null, required)
  - `number` (string, required)
  - `issued_at` (string, required)
- `allowed_actions` (array of string, required)
- `created_at` (string, required)
- `line_items` (array of object, required)
  - `id` (string (uuid), required)
  - `sku` (string, required)
  - `quantity` (integer, required)
  - `unit_cost` (object, required)
    - `net` (string, required)
    - `vat` (string, required)
    - `gross` (string, required)
    - `currency` (constant, required): Always `"SAR"`.
  - `selling_price` (object, required)
    - `amount` (string, required)
    - `currency` (constant, required): Always `"SAR"`.
- `customer` (object, required): The shopper, masked: the name's first letter and the phone's last 3 digits. In full only on GET /v1/orders/{order_id}?include=customer with customers:read.
  - `name` (string, required)
  - `phone` (string, required)
- `shipping_address` (null, required): Always null here. The address comes only on GET /v1/orders/{order_id}?include=customer with customers:read.

Errors: `unauthorized` (401), `area_forbidden` (403), `account_inactive` (403), `connection_disabled` (403), `https_required` (403), `not_found` (404), `invalid_request` (400), `idempotency_key_required` (400), `request_too_large` (413), `unsupported_media_type` (415), `rate_limited` (429), `internal_error` (500), `upstream_unavailable` (502), `api_unavailable` (503), `request_expired` (503), `service_unavailable` (503), `upstream_timeout` (504), `idempotency_mismatch` (409), `idempotency_in_flight` (409), `order_not_cancellable` (409). See [Errors](https://docs.b7r.app/errors).

Request:

```bash
curl -X POST https://api.b7r.app/v1/orders/B26112300017/cancel \
  -H "Authorization: Bearer $B7R_API_KEY" \
  -H "Idempotency-Key: $(uuidgen 2>/dev/null || node -e 'console.log(crypto.randomUUID())')" \
  -H "Content-Type: application/json" \
  -d '{
    "reason": "The shopper asked to cancel by message."
  }'
```

```javascript
const res = await fetch("https://api.b7r.app/v1/orders/B26112300017/cancel", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.B7R_API_KEY}`,
    "Idempotency-Key": crypto.randomUUID(),
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "reason": "The shopper asked to cancel by message."
  }),
});
const data = await res.json();
```

```python
import os, requests, uuid

res = requests.post(
    "https://api.b7r.app/v1/orders/B26112300017/cancel",
    headers={
        "Authorization": f"Bearer {os.environ['B7R_API_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "reason": "The shopper asked to cancel by message."
    },
    timeout=30,
)
data = res.json()
```

Answer (200 OK):

```json
{
  "id": "B26112300017",
  "external_id": null,
  "channel": "b7r_store",
  "store_order_id": null,
  "store_order_number": null,
  "paid_by": "shopper",
  "status": "cancelled",
  "payment_status": "refund_pending",
  "funding": null,
  "seller": null,
  "carrier_id": "9b1d3f5a-7c9e-4b1d-8f5a-6c8e0a2b4d6f",
  "delivery_method": "home",
  "money": {
    "lines_total": {
      "net": "120.00",
      "vat": "0.00",
      "gross": "120.00",
      "currency": "SAR"
    },
    "shipping": {
      "net": "25.00",
      "vat": "0.00",
      "gross": "25.00",
      "currency": "SAR"
    },
    "total": {
      "net": "145.00",
      "vat": "0.00",
      "gross": "145.00",
      "currency": "SAR"
    }
  },
  "sale": {
    "paid": {
      "lines": {
        "net": "198.00",
        "vat": "0.00",
        "gross": "198.00",
        "currency": "SAR"
      },
      "shipping": {
        "net": "25.00",
        "vat": "0.00",
        "gross": "25.00",
        "currency": "SAR"
      },
      "total": {
        "net": "223.00",
        "vat": "0.00",
        "gross": "223.00",
        "currency": "SAR"
      }
    },
    "fee": {
      "net": "6.50",
      "vat": "0.00",
      "gross": "6.50",
      "currency": "SAR"
    },
    "profit": {
      "net": "71.50",
      "vat": "0.00",
      "gross": "71.50",
      "currency": "SAR"
    }
  },
  "shipments": [],
  "cancellation": {
    "code": "creator_cancel",
    "message": "The shopper asked to cancel by message."
  },
  "allowed_actions": [],
  "invoice": null,
  "created_at": "2026-11-23T14:02:37.118Z",
  "line_items": [
    {
      "id": "6c9d1e4f-5a7b-4c8d-8e9f-1a2b3c4d5e6f",
      "sku": "B7R-TS-0042-BLK-M",
      "quantity": 2,
      "unit_cost": {
        "net": "60.00",
        "vat": "0.00",
        "gross": "60.00",
        "currency": "SAR"
      },
      "selling_price": {
        "amount": "99.00",
        "currency": "SAR"
      }
    }
  ],
  "customer": {
    "name": "N***",
    "phone": "*********321"
  },
  "shipping_address": null
}
```

Cancel an order paid from your wallet: no body:

```bash
curl -X POST https://api.b7r.app/v1/orders/B26112200042/cancel \
  -H "Authorization: Bearer $B7R_API_KEY" \
  -H "Idempotency-Key: $(uuidgen 2>/dev/null || node -e 'console.log(crypto.randomUUID())')"
```

```javascript
const res = await fetch("https://api.b7r.app/v1/orders/B26112200042/cancel", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.B7R_API_KEY}`,
    "Idempotency-Key": crypto.randomUUID(),
  },
});
const data = await res.json();
```

```python
import os, requests, uuid

res = requests.post(
    "https://api.b7r.app/v1/orders/B26112200042/cancel",
    headers={
        "Authorization": f"Bearer {os.environ['B7R_API_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    timeout=30,
)
data = res.json()
```

200 OK:

```json
{
  "id": "B26112200042",
  "external_id": "ord-77120",
  "channel": "api",
  "store_order_id": null,
  "store_order_number": null,
  "paid_by": "wallet",
  "status": "cancelled",
  "payment_status": "refunded",
  "funding": null,
  "seller": {
    "id": "seller-1042",
    "name": "Najd Prints"
  },
  "carrier_id": "9b1d3f5a-7c9e-4b1d-8f5a-6c8e0a2b4d6f",
  "delivery_method": "home",
  "money": {
    "lines_total": {
      "net": "120.00",
      "vat": "0.00",
      "gross": "120.00",
      "currency": "SAR"
    },
    "shipping": {
      "net": "25.00",
      "vat": "0.00",
      "gross": "25.00",
      "currency": "SAR"
    },
    "total": {
      "net": "145.00",
      "vat": "0.00",
      "gross": "145.00",
      "currency": "SAR"
    }
  },
  "sale": null,
  "shipments": [],
  "cancellation": {
    "code": "merchant_self_cancel",
    "message": null
  },
  "allowed_actions": [],
  "invoice": null,
  "created_at": "2026-11-22T12:30:11.902Z",
  "line_items": [
    {
      "id": "5b8c0d3e-4f6a-4b7c-9d8e-0f1a2b3c4d5e",
      "sku": "B7R-TS-0042-BLK-M",
      "quantity": 2,
      "unit_cost": {
        "net": "60.00",
        "vat": "0.00",
        "gross": "60.00",
        "currency": "SAR"
      },
      "selling_price": {
        "amount": "99.00",
        "currency": "SAR"
      }
    }
  ],
  "customer": {
    "name": "S***",
    "phone": "*********567"
  },
  "shipping_address": null
}
```
