Improved

Cost center, analytical splits and expense categories on invoices (experimental)

List invoices and Get invoice now return the accounting coding of each invoice, in three new fields:

  • costCenter – the cost center the invoice is coded to (id and name), or null when none is set;
  • analyticalSplits – how the invoice total is allocated: for each split, a percentage (from 0 to 100, the splits of an invoice add up to 100), a costCenter (or null) and the analyticalProperties set on it. Empty when the invoice is not split;
  • expenseCategories – the expense categories the invoice is coded to (id and name), sorted by name. Empty when none is set. These are the ids the expenseCategoryId filter matches; a split invoice matches if any of its categories does.

costCenter and analyticalSplits are set independently: a split can name a different cost center than the invoice's own.

curl --request GET \
     --url 'https://public-api.spendesk.com/v2/companies/7j6mvn11rqf7j5/invoices?expenseCategoryId=<expense category id>&limit=50' \
     --header 'accept: application/json' \
     --header 'authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.masked'
📘

Coding is on the invoice, not on its lines

Coding is set on the whole invoice. In lineItems[] of Get invoice, costCenter and expenseCategory are always null and analyticalProperties is always empty, as they were before: read costCenter, analyticalSplits and expenseCategories on the invoice.

Invoice data is now cached for up to 20 minutes on the list, the summary and the single-invoice endpoints: a change can take that long to appear.

These endpoints remain experimental (scope experimental:invoice:read).