Skip to content

Dashboard Statistics

Returns the aggregate statistics that power the Bagisto admin Dashboard screen — sales, orders, customers, visitors, stock alerts, top products and top customers.

EndpointGET /api/admin/dashboard/stats
ReturnsA JSON array with a single element: [ { type, dateRange, statistics } ]

All admin endpoints require an admin Bearer token — see Authentication.

Understanding type — the dashboard is seven separate calls

This is the most important thing to understand about this API.

The Bagisto admin Dashboard you see in the panel is not one response. The page is assembled from seven independent requests, one per section, and each is selected with the ?type= query parameter. These seven groups are exactly the sections of the admin Dashboard screen — no more, no less.

So a single call returns one section of the dashboard. To render the full screen, call the endpoint once per type (or only for the sections you need). The statistics payload changes shape per type — sometimes an object, sometimes a flat array — so always branch on type when consuming it.

Which type maps to which part of the dashboard

Dashboard section (admin panel)typestatistics is
Overall Details cards (Total Sales / Orders / Customers / Average Order Sale / Total Unpaid Invoices)over-allobject
Today's Details + today's order listtodayobject
Stock Threshold product liststock-threshold-productsarray
Store Stats sales charttotal-salesobject (with over_time series)
Visitors charttotal-visitorsobject (with over_time series)
Top Selling Products listtop-selling-productsarray
Customer With Most Sales listtop-customersarray

over-all is the default — if you omit ?type=, you get the "Overall Details" cards.

Query parameters

ParamTypeRequiredDescription
typeenumNoOne of the seven values above. Defaults to over-all. An unknown value returns 400 (invalid-type).
startdate (YYYY-MM-DD)NoLower bound of the reporting window. Defaults to 30 days ago.
enddate (YYYY-MM-DD)NoUpper bound. Defaults to today.
channelstringNoChannel code to scope the figures to a single channel. Defaults to all channels.

start / end drive both the figures and the previous baseline used for each progress percentage — the previous period is the same-length window immediately before start.

Response envelope

The endpoint always returns a single-element array: [ { type, dateRange, statistics } ].

  • type — echoes back the requested group.
  • dateRange — a human-readable label for the window (e.g. "03 May - 02 Jun"). (This is fully populated over REST; it is null over the GraphQL transport.)
  • statistics — an object or array whose shape depends on type (documented below).

Response shapes by type

Figures with a previous / current / progress shape are period comparisons: current is the chosen window, previous is the preceding window of equal length, and progress is the percentage change (can be negative).

over-all

KeyShapeMeaning
total_customers{ previous, current, progress }New customers registered.
total_orders{ previous, current, progress }Orders placed.
total_sales{ previous, current, formatted_total, progress }Gross sales; formatted_total is the current value in base currency.
avg_sales{ previous, current, formatted_total, progress }Average order value.
total_unpaid_invoices{ total, formatted_total }Outstanding invoice amount (no period comparison).

today

KeyShapeMeaning
total_sales{ previous, current, formatted_total, progress }Today's sales vs. yesterday.
total_orders{ previous, current, progress }Today's orders.
total_customers{ previous, current, progress }Today's new customers.
ordersarrayOrders placed today. Each row: id, increment_id, status, status_label, payment_method, base_grand_total, formatted_base_grand_total, channel_name, customer_email, customer_name, items, billing_address, created_at.

orders[].items is admin HTML

The items field is a pre-rendered admin-panel Blade snippet (an HTML string of product thumbnails), carried over verbatim from core. It is not structured data — a headless client should ignore it and fetch line items from the Orders API (/api/admin/orders/{id}) when product detail is needed.

stock-threshold-products

statistics is an array (up to 5 rows). Each row: id, sku, name, price, formatted_price, total_qty, image (base-image URL or null).

total-sales

KeyShapeMeaning
total_orders{ previous, current, progress }Orders in the window.
total_sales{ previous, current, formatted_total, progress }Sales in the window.
over_timearray of { label, total, count }One bucket per day across startend for the chart line. total is sales, count is order count.

total-visitors

KeyShapeMeaning
total{ previous, current, progress }All visits.
unique{ previous, current, progress }Unique visitors.
over_timearray of { label, total }One bucket per day for the chart.

Visitor figures depend on the Bagisto visitor/analytics tables being populated; on a fresh store they are 0.

top-selling-products

statistics is an array (up to 5 rows). Each row: id, name, price, formatted_price, revenue, formatted_revenue, and images (array of { id, type, path, product_id, position, url }).

top-customers

statistics is an array (up to 5 rows). Each row: id (may be null for guest checkouts), email, full_name (may be null), total, orders, formatted_total, datetime.

Errors

ConditionHTTPBody
Missing / invalid Bearer token401{ "message": "Unauthenticated.", "error": "unauthenticated" }
Unknown type value400{ ... "Invalid dashboard stat type." }

See also

Released under the MIT License.