R2 Developers
R2 Connect API

Reporting & BI

How to feed a dashboard or a data warehouse with a business’s operation running on R2.

To build your own dashboards or load a data warehouse, the path is to read orders and payments in date blocks and store them on your side. With read:orders, read:payments and read:items you have what you need to compute almost any metric.

Metrics you can derive#

MetricHow to build it
Revenue per periodSum of total from non-cancelled orders, grouped by date.
Average rateLodging revenue divided by nights sold, taken from the lines.
Channel mixOrders grouped by channel.
Payment method mixCollected payments grouped by method.
Best sellersOrder lines aggregated by item_name.
Returning customersCustomer directory filtered by visit_count.

Block loading#

For the initial historical load, go month by month instead of requesting everything at once: it stays well within the limits and lets you retry a single month if something fails.

javascript
// Initial load: one month at a time
for (const [from, to] of monthsBetween("2025-01-01", "2026-07-31")) {
  const orders = await readAll("orders", {
    created_from: from,
    created_to: to,
  });
  await saveToWarehouse(orders);
  console.log(from, "→", orders.length, "orders");
}

Does a report already solve this?

Before building dashboards from scratch, check whether the business already has what it needs inside R2: the platform includes a report builder with connectors to the most common business intelligence tools. This API makes sense when you need the raw data inside your own product.