Skip to content

Pagination

All endpoints that return lists of results support server-side pagination. This allows you to retrieve large data sets in manageable chunks.

Request parameters

Parameter Type Default Description
page integer 1 Page number (1-based)
page_size integer 100 Number of items per page

Example:

curl https://api.invoicetronic.com/v1/receive?page=2&page_size=20 \
  -u YOUR_API_KEY:

Response header

The response includes the Invoicetronic-Total-Count header, which indicates the total number of items matching the query, regardless of pagination.

Header Description
Invoicetronic-Total-Count Total number of available items

The response body only contains the items for the current page.

Example

Request:

curl -v https://api.invoicetronic.com/v1/receive?page=1&page_size=20 \
  -u YOUR_API_KEY:

Response (headers):

HTTP/1.1 200 OK
Content-Type: application/json
Invoicetronic-Total-Count: 150

Response (body):

[
  { "id": 1, "..." : "..." },
  { "id": 2, "..." : "..." }
]

In this example, there are 150 total items. With page_size=20, there are 8 pages (the last one with 10 items).

Calculating total pages

The total number of pages can be calculated as:

total_pages = ceil(Invoicetronic-Total-Count / page_size)

Tip

Use Invoicetronic-Total-Count to display navigation information to the user, such as the total number of pages or results. Set page_size to the minimum needed for your use case to reduce response times and resource usage.