Retrieve metrics
Get revenue, payment counts, new customers and approval rate over time, with the period before.
The numbers on the dashboard's home page, for any range. Each metric has a total, a series with one value per bucket in buckets, and the same for the period just before in previous_total and previous_series. change_pct compares the two, and is null without a comparison or when the previous total is zero.
Payments count in the bucket they were created in. Money is in US cents, and range.end is exclusive. A restricted key needs read access to payments.
Metrics
revenuecurrencyWhat succeeded payments were worth.net_revenuecurrencyRevenue plus fees customers paid, less 402pay's rate and flat fee on each payment.successful_paymentscountPayments that succeeded.new_customerscountCustomers whose first successful payment falls in the bucket.average_paymentcurrencyRevenue divided by successful payments.approval_ratepercentThe share of payments with an outcome that didn't fail, from 0 to 100.pendingandexpiredpayments never reached one, so they don't count.
Query
periodstring24h, 3d, 7d, 30d, 4w, 3m, 12m, ytd or all, counted back from today.allstarts at your first payment. Defaults to30d.fromdateA calendar date such as2026-09-24, sent withtoinstead ofperiod.todateThe last day of the range, included.timezonestringAn IANA time zone, such asAmerica/New_York, that days and buckets follow. Defaults toUTC.intervalstringThe bucket size: hour, day, week or month. Defaults tohourfor24handdayotherwise.comparestringprevious_period, the default, ornone, which leaves the previous fieldsnull.
Errors
- 400
invalid_requestA parameter has a value it can't take,periodwas sent withfromandto, or the range needs more than 1,000 buckets at the interval.
Any request can also fail on its key or its body. See errors.
Request
curl "https://dash.402pay.co/api/v1/metrics?from=2026-09-24&to=2026-09-26" \ -H "Authorization: Bearer $PAY402_SECRET_KEY"Response200 OK
{ "data": { "kind": "metrics", "currency": "USD", "timezone": "UTC", "interval": "day", "period": null, "range": { "start": "2026-09-24T00:00:00.000Z", "end": "2026-09-27T00:00:00.000Z" }, "compare_range": { "start": "2026-09-21T00:00:00.000Z", "end": "2026-09-24T00:00:00.000Z" }, "buckets": [ "2026-09-24T00:00:00.000Z", "2026-09-25T00:00:00.000Z", "2026-09-26T00:00:00.000Z" ], "metrics": { "revenue": { "unit": "currency", "total": 184900, "series": [17400, 97500, 70000], "previous_total": 303000, "previous_series": [39800, 34500, 228700], "change_pct": -39 }, "net_revenue": { "unit": "currency", "total": 181944, "series": [17072, 95853, 69019], "previous_total": 300937, "previous_series": [39375, 33909, 227653], "change_pct": -39.5 }, "successful_payments": { "unit": "count", "total": 22, "series": [4, 9, 9], "previous_total": 17, "previous_series": [5, 6, 6], "change_pct": 29.4 }, "new_customers": { "unit": "count", "total": 3, "series": [0, 0, 3], "previous_total": 4, "previous_series": [0, 0, 4], "change_pct": -25 }, "average_payment": { "unit": "currency", "total": 8405, "series": [4350, 10833, 7778], "previous_total": 17824, "previous_series": [7960, 5750, 38117], "change_pct": -52.8 }, "approval_rate": { "unit": "percent", "total": 95.7, "series": [80, 100, 100], "previous_total": 89.5, "previous_series": [100, 85.7, 85.7], "change_pct": 6.9 } } }}