---
title: "Get Usage Statistics"
method: GET
path: "/api/stats"
tags: ["Tenant"]
---

# Get Usage Statistics

`GET /api/stats`

Retrieve usage statistics for billing purposes. Returns statistics for document sent and document received actions, grouped by aggregation period (day/week/month). If no date parameters are provided, returns daily stats for all available data.

## Query parameters

- `start_date` string, date, nullable — Start date in yyyy-mm-dd format. If not provided, queries from earliest available data.
- `end_date` string, date, nullable — End date in yyyy-mm-dd format. If not provided, queries to latest available data.
- `aggregation` 'DAY' | 'WEEK' | 'MONTH'

## Response `200`

Successful Response

- StatsResponse — Statistics response for a tenant.
  - `tenant_id` string, required — Tenant ID
  - `period_start` string, date, required — Start date of the period
  - `period_end` string, date, required — End date of the period
  - `aggregation` 'DAY' | 'WEEK' | 'MONTH', required
  - `actions` ActionStats[], required — List of action statistics, one entry per aggregation period per action
    - `action` 'DOCUMENT_SENT' | 'DOCUMENT_RECEIVED', required
    - `stat_date` string, date, required — The date/period this stat represents. For DAY aggregation this is the specific day, for WEEK it's the start of the week, for MONTH it's the first day of the month
    - `count` integer, required — Number of occurrences of this action in this period
  - `total_days` integer, required — Number of days in the period
  - `average_daily_usage` number, required — Average daily usage (total actions / total days)
  - `budget_estimation_days` number — Estimated days until credits run out (credit_balance / average_daily_usage). 0.0 if average_daily_usage is 0 or credit_balance is None

## Other responses

- `400` — Bad Request: Invalid date range or format
- `401` — Unauthorized: API key is missing, invalid, or inactive
- `422` — Validation Error
- `500` — Internal Server Error: Unexpected server error

---

[API](https://skmtc.net/e-invoice-be/apis/e-invoice-be-peppol-access-point-api.md) · [All operations](https://skmtc.net/e-invoice-be/apis/e-invoice-be-peppol-access-point-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/e-invoice-be/e-invoice-be-peppol-access-point-api/revisions/a5b8396effe8/schema)
