API - pagination


When reading the list of the invoices via the API, I am unable to set the number of results per page; e.g.:
GET …/api/v1/invoices?page=5
GET …/api/v1/invoices?page=9
return the same list as
GET …/api/v1/invoices
(i.e. all the invoices)

In addition, I did not find in the documentation how to specify the offset.

Many thanks in advance for your help.

I’m not sure, in my testing it seems to be working. The ‘page’ setting is the offset, you can set the number per request by setting per_page in the request.

"meta": {
    "pagination": {
        "total": 64,
        "count": 15,
        "per_page": 15,
        "current_page": 2,
        "total_pages": 5,
        "links": {
            "previous": "http:\/\/ninja.dev\/api\/v1\/invoices?page=1",
            "next": "http:\/\/ninja.dev\/api\/v1\/invoices?page=3"

It now works fine after I upgrade to Invoice Ninja 2.6.10.
The info about the settings ‘page’ and ‘per_page’ is very valuable.
Many thanks.

Great to hear, thanks for letting us know!