# Reports

> Your dashboard figures, your profit by store and product, and your first steps, as the B7R app shows them.

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

> Ids, figures and times in the examples are samples. Read the real values from the API.

The reads below need the key area `reports:read`. They answer the figures your dashboard, profit page and first steps show in the app, for every order of your account. A period is `today`, `7d` or `30d` (that many days ending today) or `total` (the default), counted in Riyadh days: today starts at midnight in Riyadh. Money is SAR with two decimals; a profit can be negative. The figures are what B7R charged you, as your pages show them, never a cost inside B7R. When B7R cannot read them right now, a read answers `503 try_again_later`: wait the `Retry-After` seconds and send it again.

## Read your dashboard

`GET /v1/reports/dashboard`

The stat cards of the period: what customers paid for your paid sales (`revenue`, products and the shipping they paid), your `profit` after what B7R charged, the `orders` and `products_sold`. An order cancelled with its money kept counts its charge against your profit and nothing else, as on your dashboard. `chart` counts the orders by hour for today, by day for 7 days, by week for 30 days and by month for the total; each point gives the app’s `label` and its start in `starts_at`.

`wallet` is your balance and the low-balance warning your dashboard shows; it needs `wallet:read` beside `reports:read`, and is `null` without it. `low_balance` is `false` when no low-balance threshold is set; when the threshold cannot be read, the whole read answers `503 try_again_later` rather than a line without its warning. `welcome_bonus` is the state of your welcome bonus and its amount.

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

Query:

- `period` (string): One of `today`, `7d`, `30d`, `total`.

Answer:

- `period` (string, required): One of `today`, `7d`, `30d`, `total`.
- `revenue` (string, required)
- `profit` (string, required)
- `orders` (integer, required)
- `products_sold` (integer, required)
- `chart` (array of object, required)
  - `label` (string, required)
  - `starts_at` (string, required)
  - `orders` (integer, required)
- `wallet` (object or null, required)
  - `balance` (string, required)
  - `low_balance_threshold` (string or null, required)
  - `low_balance` (boolean, required)
- `welcome_bonus` (object, required)
  - `state` (string, required): One of `not_eligible`, `pending_verify`, `crediting`, `stuck_pending`, `credited`, `unknown`.
  - `amount` (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/reports/dashboard?period=7d" \
  -H "Authorization: Bearer $B7R_API_KEY"
```

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

Answer (200 OK):

```json
{
  "period": "7d",
  "revenue": "1450.00",
  "profit": "410.00",
  "orders": 12,
  "products_sold": 17,
  "chart": [
    {
      "label": "Fri",
      "starts_at": "2026-11-19T21:00:00.000Z",
      "orders": 1
    },
    {
      "label": "Sat",
      "starts_at": "2026-11-20T21:00:00.000Z",
      "orders": 3
    }
  ],
  "wallet": {
    "balance": "320.00",
    "low_balance_threshold": null,
    "low_balance": false
  },
  "welcome_bonus": {
    "state": "not_eligible",
    "amount": null
  }
}
```

## Read your profit

`GET /v1/reports/profit`

Your profit page for the period, between the Riyadh days `from` and `to`: what customers paid, what B7R charged (split into the products, the carrier fee and the B7R store fee) and the profit, then by store and by product at each price. A connected store’s line is its orders; `b7rStore` is your B7R store; `manual` orders have no customer price, so their `customers_paid` and `profit` are null and they stay out of the totals.

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

Query:

- `period` (string): One of `today`, `7d`, `30d`, `total`.

Answer:

- `period` (string, required): One of `today`, `7d`, `30d`, `total`.
- `from` (string, required)
- `to` (string, required)
- `customers_paid` (string, required)
- `b7r_charges` (string, required)
- `charges_products` (string, required)
- `charges_shipping` (string, required)
- `charges_store_fee` (string, required)
- `profit` (string, required)
- `margin` (number or null, required)
- `orders` (integer, required)
- `stores` (array of object, required)
  - `kind` (string, required): One of `connected`, `b7rStore`, `manual`.
  - `store_connection_id` (string (uuid) or null, required)
  - `orders` (integer, required)
  - `customers_paid` (string or null, required)
  - `b7r_charges` (string, required)
  - `profit` (string or null, required)
- `products` (array of object, required)
  - `product_id` (string (uuid), required)
  - `sold` (integer, required)
  - `price` (string, required)
  - `b7r_charge_per_item` (string, required)
  - `profit_per_item` (string, required)
  - `profit` (string, 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/reports/profit?period=30d" \
  -H "Authorization: Bearer $B7R_API_KEY"
```

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

Answer (200 OK):

```json
{
  "period": "30d",
  "from": "2026-10-28",
  "to": "2026-11-26",
  "customers_paid": "2400.00",
  "b7r_charges": "1650.00",
  "charges_products": "1200.00",
  "charges_shipping": "400.00",
  "charges_store_fee": "50.00",
  "profit": "750.00",
  "margin": 0.3125,
  "orders": 16,
  "stores": [
    {
      "kind": "connected",
      "store_connection_id": "8b9c0d1e-2f3a-4b4c-9d5e-6f7a8b9c0d1e",
      "orders": 14,
      "customers_paid": "2100.00",
      "b7r_charges": "1450.00",
      "profit": "650.00"
    },
    {
      "kind": "b7rStore",
      "store_connection_id": null,
      "orders": 2,
      "customers_paid": "300.00",
      "b7r_charges": "200.00",
      "profit": "100.00"
    }
  ],
  "products": [
    {
      "product_id": "4d5e6f7a-8b9c-4d0e-9f2a-3b4c5d6e7f8a",
      "sold": 20,
      "price": "120.00",
      "b7r_charge_per_item": "60.00",
      "profit_per_item": "60.00",
      "profit": "1200.00"
    }
  ]
}
```

## Read your first steps

`GET /v1/reports/setup`

The six first steps of your dashboard, in order, each done or left: confirm your email, verification, a product, publish it, top up, the first order. They are answered even after you hid the guide in the app (`dismissed: true`).

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

Answer:

- `dismissed` (boolean, required)
- `steps` (array of object, required)
  - `id` (string, required): One of `email`, `verification`, `product`, `publish`, `topup`, `order`.
  - `done` (boolean, 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/reports/setup \
  -H "Authorization: Bearer $B7R_API_KEY"
```

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

Answer (200 OK):

```json
{
  "dismissed": false,
  "steps": [
    {
      "id": "email",
      "done": true
    },
    {
      "id": "verification",
      "done": true
    },
    {
      "id": "product",
      "done": true
    },
    {
      "id": "publish",
      "done": false
    },
    {
      "id": "topup",
      "done": true
    },
    {
      "id": "order",
      "done": false
    }
  ]
}
```
