Creating invoices via API draft status

Hi,

When we are calling the API to create an invoice, it’s getting created but the status of the invoice is “draft”. Therefore, it requires us to go into FreeAgent GUI and press the send by email to change the status of the invoice and for a copy to be sent to the customer.

How can we make the invoice be in the “open” status, 10 days payment terms and an invoice copy to be sent to the customer via email please?

Thanks

Hi Ahmed,

The Email an Invoice API will let you send the invoice by email, putting it into the open state:

POST https://api.freeagent.com/v2/invoices/:id/send_email

You can either put the email content (subject line, body etc) into the API call or you can customise your New Invoice email template under Settings in FreeAgent, then pass "use_template": true. The documentation gives examples of both.

The 10 days payment terms can be configured by setting the "payment_terms_in_days": 10 attribute when creating the invoice.

Kind regards,
Dominic