Getting invoice and all associated credit note/transaction data

Hi,

We’re using your API to gather customer data for internal use. The aim is to get, for a given customer and within a given date range, a list of all invoices as well as all credit notes and bank transaction explanations associated with those invoices.

The problem we’re facing is that it doesn’t currently seem possible to efficiently gather this data. In the docs we’d discovered invoice timeline items, which we thought might be what we need, but it’s not possible to filter the data returned from this endpoint in any way meaning it’s not scalable and subsequently can’t be used.

Is there a simpler way to retrieve this data that we’re overlooking, rather than performing a number of calls and combining the data ourselves - is there a particular endpoint(s) that’d be more suitable?

Any help or advice is much appreciated.

Thanks!

Hello,

Unfortunately we don’t support this functionality via a single API at the moment, but we’ve noted this as a feature request.

The closest you could get at the moment I think would be to retrieve all invoices and credit notes related to that contact between a given date range with a call such as

{{url}}/v2/invoices?contact={{url}}/v2/contacts/:id&from_date=2022-07-13&to_date=2022-07-21

Then also retrieve all bank transaction explanations within a certain period with a call such as

{{url}}/v2/bank_transaction_explanations?bank_account={{url}}/v2/bank_accounts/:id&from_date=2021-09-07&to_date=2021-10-24

You could then look at the paid_invoice field of each bank_transaction_explanation if it exists to see if this matches the invoice you are interested in, then combining all the data.

Kind regards,
Claudiu