How to Post /invoices

Sage has recently changed the required fields to make a successful post to their V3 sales_invoice endpoint. Below are all the required fields you will need, you can pass more (obviously) but these fields are absolutely required.

JSON payload

{
 "date": "some_date",
 "contact_id": "some_contact_id",
 "main_address": {
 "address_line_1": "some_address"
 },
 "invoice_lines": [{
 "description": "some_description",
 "quantity": "some_quantity",
 "ledger_account_id": "some_ledger_account_id",
 "unit_price": "some_price",
 "tax_rate_id": "some_tax_rate_id"
 }]
 }

One thing to note is the ledger_account_id needs to correspond to a Sales Ledger Account. If you don't know off hand which ledger accounts those are you can call the following endpoint.

curl -X GET "https://console.cloud-elements.com/elements/api-v2/hubs/finance/ledger-accounts?where=visible_in%3D'sales'" -H "accept: application/json" -H "Authorization: User <user secret>, Organization <org secret>, Element <element secret>"

This call returns the Sales Ledger Accounts. Find the ledger account id you want to use, plug it into the POST payload, and you should be all set.