# Updates

> The updates B7R posts to your server when an order, a product or the wallet changes: kinds, body, signature headers, retries, and the catch-up list.

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

When something changes on your orders, products or wallet, B7R posts an update to the address you set on the Custom API card in the app (`https`, port 443, a public host name). Each update is signed, and stays in the catch-up list for 30 days. How to receive them, step by step: [Receive updates](https://docs.b7r.app/receive-updates).

Updates cover every order and product of your account, whatever its channel (a store, the B7R app, your B7R store or the API), for as long as the account has an active key. A change made while it has none is not recorded, the orders you placed through the API included: after the last key is revoked (with the orders it cancels on the way) or expires, their changes send no update. So when you replace a key, create the new one before you revoke the old one.

## Kinds

| `type` | Sent when | `data` |
| --- | --- | --- |
| `order.created` | An order you did not place through the API appears on your account: from a store, made in the B7R app, or from your B7R store. | The order |
| `order.status_changed` | The status moves, forward or back. | The order, `previous_status`, `direction` (`forward`, `backward`, or `reopened` out of `cancelled`), `reason` |
| `order.payment_changed` | An unpaid order is paid, or a payment is refunded. | The order, `previous_payment_status` |
| `order.cancelled` | The order is cancelled, by you or B7R, with the reason. A paid order also sends `order.payment_changed` as it is refunded. | The order, `previous_status` |
| `order.held` | B7R holds the order: a design it prints was taken down or sent back for changes. | The order, `zones`: the zones that block printing |
| `order.released` | The hold ends. | The order, `zones`: every printed zone with its current state |
| `order.edited` | B7R changes the order for you (lines, address). | The order |
| `order.tracking_updated` | The carrier changes, or the tracking of a shipped order is added or changes. | The order |
| `product.photos_ready` | A round of photos is done (once per round). | The product, `generation`, `photo_count`, `failed_count` |
| `product.updated` | The product changes, in the app or through the API. | The product, `changed`: any of `name`, `description`, `price`, `status`, `taken_down`, `published` (it joined the Custom API), `link_status`, `designs`, `sizes` (its SKUs followed a change of the base product's sizes or colours) |
| `product.artwork_review_changed` | A design is approved, sent back, taken down or reopened. | The product, `review` |
| `product.store_changed` | A product goes on, is hidden on, or leaves one of your connected stores, whoever did it (the app, a store job, a store disconnect); or a [store job](https://docs.b7r.app/store-jobs) synced it, or failed. Each store job ends with one update carrying its `job_id`. Only for an account with a key holding `stores:read`. | The product, `store_id`, `state` (`published`, `hidden`, `removed`, `synced` or `failed`), `reason` (a failed job's [reason](https://docs.b7r.app/store-jobs#why-a-job-failed), else `null`), `job_id` (the store job running on that product and store at that moment, else `null`) |
| `inbox.notification_created` | A notification reaches your inbox, as the bell shows it: an order moved, a store connected, a What’s New post, and more. A ticket’s replies are not here: read them with [`GET /v1/tickets`](https://docs.b7r.app/tickets). Only for an account with a key holding `notifications`. These updates are best effort: [`GET /v1/notifications`](https://docs.b7r.app/notifications) is the source of truth, so read it when you need every notification. | `id` (your account's inbox), `notification_id` (the notification, as [`GET /v1/notifications`](https://docs.b7r.app/notifications) lists it), `kind` (its kind, a word that can grow: accept one you do not know), `target` (`type` `order`, `product`, `store` or `post` and its `id`, or `null`). Never its title or text: read the notification for those. |
| `wallet.low_balance` | The balance falls under the low-balance line. It can come again after a top-up if the balance falls under the line again. | `balance`, `threshold`, `currency` |

An order in an update has no shopper, lines or money: read [`GET /v1/orders/{order_id}`](https://docs.b7r.app/orders#read-an-order) for those. Ignore a `type` you do not know: kinds can be added to v1.

The order's fields read as in [`GET /v1/orders/{order_id}`](https://docs.b7r.app/orders#read-an-order): `id`, `external_id`, `status`, `payment_status`, `delivery_method` (`home` or `pickup`), `seller`, `carrier_id`, `tracking_number` and `tracking_url`, `cancellation` (its `code` from [the cancellation codes](https://docs.b7r.app/orders#cancellation-codes)) and `created_at`. The tracking is set only once the order is `shipped` or `delivered` by a `home` carrier, as the order's `shipments` show it; a `pickup` order has none.

On updates recorded from 2026-11-25, the order also says where it came from and who paid: `channel`, `store_order_id`, `store_order_number` and `paid_by`, read as in [`GET /v1/orders/{order_id}`](https://docs.b7r.app/orders#read-an-order). An earlier update has none of them and stays as it was sent, so treat the four as optional. `channel` is a name, not a fixed list: accept a value you do not know. An update never carries the shopper's details, whatever your key's areas.

## The body

- `id`: the update id, `evt_` and 32 hex characters. The same on every retry of it.
- `type`, `created_at` (UTC) and `subject`: what changed (`order`, `product`, `wallet`, or `inbox`, your account’s inbox, whose id is your account) and its id.
- `sequence`: rises with each change of the same subject. One subject's updates go out in `sequence` order, and `order.created` comes before any other update of its order, but across subjects and on retries order is not guaranteed: keep the highest `sequence` per subject and ignore a lower one (`product.store_changed` has its own rule, below).
- `data`: the whole state at the change, so the newest update is enough.
- `product.store_changed` shares its product's `sequence` but is about one store. Where the product is on a store: keep the highest `sequence` per product and `store_id` among `published`, `hidden` and `removed`. A `synced` or `failed` update says how a [store job](https://docs.b7r.app/store-jobs) ended and changes no place. A lower `sequence` from another store is not stale: it is that store's own update.
- `sample`: `true` only on a sample from `POST /v1/events/test`.

order.status_changed:

```json
{
  "id": "evt_9f2c4a7e1b3d5f6081a2c3e4d5f60718",
  "type": "order.status_changed",
  "created_at": "2026-11-25T07:44:02.330Z",
  "sequence": 2,
  "subject": {
    "type": "order",
    "id": "B26112200042"
  },
  "data": {
    "id": "B26112200042",
    "external_id": "ord-77120",
    "channel": "api",
    "store_order_id": null,
    "store_order_number": null,
    "paid_by": "wallet",
    "status": "in_production",
    "payment_status": "paid",
    "delivery_method": "home",
    "seller": {
      "id": "seller-1042",
      "name": "Najd Prints"
    },
    "carrier_id": "9b1d3f5a-7c9e-4b1d-8f5a-6c8e0a2b4d6f",
    "tracking_number": null,
    "tracking_url": null,
    "cancellation": null,
    "created_at": "2026-11-22T12:30:11.902Z",
    "previous_status": "created",
    "direction": "forward",
    "reason": null
  },
  "sample": false
}
```

product.artwork_review_changed:

```json
{
  "id": "evt_0a1b2c3d4e5f60718293a4b5c6d7e8f9",
  "type": "product.artwork_review_changed",
  "created_at": "2026-11-22T10:48:12.204Z",
  "sequence": 3,
  "subject": {
    "type": "product",
    "id": "3f6a8b1c-2d4e-4f5a-9b6c-7d8e9f0a1b2c"
  },
  "data": {
    "id": "3f6a8b1c-2d4e-4f5a-9b6c-7d8e9f0a1b2c",
    "external_id": "falcon-tee-001",
    "status": "active",
    "seller": {
      "id": "seller-1042",
      "name": "Najd Prints"
    },
    "updated_at": "2026-11-22T10:48:12.204Z",
    "review": {
      "state": "changes_requested",
      "previous_state": "pending",
      "reason_code": "low_resolution",
      "message": "The front design is blurry at print size. Send a larger file.",
      "artwork_id": "4a7b9c2d-3e5f-4a6b-8c7d-9e0f1a2b3c4d",
      "zones": [
        "5e7a9c1b-3d5f-4b7a-9c1e-2f4a6b8c0d2e"
      ]
    }
  },
  "sample": false
}
```

product.store_changed:

```json
{
  "id": "evt_1c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f",
  "type": "product.store_changed",
  "created_at": "2026-11-26T09:00:07.214Z",
  "sequence": 4,
  "subject": {
    "type": "product",
    "id": "3f6a8b1c-2d4e-4f5a-9b6c-7d8e9f0a1b2c"
  },
  "data": {
    "id": "3f6a8b1c-2d4e-4f5a-9b6c-7d8e9f0a1b2c",
    "external_id": "falcon-tee-001",
    "status": "active",
    "seller": {
      "id": "seller-1042",
      "name": "Najd Prints"
    },
    "updated_at": "2026-11-26T09:00:07.214Z",
    "store_id": "1a2b3c4d-1111-4a5b-8c6d-7e8f9a0b1c2d",
    "state": "published",
    "reason": null,
    "job_id": "b1c2d3e4-0001-4f5a-8b6c-7d8e9f0a1b2c"
  },
  "sample": false
}
```

## Headers and signature

Updates follow [Standard Webhooks](https://www.standardwebhooks.com). Each POST carries `content-type: application/json` and three headers:

| Header | Value |
| --- | --- |
| `webhook-id` | The update `id`. Drop an id you already handled. |
| `webhook-timestamp` | When this attempt was sent, in Unix seconds. Refuse one more than 5 minutes old. |
| `webhook-signature` | `v1,` then the base64 HMAC-SHA256 of `<webhook-id>.<webhook-timestamp>.<body>`, keyed with your secret. Two entries, space separated, for a day after you rotate the secret. |

Your secret is `whsec_` followed by base64: the HMAC key is the decoded bytes after `whsec_`. It is shown once on the Custom API card when you create or rotate it. Sign over the raw body bytes, before any JSON parsing. Code and a test vector: [Receive updates](https://docs.b7r.app/receive-updates#check-the-signature).

## Delivery and retries

- The first attempt is usually within seconds, at most about 5 minutes. Each attempt waits 10 seconds for your answer.
- Any `2xx` is delivered. Only `410 Gone` stops an update at once.
- Every other answer is retried: any other `4xx`, a `5xx`, a redirect (never followed), a timeout or a network error. `Retry-After` is honoured.
- So answer `2xx` fast, even for kinds you ignore, and answer `410` only to stop that update for good.
- Retries come after about 5 minutes, 30 minutes, 2 hours, 5 hours, 10 hours, 14 hours, 20 hours and 24 hours (each give or take 10 %): 9 attempts over about 3 days. Then the update is marked failed on the Custom API card, and it stays in the catch-up list.
- When your address answers no `2xx` for 72 hours, with at least 10 failed attempts, B7R turns updates off and emails your account. Updates are still recorded for the catch-up list; turn them on again on the Custom API card.
- These are the current values. `GET /v1/me` answers the ones that apply to your account, in its `updates` block.

## Catch up on updates

`GET /v1/events`

Every update of the last 30 days, oldest first, exactly as it was sent. Start without `cursor`, store `next_cursor`, and call again with it. `next_cursor` is never null: when nothing new arrived it comes back unchanged, so you can poll with it.

The list holds only the kinds your key's areas can read: `order.*` needs `orders:read`, `product.*` needs `products:read` (but `product.store_changed`, which needs `stores:read`), `wallet.*` needs `wallet:read`, `inbox.*` needs `notifications`.

Key: Any valid key.

Query:

- `limit` (string)
- `cursor` (string): 1 to 64.

Answer:

- `data` (array of object, required)
  - `id` (string, required)
  - `type` (string, required): One of `order.created`, `order.status_changed`, `order.payment_changed`, `order.cancelled`, `order.held`, `order.released`, `order.edited`, `order.tracking_updated`, `product.photos_ready`, `product.updated`, `product.artwork_review_changed`, `product.store_changed`, `wallet.low_balance`, `inbox.notification_created`.
  - `created_at` (string, required)
  - `sequence` (integer, required): At least 0.
  - `subject` (object, required)
    - `type` (string, required): One of `order`, `product`, `wallet`, `inbox`.
    - `id` (string, required): At least 1.
  - `data` (object, required)
  - `sample` (boolean, required)
- `next_cursor` (string, required)
- `has_more` (boolean, required)

Errors: `unauthorized` (401), `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/events?limit=50" \
  -H "Authorization: Bearer $B7R_API_KEY"
```

```javascript
const res = await fetch("https://api.b7r.app/v1/events?limit=50", {
  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/events?limit=50",
    headers={
        "Authorization": f"Bearer {os.environ['B7R_API_KEY']}",
    },
    timeout=30,
)
data = res.json()
```

Answer (200 OK):

```json
{
  "data": [
    {
      "id": "evt_9f2c4a7e1b3d5f6081a2c3e4d5f60718",
      "type": "order.status_changed",
      "created_at": "2026-11-25T07:44:02.330Z",
      "sequence": 2,
      "subject": {
        "type": "order",
        "id": "B26112200042"
      },
      "data": {
        "id": "B26112200042",
        "external_id": "ord-77120",
        "channel": "api",
        "store_order_id": null,
        "store_order_number": null,
        "paid_by": "wallet",
        "status": "in_production",
        "payment_status": "paid",
        "delivery_method": "home",
        "seller": {
          "id": "seller-1042",
          "name": "Najd Prints"
        },
        "carrier_id": "9b1d3f5a-7c9e-4b1d-8f5a-6c8e0a2b4d6f",
        "tracking_number": null,
        "tracking_url": null,
        "cancellation": null,
        "created_at": "2026-11-22T12:30:11.902Z",
        "previous_status": "created",
        "direction": "forward",
        "reason": null
      },
      "sample": false
    }
  ],
  "next_cursor": "ev_4Rk8Wm2Tq7Yd1Nx5",
  "has_more": false
}
```

## Send a sample update

`POST /v1/events/test`

Posts a signed sample of the `type` you name to your address at once, and answers how it went. While B7R has paused all updates it answers `503 service_unavailable` (retryable). A sample has `sample: true` and `sequence: 0`; it is never stored, never retried and never counts as a failure.

Key: Any valid key. Send `Idempotency-Key` and `Content-Type: application/json`.

Body:

- `type` (string, required): One of `order.created`, `order.status_changed`, `order.payment_changed`, `order.cancelled`, `order.held`, `order.released`, `order.edited`, `order.tracking_updated`, `product.photos_ready`, `product.updated`, `product.artwork_review_changed`, `product.store_changed`, `wallet.low_balance`, `inbox.notification_created`.

Answer:

- `event_id` (string, required)
- `delivered` (boolean, required)
- `status_code` (integer or null, required)
- `outcome` (string, required)

Errors: `unauthorized` (401), `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), `updates_address_missing` (409), `updates_disabled` (409). See [Errors](https://docs.b7r.app/errors).

Request:

```bash
curl -X POST https://api.b7r.app/v1/events/test \
  -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 '{
    "type": "order.status_changed"
  }'
```

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

```python
import os, requests, uuid

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

Answer (200 OK):

```json
{
  "event_id": "evt_5e6f708192a3b4c5d6e7f8091a2b3c4d",
  "delivered": true,
  "status_code": 200,
  "outcome": "delivered"
}
```

## Send an update again

`POST /v1/events/resend`

Posts one of your updates that did not arrive (its last try failed for good) to your address once more, as إعادة الإرسال in Settings does, and answers how it went. An update that is not yours, or that arrived or is still being tried, answers `404 not_found`. It counts against `settings_writes_per_minute` (`GET /v1/me?include=limits`) and the resend limit the app shares. Its answer is kept: the same `Idempotency-Key` answers it again without sending, so send again with a new key. A retry after a lost answer may answer `not_found` because the first call delivered the update: read `GET /v1/events` to see it.

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

Body:

- `event_id` (string, required): The update, as GET /v1/events and the API log name it

Answer:

- `event_id` (string, required)
- `delivered` (boolean, required)
- `status_code` (integer or null, required)
- `outcome` (string, required)

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), `updates_address_missing` (409), `updates_disabled` (409). See [Errors](https://docs.b7r.app/errors).

Request:

```bash
curl -X POST https://api.b7r.app/v1/events/resend \
  -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 '{
    "event_id": "evt_5e6f708192a3b4c5d6e7f8091a2b3c4d"
  }'
```

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

```python
import os, requests, uuid

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

Answer (200 OK):

```json
{
  "event_id": "evt_5e6f708192a3b4c5d6e7f8091a2b3c4d",
  "delivered": true,
  "status_code": 200,
  "outcome": "delivered"
}
```
