Pull your usage via the API
2 min read
If you would rather show your API usage in your own dashboard than log in with us, you can pull the figures directly.
Three endpoints
GET /v1/usage— today's and this month's usage against your quota.GET /v1/usage/history— the last 90 days, one row per day.GET /v1/usage/stats— the detailed one you can group.
The base URL is https://api.danskadresseapi.dk.
Getting started
curl "https://api.danskadresseapi.dk/v1/usage/stats" \
-H "Authorization: Bearer sk_live_..."You get one row per day with kald (calls), fakturerbare (billable), fejl (errors) and gns_latency_ms (average latency).
Group the figures
The gruppering parameter takes dag (day, the default), time (hour), endpoint or noegle (key):
# Which endpoints account for the most traffic?
curl "https://api.danskadresseapi.dk/v1/usage/stats?gruppering=endpoint" \
-H "Authorization: Bearer sk_live_..."With gruppering=noegle the key name is included in the navn field — handy if you keep one key per environment and want to see test versus production.
Narrow the period with fra and til (YYYY-MM-DD). It defaults to the last 30 days.
Key requirements
This needs a live key with the usage scope. Public keys cannot read account information.
If your key has restricted scopes, tickusagein the key settings. Otherwise you get a403.
Worth knowing
- Figures are aggregated per minute and kept for about a month. If you need longer history, pull and store it as you go — we cannot reconstruct it after the fact.
fejlcovers both 4xx and 5xx.fakturerbarecounts only the calls that go against your quota.gns_latency_msis our response time. Network time out to you is not included, so the number is lower than your own measurements.- The response contains endpoint names and counters, never what your users searched for. So you can show it in your own interface without it becoming personal data.
Was this helpful?
