Overview
The API reports how many documents your company sent and received in a period. Use these numbers for cost control, for internal reports, or to re-invoice usage to your own customers. The same response contains an estimate of the number of days that the credit balance covers. Two endpoints give the data:GET /api/statsreturns the usage counts and the estimate.GET /api/me/returns the plan and the credit balance of the company.
What counts as usage
One sent document is one action. One received document is one action. The response reports the two types of action separately:
These rules apply to the counts:
- Documents in the
DRAFT,TRANSITorFAILEDstate are not counted. A send that fails is not usage. - Deleted documents are not counted. If you delete a document, the counts of earlier periods can become lower.
- A document belongs to the day on which it was created in e-invoice.be, not to its
invoice_date. An invoice with an invoice date in a previous month is counted in the period in which you created it.
The API keeps each response for 5 minutes. A document that you sent a moment ago can be absent from the counts until that time has passed.
Get usage statistics
Send aGET request to /api/stats. All query parameters are optional.
string
First day of the period, in
yyyy-mm-dd format. If you omit it, the period starts on the day of the first counted document.string
Last day of the period, in
yyyy-mm-dd format. The full day is included. If you omit it, the period ends on the day of the last counted document.string
default:"DAY"
Size of the periods in
actions: DAY, WEEK or MONTH.Usage per day
Response
actions. In this example there are no entries for 5 and 6 September, and no DOCUMENT_RECEIVED entry for 2 September. The company in the examples on this page has a credit balance of 5000.
Usage per week
cURL
Response
stat_date is 2026-08-31, the Monday of the week that contains 1 September. The count of that week contains only the documents from 1 September, because documents before start_date are not in the period.
Usage per month
cURL
Response
Response fields
string
required
Identifier of the company that owns the API key.
string
required
First day of the period (
yyyy-mm-dd). Equal to start_date when you gave it. Otherwise the day of the first counted document.string
required
Last day of the period (
yyyy-mm-dd). Equal to end_date when you gave it. Otherwise the day of the last counted document.string
required
The aggregation that the API used:
DAY, WEEK or MONTH.object[]
required
One entry for each combination of period and action that has a minimum of one document. The entries are sorted by
stat_date, then by action. The list is empty when the period has no counted documents.integer
required
Number of days from
period_start to period_end, both days included. The minimum is 1.number
required
Sum of all counts divided by
total_days, rounded to one decimal.number
default:"0.0"
Estimated number of days that the credit balance covers. See Read the budget estimate.
How stat_date relates to the aggregation
With
WEEK or MONTH, the first stat_date can be earlier than period_start. This occurs when start_date is not a Monday or not the first day of a month. The count for that entry contains only the documents inside the period.
For totals per calendar week or calendar month, set start_date to the first day and end_date to the last day of a full week or month.
Read the budget estimate
budget_estimation_days compares the credit balance with the usage of the period in the request. One action uses one credit.
average_daily_usage is 7.4, so the estimate is 5000 / 7.4 = 675.7 days.
The estimate changes with the period that you request, because the average changes. A short, busy period gives a lower estimate than a long period that contains quiet months. For a forecast, use a period that represents your normal volume, for example the last 30 or 90 days.
Credit balance and plan
GET /api/me/ returns the account data of the company, with the plan and the credit_balance.
cURL
Response
string
Plan of the company:
starter, pro or enterprise.integer
Credit balance of the company. This is the value that
budget_estimation_days uses.Usage per tenant for resellers
In the reseller programme, each customer is a tenant with its own API key.GET /api/stats always reports the tenant that owns the API key in the request. To get the usage of each tenant, call the endpoint one time for each tenant, with the API key of that tenant. The tenant_id in each response tells you to which tenant the numbers belong.
You create and read the API keys of a tenant with the Admin API. The Admin API also lets you set the plan and the credit_balance of a tenant.
The samples below read a JSON object from the environment variable E_INVOICE_TENANT_KEYS. The object maps a name of your choice to the API key of a tenant, for example {"customer-a": "<api key>", "customer-b": "<api key>"}. The samples print the monthly totals of each tenant.
Usage of each tenant (Node.js and Python)
Usage of each tenant (Node.js and Python)
Output
Sandbox companies
A sandbox company has no credits and no billing.GET /api/stats operates the same for a sandbox company as for a production company: it counts the documents of that company that are in the SENT or RECEIVED state. Each company has its own API key, so the documents of a sandbox company are never in the counts of a production company.
Do not use credit_balance or budget_estimation_days of a sandbox company for a forecast.
Errors
404 response
Next Steps
Reseller programme
Manage tenants and re-invoice usage to your customers.
Admin API
Create tenants and API keys, and set the plan and credit balance.
Go-live checklist
Move from a sandbox company to a production company.
Document lifecycle and delivery tracking
See which document states exist and when a document becomes
SENT or RECEIVED.