Invoices sorted descending return credit note?

Hello!

Upon doing the request (production)

GET /v2/invoices?page=1&per_page=1&sort=-dated_on

as a result I’m given back the latest CREDIT NOTE (instead of the latest invoice)

When requesting for the earliest invoice (GET /v2/invoices?page=1&per_page=1&sort=dated_on) everything is OK.

Can you please check if this is really the case.

Many thanks,
Tomislav Barbaric

Hi Tomislav,

This is expected behaviour at the moment as the invoices endpoint will list both invoices and credit notes (negative value invoices, essentially).

I think the only workaround I can suggest at present is to fetch more than one item and to iterate through the results to find the first suitable invoice, ignoring credit notes.

Kind regards,
Dominic

Thank you very much for a prompt response!