Skip to content

GET /api/v1/usage

Paginated usage history: each row is one billed event (async settlement or synchronous endpoint charge). Read-only; scoped to the authenticated user.

Query parameters

ParamDefaultNotes
page11-based page index.
limit50Page size, 1200. Invalid → 400.
sortidOne of: id, created_at, eur_cents_charged, credits_charged, units.
orderdescasc or desc.

Call the endpoint

bash
curl -sS -H "Authorization: Bearer $SYBILION_API_TOKEN" \
  "https://api.sybilion.dev/api/v1/usage?page=1&limit=20&sort=created_at&order=desc"
python
total = 0
for page in client.iter_usage_pages(limit=50):
    total += len(page.usage_events)
print("usage events:", total)
go
err := c.ForEachUsagePage(context.Background(), "created_at", "desc", 50,
	func(ctx context.Context, page *api.ApiV1UsageGet200Response) (bool, error) {
		fmt.Println("page total:", page.Pagination.GetTotal())
		return false, nil
	},
)
if err != nil {
	log.Fatal(err)
}
r
library(sybilion)

cl <- sybilion_client(token = Sys.getenv("SYBILION_API_TOKEN"))
total <- 0
cl$iter_usage_pages(function(page) {
  total <<- total + length(page$usage_events)
})
cat("usage events:", total, "\n")
java
import com.sybilion.Client;
import com.sybilion.Options;

Client c = new Client(Options.builder().token(System.getenv("SYBILION_API_TOKEN")).build());
final int[] total = {0};
c.forEachUsagePage("created_at", "desc", 50, page -> {
    total[0] += page.getUsageEvents().size();
    System.out.println("page total: " + page.getPagination().getTotal());
    return false; // only first page
});

Response

json
{
  "usage_events": [
    {
      "id": 4821,
      "endpoint": "forecast",
      "units": 1,
      "credits_charged": 3,
      "eur_cents_charged": 3,
      "created_at": "2026-04-30T10:05:42Z",
      "async_job_id": "1f2a8b3e-4c5d-46d7-9a01-2b3c4d5e6f70"
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 20,
    "total": 142,
    "total_pages": 8,
    "sort": "created_at",
    "order": "desc"
  }
}

Field reference

usage_events[]

FieldMeaning
idAuto-increment row identifier.
endpointBilling route key (e.g. "forecast", "drivers", "alerts"). May be null on older rows.
unitsMetered quantity — item count for per-result billing, or 1 for flat-fee calls.
credits_chargedWhole credits debited.
eur_cents_chargedEUR cents debited.
created_atISO 8601 timestamp of when the charge was recorded.
async_job_idUUID of the related async job, or null for synchronous calls.

pagination

FieldMeaning
pageCurrent 1-indexed page.
limitPage size used for this response.
totalTotal matching rows across all pages.
total_pagesceil(total / limit).
sortSort field used.
orderSort direction used.

Common errors

CodeCauseWhat to do
400Invalid query parameter (e.g. limit out of range, unrecognised sort).Check the query parameters table above.
401Missing or invalid bearer token.Check the API key.

[email protected] · Slack · Discord (links in Community page & header icons)