Developers

Public API pagination

Read a Costfluent Public API list one page at a time with page and limit, and follow its links to the next page.

Every list operation answers with the same envelope: the page's items in data, and links to the neighbouring pages in links. Cost data adds what the whole query covers in meta.

Read a list page by page

  1. Request the first page with page=1 and the limit you want.
  2. Process data.
  3. When links.next is set, request that link; it keeps every filter of the first request. When it is null, that was the last page.
TerminalCode
curl --get https://api.costfluent.com/v1/budgets \ --data page=1 --data limit=100 \ --header "Authorization: Bearer $COSTFLUENT_API_TOKEN"
JSONCode
{ "links": { "self": "https://api.costfluent.com/v1/budgets?page=1&limit=100", "first": "https://api.costfluent.com/v1/budgets?page=1&limit=100", "prev": null, "next": "https://api.costfluent.com/v1/budgets?page=2&limit=100", "last": "https://api.costfluent.com/v1/budgets?page=3&limit=100" }, "data": [] }

Page size

OperationlimitDefault
Every list, such as budgets, cost reports or integrations1 to 100; a larger or smaller value is held to that range20
Business metric values, GET /v1/business-metrics/{metricId}/values1 to 1,000; a larger or smaller value is held to that range20
Cost data, GET /v1/costs1 to 5,000; a value outside that range is refused with 40020

page and limit are optional on every list. The API reference states each operation's range in the parameter's description and its default beside it.

Reading cost data in bulk

Cost data is the one bulk read: ask for limit=5000 to read a window in as few requests as possible. Paging reaches 100,000 rows, page × limit; a request past that is refused with 400, and its error says to split the date window. Read a large window as several shorter startDate to endDate ranges, each from page 1.

meta.totalRecords counts every row the query matches, so meta.totalRecords divided by limit tells you how many pages to expect before you start.

Notice a sync between pages

Each page is read from the data as it stands when you request it. When a sync lands while you walk the pages, rows move: a later page can repeat a row you already have, or skip one. To notice, send the meta.dataVersion of your first page as dataVersion with every later page. The links of a request that sends it carry it, so following links.next keeps it.

TerminalCode
curl --get https://api.costfluent.com/v1/costs \ --data startDate=2026-09-01 --data endDate=2026-09-30 \ --data page=2 --data limit=5000 --data dataVersion=3f2a9c0d1e4b5a68 \ --header "Authorization: Bearer $COSTFLUENT_API_TOKEN"

A page whose data a sync changed since your first page is refused with 409 and the code conflict. Read the window again from page 1 without dataVersion, and send the new first page's version from then on. A dataVersion that is not 16 lowercase hexadecimal characters, the form every version takes, is refused with 400. Without dataVersion, every page is served as before.

How it behaves

  • page starts at 1. A page past the end answers 200 with an empty data.
  • Paging reaches 2,147,483,646 items, page × limit; a page past that is refused with 400, a validation_failed error naming page.
  • links.last is null when the total is not known.