API - third party credit or credit invoice

Hi

Using API would like to mark an invoice as credit available. At the moment I can create a negative amount invoice but we need to manually “mark as credit available” before I can use it as discount of a new invoice

I can do that with UI, but not from API

Currently, form API we create third parties and also customer invoices (normal invoice) and negative amount invoices.

Is it possible?

Thanks
Dan

In the JSON, set a type parameter with value 2 (for credit note). You can check the other parameter values in compta/facture/class/facture.class.php